hassle_rs/intellisense/
ffi.rs

1use crate::os::{BSTR, HRESULT, LPCSTR, LPSTR};
2use bitflags::bitflags;
3use com::{interfaces, interfaces::IUnknown, AbiTransferable, IID};
4
5/// Manual implementation of:
6/// ```ignore
7/// unsafe impl<T: bitflags::BitFlags> AbiTransferable for T {
8///     type Abi = T::Bits;
9///     // ...
10/// }
11/// ```
12macro_rules! abi_transferable {
13    ($t:ident) => {
14        unsafe impl AbiTransferable for $t {
15            type Abi = u32;
16
17            fn get_abi(&self) -> Self::Abi {
18                self.bits()
19            }
20
21            fn set_abi(&mut self) -> *mut Self::Abi {
22                &mut self.bits()
23            }
24        }
25    };
26}
27
28bitflags! {
29    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
30    pub struct DxcGlobalOptions : u32 {
31        const NONE = 0x0;
32        const THREAD_BACKGROUND_PRIORITY_FOR_INDEXING = 0x1;
33        const THREAD_BACKGROUND_PRIORITY_FOR_EDITING = 0x2;
34        const THREAD_BACKGROUND_PRIORITY_FOR_ALL
35            = DxcGlobalOptions::THREAD_BACKGROUND_PRIORITY_FOR_INDEXING.bits()
36            | DxcGlobalOptions::THREAD_BACKGROUND_PRIORITY_FOR_EDITING.bits();
37    }
38}
39abi_transferable!(DxcGlobalOptions);
40
41bitflags! {
42    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
43    pub struct DxcDiagnosticSeverity : u32 {
44        const IGNORED = 0;
45        const NOTE = 1;
46        const WARNING = 2;
47        const ERROR = 3;
48        const FATAL = 4;
49    }
50}
51
52bitflags! {
53    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
54    pub struct DxcTokenKind : u32 {
55        const PUNCTUATION = 0;
56        const KEYWORD = 1;
57        const IDENTIFIER = 2;
58        const LITERAL = 3;
59        const COMMENT = 4;
60        const UNKNOWN = 5;
61        const BUILT_IN_TYPE = 6;
62    }
63}
64
65bitflags! {
66    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
67    pub struct DxcTypeKind : u32 {
68        const Invalid = 0; // Represents an invalid type (e.g., where no type is available).
69        const Unexposed = 1; // A type whose specific kind is not exposed via this interface.
70        // Builtin types
71        const Void = 2;
72        const Bool = 3;
73        const Char_U = 4;
74        const UChar = 5;
75        const Char16 = 6;
76        const Char32 = 7;
77        const UShort = 8;
78        const UInt = 9;
79        const ULong = 10;
80        const ULongLong = 11;
81        const UInt128 = 12;
82        const Char_S = 13;
83        const SChar = 14;
84        const WChar = 15;
85        const Short = 16;
86        const Int = 17;
87        const Long = 18;
88        const LongLong = 19;
89        const Int128 = 20;
90        const Float = 21;
91        const Double = 22;
92        const LongDouble = 23;
93        const NullPtr = 24;
94        const Overload = 25;
95        const Dependent = 26;
96        const ObjCId = 27;
97        const ObjCClass = 28;
98        const ObjCSel = 29;
99        const FirstBuiltin = DxcTypeKind::Void.bits();
100        const LastBuiltin = DxcTypeKind::ObjCSel.bits();
101
102        const Complex = 100;
103        const Pointer = 101;
104        const BlockPointer = 102;
105        const LValueReference = 103;
106        const RValueReference = 104;
107        const Record = 105;
108        const Enum = 106;
109        const Typedef = 107;
110        const ObjCInterface = 108;
111        const ObjCObjectPointer = 109;
112        const FunctionNoProto = 110;
113        const FunctionProto = 111;
114        const ConstantArray = 112;
115        const Vector = 113;
116        const IncompleteArray = 114;
117        const VariableArray = 115;
118        const DependentSizedArray = 116;
119        const MemberPointer = 117;
120    }
121}
122
123bitflags! {
124    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
125    pub struct DxcCursorFormatting : u32 {
126        const DEFAULT = 0x0;
127        const USE_LANGUAGE_OPTIONS = 0x1;
128        const SUPPRESS_SPECIFIERS = 0x2;
129        const SUPPRESS_TAG_KEYWORD = 0x4;
130        const INCLUDE_NAMESPACE_KEYWORD = 0x8;
131    }
132}
133abi_transferable!(DxcCursorFormatting);
134
135bitflags! {
136    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
137    pub struct DxcTranslationUnitFlags : u32 {
138        const NONE = 0x0;
139        const DETAILED_PREPROCESSING_RECORD = 0x01;
140        const INCOMPLETE = 0x02;
141        const PRECOMPILED_PREAMBLE = 0x04;
142        const CACHE_COMPLETION_RESULTS = 0x08;
143        const FOR_SERIALIZATION = 0x10;
144        const CXX_CHAINED_PCH = 0x20;
145        const SKIP_FUNCTION_BODIES = 0x40;
146        const INCLUDE_BRIEF_COMMENTS_IN_CODE_COMPLETION = 0x80;
147        const USE_CALLER_THREAD = 0x800;
148    }
149}
150abi_transferable!(DxcTranslationUnitFlags);
151
152bitflags! {
153    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
154    pub struct DxcDiagnosticDisplayOptions : u32 {
155        const DISPLAY_SOURCE_LOCATION = 0x01;
156        const DISPLAY_COLUMN = 0x02;
157        const DISPLAY_SOURCE_RANGES = 0x04;
158        const DISPLAY_OPTION = 0x08;
159        const DISPLAY_CATEGORY_ID = 0x10;
160        const DISPLAY_CATEGORY_NAME = 0x20;
161        const DISPLAY_SEVERITY = 0x200;
162    }
163}
164abi_transferable!(DxcDiagnosticDisplayOptions);
165
166bitflags! {
167    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
168    pub struct DxcCursorKindFlags : u32 {
169        const NONE = 0;
170        const DECLARATION = 0x1;
171        const REFERENCE = 0x2;
172        const EXPRESSION = 0x4;
173        const STATEMENT = 0x8;
174        const ATTRIBUTE = 0x10;
175        const INVALID = 0x20;
176        const TRANSLATION_UNIT = 0x40;
177        const PREPROCESSING = 0x80;
178        const UNEXPOSED = 0x100;
179    }
180}
181
182bitflags! {
183    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
184    pub struct DxcCursorKind : u32 {
185        const UNEXPOSED_DECL = 1;
186        const STRUCT_DECL = 2;
187        const UNION_DECL = 3;
188        const CLASS_DECL = 4;
189        const ENUM_DECL = 5;
190        const FIELD_DECL = 6;
191        const ENUM_CONSTANT_DECL = 7;
192        const FUNCTION_DECL = 8;
193        const VAR_DECL = 9;
194        const PARM_DECL = 10;
195        const OBJ_C_INTERFACE_DECL = 11;
196        const OBJ_C_CATEGORY_DECL = 12;
197        const OBJ_C_PROTOCOL_DECL = 13;
198        const OBJ_C_PROPERTY_DECL = 14;
199        const OBJ_C_IVAR_DECL = 15;
200        const OBJ_C_INSTANCE_METHOD_DECL = 16;
201        const OBJ_C_CLASS_METHOD_DECL = 17;
202        const OBJ_C_IMPLEMENTATION_DECL = 18;
203        const OBJ_C_CATEGORY_IMPL_DECL = 19;
204        const TYPEDEF_DECL = 20;
205        const CXX_METHOD = 21;
206        const NAMESPACE = 22;
207        const LINKAGE_SPEC = 23;
208        const CONSTRUCTOR = 24;
209        const DESTRUCTOR = 25;
210        const CONVERSION_FUNCTION = 26;
211        const TEMPLATE_TYPE_PARAMETER = 27;
212        const NON_TYPE_TEMPLATE_PARAMETER = 28;
213        const TEMPLATE_TEMPLATE_PARAMETER = 29;
214        const FUNCTION_TEMPLATE = 30;
215        const CLASS_TEMPLATE = 31;
216        const CLASS_TEMPLATE_PARTIAL_SPECIALIZATION = 32;
217        const NAMESPACE_ALIAS = 33;
218        const USING_DIRECTIVE = 34;
219        const USING_DECLARATION = 35;
220        const TYPE_ALIAS_DECL = 36;
221        const OBJ_C_SYNTHESIZE_DECL = 37;
222        const OBJ_C_DYNAMIC_DECL = 38;
223        const CXX_ACCESS_SPECIFIER = 39;
224
225        const FIRST_DECL = DxcCursorKind::UNEXPOSED_DECL.bits();
226        const LAST_DECL = DxcCursorKind::CXX_ACCESS_SPECIFIER.bits();
227
228        const FIRST_REF = 40;
229        const OBJ_C_SUPER_CLASS_REF = 40;
230        const OBJ_C_PROTOCOL_REF = 41;
231        const OBJ_C_CLASS_REF = 42;
232        const TYPE_REF = 43;
233        const CXX_BASE_SPECIFIER = 44;
234        const TEMPLATE_REF = 45;
235        const NAMESPACE_REF = 46;
236        const MEMBER_REF = 47;
237        const LABEL_REF = 48;
238        const OVERLOADED_DECL_REF = 49;
239        const VARIABLE_REF = 50;
240        const LAST_REF = DxcCursorKind::VARIABLE_REF.bits();
241        const FIRST_INVALID = 70;
242        const INVALID_FILE = 70;
243        const NO_DECL_FOUND = 71;
244        const NOT_IMPLEMENTED = 72;
245        const INVALID_CODE = 73;
246        const LAST_INVALID = DxcCursorKind::INVALID_CODE.bits();
247        const FIRST_EXPR = 100;
248        const UNEXPOSED_EXPR = 100;
249        const DECL_REF_EXPR = 101;
250        const MEMBER_REF_EXPR = 102;
251        const CALL_EXPR = 103;
252        const OBJ_C_MESSAGE_EXPR = 104;
253        const BLOCK_EXPR = 105;
254        const INTEGER_LITERAL = 106;
255        const FLOATING_LITERAL = 107;
256        const IMAGINARY_LITERAL = 108;
257        const STRING_LITERAL = 109;
258        const CHARACTER_LITERAL = 110;
259        const PAREN_EXPR = 111;
260        const UNARY_OPERATOR = 112;
261        const ARRAY_SUBSCRIPT_EXPR = 113;
262        const BINARY_OPERATOR = 114;
263        const COMPOUND_ASSIGN_OPERATOR = 115;
264        const CONDITIONAL_OPERATOR = 116;
265        const C_STYLE_CAST_EXPR = 117;
266        const COMPOUND_LITERAL_EXPR = 118;
267        const INIT_LIST_EXPR = 119;
268        const ADDR_LABEL_EXPR = 120;
269        const STMT_EXPR = 121;
270        const GENERIC_SELECTION_EXPR = 122;
271        const GNU_NULL_EXPR = 123;
272        const CXX_STATIC_CAST_EXPR = 124;
273        const CXX_DYNAMIC_CAST_EXPR = 125;
274        const CXX_REINTERPRET_CAST_EXPR = 126;
275        const CXX_CONST_CAST_EXPR = 127;
276        const CXX_FUNCTIONAL_CAST_EXPR = 128;
277        const CXX_TYPEID_EXPR = 129;
278        const CXX_BOOL_LITERAL_EXPR = 130;
279        const CXX_NULL_PTR_LITERAL_EXPR = 131;
280        const CXX_THIS_EXPR = 132;
281        const CXX_THROW_EXPR = 133;
282        const CXX_NEW_EXPR = 134;
283        const CXX_DELETE_EXPR = 135;
284        const UNARY_EXPR = 136;
285        const OBJ_C_STRING_LITERAL = 137;
286        const OBJ_C_ENCODE_EXPR = 138;
287        const OBJ_C_SELECTOR_EXPR = 139;
288        const OBJ_C_PROTOCOL_EXPR = 140;
289        const OBJ_C_BRIDGED_CAST_EXPR = 141;
290        const PACK_EXPANSION_EXPR = 142;
291        const SIZE_OF_PACK_EXPR = 143;
292        const LAMBDA_EXPR = 144;
293        const OBJ_C_BOOL_LITERAL_EXPR = 145;
294        const OBJ_C_SELF_EXPR = 146;
295        const LAST_EXPR = DxcCursorKind::OBJ_C_SELF_EXPR.bits();
296        const FIRST_STMT = 200;
297        const UNEXPOSED_STMT = 200;
298        const LABEL_STMT = 201;
299        const COMPOUND_STMT = 202;
300        const CASE_STMT = 203;
301        const DEFAULT_STMT = 204;
302        const IF_STMT = 205;
303        const SWITCH_STMT = 206;
304        const WHILE_STMT = 207;
305        const DO_STMT = 208;
306        const FOR_STMT = 209;
307        const GOTO_STMT = 210;
308        const INDIRECT_GOTO_STMT = 211;
309        const CONTINUE_STMT = 212;
310        const BREAK_STMT = 213;
311        const RETURN_STMT = 214;
312        const GCC_ASM_STMT = 215;
313        const ASM_STMT = DxcCursorKind::GCC_ASM_STMT.bits();
314
315        const OBJ_C_AT_TRY_STMT = 216;
316        const OBJ_C_AT_CATCH_STMT = 217;
317        const OBJ_C_AT_FINALLY_STMT = 218;
318        const OBJ_C_AT_THROW_STMT = 219;
319        const OBJ_C_AT_SYNCHRONIZED_STMT = 220;
320        const OBJ_C_AUTORELEASE_POOL_STMT = 221;
321        const OBJ_C_FOR_COLLECTION_STMT = 222;
322        const CXX_CATCH_STMT = 223;
323        const CXX_TRY_STMT = 224;
324        const CXX_FOR_RANGE_STMT = 225;
325        const SEH_TRY_STMT = 226;
326        const SEH_EXCEPT_STMT = 227;
327        const SEH_FINALLY_STMT = 228;
328        const MS_ASM_STMT = 229;
329        const NULL_STMT = 230;
330        const DECL_STMT = 231;
331        const OMP_PARALLEL_DIRECTIVE = 232;
332        const OMP_SIMD_DIRECTIVE = 233;
333        const OMP_FOR_DIRECTIVE = 234;
334        const OMP_SECTIONS_DIRECTIVE = 235;
335        const OMP_SECTION_DIRECTIVE = 236;
336        const OMP_SINGLE_DIRECTIVE = 237;
337        const OMP_PARALLEL_FOR_DIRECTIVE = 238;
338        const OMP_PARALLEL_SECTIONS_DIRECTIVE = 239;
339        const OMP_TASK_DIRECTIVE = 240;
340        const OMP_MASTER_DIRECTIVE = 241;
341        const OMP_CRITICAL_DIRECTIVE = 242;
342        const OMP_TASKYIELD_DIRECTIVE = 243;
343        const OMP_BARRIER_DIRECTIVE = 244;
344        const OMP_TASKWAIT_DIRECTIVE = 245;
345        const OMP_FLUSH_DIRECTIVE = 246;
346        const SEH_LEAVE_STMT = 247;
347        const OMP_ORDERED_DIRECTIVE = 248;
348        const OMP_ATOMIC_DIRECTIVE = 249;
349        const OMP_FOR_SIMD_DIRECTIVE = 250;
350        const OMP_PARALLEL_FOR_SIMD_DIRECTIVE = 251;
351        const OMP_TARGET_DIRECTIVE = 252;
352        const OMP_TEAMS_DIRECTIVE = 253;
353        const OMP_TASKGROUP_DIRECTIVE = 254;
354        const OMP_CANCELLATION_POINT_DIRECTIVE = 255;
355        const OMP_CANCEL_DIRECTIVE = 256;
356        const LAST_STMT = DxcCursorKind::OMP_CANCEL_DIRECTIVE.bits();
357
358        const TRANSLATION_UNIT = 300;
359
360        const FIRST_ATTR = 400;
361        const UNEXPOSED_ATTR = 400;
362
363        const IB_ACTION_ATTR = 401;
364        const IB_OUTLET_ATTR = 402;
365        const IB_OUTLET_COLLECTION_ATTR = 403;
366        const CXX_FINAL_ATTR = 404;
367        const CXX_OVERRIDE_ATTR = 405;
368        const ANNOTATE_ATTR = 406;
369        const ASM_LABEL_ATTR = 407;
370        const PACKED_ATTR = 408;
371        const PURE_ATTR = 409;
372        const CONST_ATTR = 410;
373        const NO_DUPLICATE_ATTR = 411;
374        const CUDA_CONSTANT_ATTR = 412;
375        const CUDA_DEVICE_ATTR = 413;
376        const CUDA_GLOBAL_ATTR = 414;
377        const CUDA_HOST_ATTR = 415;
378        const CUDA_SHARED_ATTR = 416;
379        const LAST_ATTR = DxcCursorKind::CUDA_SHARED_ATTR.bits();
380
381        const PREPROCESSING_DIRECTIVE = 500;
382        const MACRO_DEFINITION = 501;
383        const MACRO_EXPANSION = 502;
384        const MACRO_INSTANTIATION = DxcCursorKind::MACRO_EXPANSION.bits();
385        const INCLUSION_DIRECTIVE = 503;
386        const FIRST_PREPROCESSING = DxcCursorKind::PREPROCESSING_DIRECTIVE.bits();
387        const LAST_PREPROCESSING = DxcCursorKind::INCLUSION_DIRECTIVE.bits();
388
389        const MODULE_IMPORT_DECL = 600;
390        const FIRST_EXTRA_DECL = DxcCursorKind::MODULE_IMPORT_DECL.bits();
391        const LAST_EXTRA_DECL = DxcCursorKind::MODULE_IMPORT_DECL.bits();
392    }
393}
394
395interfaces! {
396    #[uuid("4f76b234-3659-4d33-99b0-3b0db994b564")]
397    pub(crate) unsafe interface IDxcDiagnostic: IUnknown {
398        pub(crate) unsafe fn format_diagnostic(
399            &self,
400            options: DxcDiagnosticDisplayOptions,
401            result: *mut LPSTR,
402        ) -> HRESULT;
403        pub(crate) unsafe fn get_severity(&self, result: *mut DxcDiagnosticSeverity) -> HRESULT;
404        pub(crate) unsafe fn get_location(
405            &self,
406            result: *mut Option<IDxcSourceLocation>,
407        ) -> HRESULT;
408        pub(crate) unsafe fn get_spelling(&self, result: *mut LPSTR) -> HRESULT;
409        pub(crate) unsafe fn get_category_text(&self, result: *mut LPSTR) -> HRESULT;
410        pub(crate) unsafe fn get_num_ranges(&self, result: *mut u32) -> HRESULT;
411        pub(crate) unsafe fn get_range_at(
412            &self,
413            index: u32,
414            result: *mut Option<IDxcSourceRange>,
415        ) -> HRESULT;
416        pub(crate) unsafe fn get_num_fix_its(&self, result: *mut u32) -> HRESULT;
417        pub(crate) unsafe fn get_fix_it_at(
418            &self,
419            index: u32,
420            replacement_range: *mut Option<IDxcSourceRange>,
421            text: *mut LPSTR,
422        ) -> HRESULT;
423    }
424
425    #[uuid("0c364d65-df44-4412-888e-4e552fc5e3d6")]
426    pub(crate) unsafe interface IDxcInclusion: IUnknown {
427        pub(crate) unsafe fn get_included_file(&self, result: *mut Option<IDxcFile>) -> HRESULT;
428        pub(crate) unsafe fn get_stack_length(&self, result: *mut u32) -> HRESULT;
429        pub(crate) unsafe fn get_stack_item(
430            &self,
431            index: u32,
432            result: *mut Option<IDxcSourceLocation>,
433        ) -> HRESULT;
434    }
435
436    #[uuid("7f90b9ff-a275-4932-97d8-3cfd234482a2")]
437    pub(crate) unsafe interface IDxcToken: IUnknown {
438        pub(crate) unsafe fn get_kind(&self, value: *mut DxcTokenKind) -> HRESULT;
439        pub(crate) unsafe fn get_location(&self, value: *mut Option<IDxcSourceLocation>)
440            -> HRESULT;
441        pub(crate) unsafe fn get_extent(&self, value: *mut Option<IDxcSourceRange>) -> HRESULT;
442        pub(crate) unsafe fn get_spelling(&self, value: *mut LPSTR) -> HRESULT;
443    }
444
445    #[uuid("2ec912fd-b144-4a15-ad0d-1c5439c81e46")]
446    pub(crate) unsafe interface IDxcType: IUnknown {
447        pub(crate) unsafe fn get_spelling(&self, result: *mut LPSTR) -> HRESULT;
448        pub(crate) unsafe fn is_equal_to(&self, other: IDxcType, result: *mut bool) -> HRESULT;
449        pub(crate) unsafe fn get_kind(&self, result: *mut DxcCursorKind) -> HRESULT;
450    }
451
452    #[uuid("8e7ddf1c-d7d3-4d69-b286-85fccba1e0cf")]
453    pub(crate) unsafe interface IDxcSourceLocation: IUnknown {
454        pub(crate) unsafe fn is_equal_to(
455            &self,
456            other: IDxcSourceLocation,
457            result: *mut bool,
458        ) -> HRESULT;
459        pub(crate) unsafe fn get_spelling_location(
460            &self,
461            file: *mut Option<IDxcFile>,
462            line: *mut u32,
463            col: *mut u32,
464            offset: *mut u32,
465        ) -> HRESULT;
466        pub(crate) unsafe fn is_null(&self, result: *mut bool) -> HRESULT;
467    }
468
469    #[uuid("f1359b36-a53f-4e81-b514-b6b84122a13f")]
470    pub(crate) unsafe interface IDxcSourceRange: IUnknown {
471        pub(crate) unsafe fn is_null(&self, value: *mut bool) -> HRESULT;
472        pub(crate) unsafe fn get_start(&self, value: *mut Option<IDxcSourceLocation>) -> HRESULT;
473        pub(crate) unsafe fn get_end(&self, value: *mut Option<IDxcSourceLocation>) -> HRESULT;
474        pub(crate) unsafe fn get_offsets(
475            &self,
476            start_offset: *mut u32,
477            end_offset: *mut u32,
478        ) -> HRESULT;
479    }
480
481    #[uuid("1467b985-288d-4d2a-80c1-ef89c42c40bc")]
482    pub(crate) unsafe interface IDxcCursor: IUnknown {
483        pub(crate) unsafe fn get_extent(&self, range: *mut Option<IDxcSourceRange>) -> HRESULT;
484        pub(crate) unsafe fn get_location(
485            &self,
486            result: *mut Option<IDxcSourceLocation>,
487        ) -> HRESULT;
488        pub(crate) unsafe fn get_kind(&self, result: *mut DxcCursorKind) -> HRESULT;
489        pub(crate) unsafe fn get_kind_flags(&self, result: *mut DxcCursorKindFlags) -> HRESULT;
490        pub(crate) unsafe fn get_semantic_parent(&self, result: *mut Option<IDxcCursor>)
491            -> HRESULT;
492        pub(crate) unsafe fn get_lexical_parent(&self, result: *mut Option<IDxcCursor>) -> HRESULT;
493        pub(crate) unsafe fn get_cursor_type(&self, result: *mut Option<IDxcType>) -> HRESULT;
494        pub(crate) unsafe fn get_num_arguments(&self, result: *mut i32) -> HRESULT;
495        pub(crate) unsafe fn get_argument_at(
496            &self,
497            index: i32,
498            result: *mut Option<IDxcCursor>,
499        ) -> HRESULT;
500        pub(crate) unsafe fn get_referenced_cursor(
501            &self,
502            result: *mut Option<IDxcCursor>,
503        ) -> HRESULT;
504        pub(crate) unsafe fn get_definition_cursor(
505            &self,
506            result: *mut Option<IDxcCursor>,
507        ) -> HRESULT;
508        pub(crate) unsafe fn find_references_in_file(
509            &self,
510            file: IDxcFile,
511            skip: u32,
512            top: u32,
513            result_length: *mut u32,
514            result: *mut *mut IDxcCursor,
515        ) -> HRESULT;
516        pub(crate) unsafe fn get_spelling(&self, result: *mut LPSTR) -> HRESULT;
517        pub(crate) unsafe fn is_equal_to(&self, other: IDxcCursor, result: *mut bool) -> HRESULT;
518        pub(crate) unsafe fn is_null(&self, result: *mut bool) -> HRESULT;
519        pub(crate) unsafe fn is_definition(&self, result: *mut bool) -> HRESULT;
520        pub(crate) unsafe fn get_display_name(&self, result: *mut BSTR) -> HRESULT;
521        pub(crate) unsafe fn get_qualified_name(
522            &self,
523            include_template_args: bool,
524            result: *mut BSTR,
525        ) -> HRESULT;
526        pub(crate) unsafe fn get_formatted_name(
527            &self,
528            formatting: DxcCursorFormatting,
529            result: *mut BSTR,
530        ) -> HRESULT;
531        pub(crate) unsafe fn get_children(
532            &self,
533            skip: u32,
534            top: u32,
535            result_length: *mut u32,
536            result: *mut *mut IDxcCursor,
537        ) -> HRESULT;
538        pub(crate) unsafe fn get_snapped_child(
539            &self,
540            location: IDxcSourceLocation,
541            result: *mut Option<IDxcCursor>,
542        ) -> HRESULT;
543    }
544
545    #[uuid("8ec00f98-07d0-4e60-9d7c-5a50b5b0017f")]
546    pub(crate) unsafe interface IDxcUnsavedFile: IUnknown {
547        pub(crate) unsafe fn get_file_name(&self, file_name: *mut LPSTR) -> HRESULT;
548        pub(crate) unsafe fn get_contents(&self, contents: *mut LPSTR) -> HRESULT;
549        pub(crate) unsafe fn get_length(&self, length: *mut u32) -> HRESULT;
550    }
551
552    #[uuid("bb2fca9e-1478-47ba-b08c-2c502ada4895")]
553    pub(crate) unsafe interface IDxcFile: IUnknown {
554        pub(crate) unsafe fn get_name(&self, result: *mut LPSTR) -> HRESULT;
555        pub(crate) unsafe fn is_equal_to(&self, other: IDxcFile, result: *mut bool) -> HRESULT;
556    }
557
558    #[uuid("9677dee0-c0e5-46a1-8b40-3db3168be63d")]
559    pub(crate) unsafe interface IDxcTranslationUnit: IUnknown {
560        pub(crate) unsafe fn get_cursor(&self, cursor: *mut Option<IDxcCursor>) -> HRESULT;
561        pub(crate) unsafe fn tokenize(
562            &self,
563            range: IDxcSourceRange,
564            tokens: *mut *mut IDxcToken,
565            token_count: *mut u32,
566        ) -> HRESULT;
567        pub(crate) unsafe fn get_location(
568            &self,
569            file: IDxcFile,
570            line: u32,
571            column: u32,
572            result: *mut Option<IDxcSourceLocation>,
573        ) -> HRESULT;
574        pub(crate) unsafe fn get_num_diagnostics(&self, value: *mut u32) -> HRESULT;
575        pub(crate) unsafe fn get_diagnostic(
576            &self,
577            index: u32,
578            value: *mut Option<IDxcDiagnostic>,
579        ) -> HRESULT;
580        pub(crate) unsafe fn get_file(
581            &self,
582            name: *const u8,
583            result: *mut Option<IDxcFile>,
584        ) -> HRESULT;
585        pub(crate) unsafe fn get_file_name(&self, result: *mut LPSTR) -> HRESULT;
586        pub(crate) unsafe fn reparse(
587            &self,
588            unsaved_files: *mut Option<IDxcUnsavedFile>,
589            num_unsaved_files: u32,
590        ) -> HRESULT;
591        pub(crate) unsafe fn get_cursor_for_location(
592            &self,
593            location: IDxcSourceLocation,
594            result: *mut Option<IDxcCursor>,
595        ) -> HRESULT;
596        pub(crate) unsafe fn get_location_for_offset(
597            &self,
598            file: IDxcFile,
599            offset: u32,
600            result: *mut Option<IDxcSourceLocation>,
601        ) -> HRESULT;
602        pub(crate) unsafe fn get_skipped_ranges(
603            &self,
604            file: IDxcFile,
605            result_count: *mut u32,
606            result: *mut *mut IDxcSourceRange,
607        ) -> HRESULT;
608        pub(crate) unsafe fn get_diagnostic_details(
609            &self,
610            index: u32,
611            options: DxcDiagnosticDisplayOptions,
612            error_code: *mut u32,
613            error_line: *mut u32,
614            error_column: *mut u32,
615            error_file: *mut BSTR,
616            error_offset: *mut u32,
617            error_length: *mut u32,
618            error_message: *mut BSTR,
619        ) -> HRESULT;
620        pub(crate) unsafe fn get_inclusion_list(
621            &self,
622            result_count: *mut u32,
623            result: *mut *mut IDxcInclusion,
624        ) -> HRESULT;
625    }
626
627    #[uuid("937824a0-7f5a-4815-9b0a-7cc0424f4173")]
628    pub(crate) unsafe interface IDxcIndex: IUnknown {
629        pub(crate) unsafe fn set_global_options(&self, options: DxcGlobalOptions) -> HRESULT;
630        pub(crate) unsafe fn get_global_options(&self, options: *mut DxcGlobalOptions) -> HRESULT;
631        pub(crate) unsafe fn parse_translation_unit(
632            &self,
633            source_filename: *const u8,
634            command_line_args: *const *const u8,
635            num_command_line_args: i32,
636            // unsaved_files: *const *const dyn IDxcUnsavedFile,
637            unsaved_files: *const IDxcUnsavedFile,
638            num_unsaved_files: u32,
639            options: DxcTranslationUnitFlags,
640            translation_unit: *mut Option<IDxcTranslationUnit>,
641        ) -> HRESULT;
642    }
643
644    #[uuid("b1f99513-46d6-4112-8169-dd0d6053f17d")]
645    pub(crate) unsafe interface IDxcIntelliSense: IUnknown {
646        pub(crate) unsafe fn create_index(&self, index: *mut Option<IDxcIndex>) -> HRESULT;
647        pub(crate) unsafe fn get_null_location(
648            &self,
649            location: *mut Option<IDxcSourceLocation>,
650        ) -> HRESULT;
651        pub(crate) unsafe fn get_null_range(
652            &self,
653            location: *mut Option<IDxcSourceRange>,
654        ) -> HRESULT;
655        pub(crate) unsafe fn get_range(
656            &self,
657            start: IDxcSourceLocation,
658            end: IDxcSourceLocation,
659            location: *mut Option<IDxcSourceRange>,
660        ) -> HRESULT;
661        pub(crate) unsafe fn get_default_diagnostic_display_options(
662            &self,
663            value: *mut DxcDiagnosticDisplayOptions,
664        ) -> HRESULT;
665        pub(crate) unsafe fn get_default_editing_tu_options(
666            &self,
667            value: *mut DxcTranslationUnitFlags,
668        ) -> HRESULT;
669        pub(crate) unsafe fn create_unsaved_file(
670            &self,
671            file_name: LPCSTR,
672            contents: LPCSTR,
673            content_length: u32,
674            result: *mut Option<IDxcUnsavedFile>,
675        ) -> HRESULT;
676    }
677}
678
679pub const CLSID_DxcIntelliSense: IID = IID {
680    data1: 0x3047833c,
681    data2: 0xd1c0,
682    data3: 0x4b8e,
683    data4: [0x9d, 0x40, 0x10, 0x28, 0x78, 0x60, 0x59, 0x85],
684};