dxcisense.h 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // dxcisense.h //
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. // This file is distributed under the University of Illinois Open Source //
  6. // License. See LICENSE.TXT for details. //
  7. // //
  8. // Provides declarations for the DirectX Compiler IntelliSense component. //
  9. // //
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #ifndef __DXC_ISENSE__
  12. #define __DXC_ISENSE__
  13. #include "dxc/dxcapi.h"
  14. #include "dxc/Support/WinAdapter.h"
  15. typedef enum DxcGlobalOptions
  16. {
  17. DxcGlobalOpt_None = 0x0,
  18. DxcGlobalOpt_ThreadBackgroundPriorityForIndexing = 0x1,
  19. DxcGlobalOpt_ThreadBackgroundPriorityForEditing = 0x2,
  20. DxcGlobalOpt_ThreadBackgroundPriorityForAll =
  21. DxcGlobalOpt_ThreadBackgroundPriorityForIndexing | DxcGlobalOpt_ThreadBackgroundPriorityForEditing
  22. } DxcGlobalOptions;
  23. typedef enum DxcTokenKind
  24. {
  25. DxcTokenKind_Punctuation = 0, // A token that contains some kind of punctuation.
  26. DxcTokenKind_Keyword = 1, // A language keyword.
  27. DxcTokenKind_Identifier = 2, // An identifier (that is not a keyword).
  28. DxcTokenKind_Literal = 3, // A numeric, string, or character literal.
  29. DxcTokenKind_Comment = 4, // A comment.
  30. DxcTokenKind_Unknown = 5, // An unknown token (possibly known to a future version).
  31. DxcTokenKind_BuiltInType = 6, // A built-in type like int, void or float3.
  32. } DxcTokenKind;
  33. typedef enum DxcTypeKind
  34. {
  35. DxcTypeKind_Invalid = 0, // Reprents an invalid type (e.g., where no type is available).
  36. DxcTypeKind_Unexposed = 1, // A type whose specific kind is not exposed via this interface.
  37. // Builtin types
  38. DxcTypeKind_Void = 2,
  39. DxcTypeKind_Bool = 3,
  40. DxcTypeKind_Char_U = 4,
  41. DxcTypeKind_UChar = 5,
  42. DxcTypeKind_Char16 = 6,
  43. DxcTypeKind_Char32 = 7,
  44. DxcTypeKind_UShort = 8,
  45. DxcTypeKind_UInt = 9,
  46. DxcTypeKind_ULong = 10,
  47. DxcTypeKind_ULongLong = 11,
  48. DxcTypeKind_UInt128 = 12,
  49. DxcTypeKind_Char_S = 13,
  50. DxcTypeKind_SChar = 14,
  51. DxcTypeKind_WChar = 15,
  52. DxcTypeKind_Short = 16,
  53. DxcTypeKind_Int = 17,
  54. DxcTypeKind_Long = 18,
  55. DxcTypeKind_LongLong = 19,
  56. DxcTypeKind_Int128 = 20,
  57. DxcTypeKind_Float = 21,
  58. DxcTypeKind_Double = 22,
  59. DxcTypeKind_LongDouble = 23,
  60. DxcTypeKind_NullPtr = 24,
  61. DxcTypeKind_Overload = 25,
  62. DxcTypeKind_Dependent = 26,
  63. DxcTypeKind_ObjCId = 27,
  64. DxcTypeKind_ObjCClass = 28,
  65. DxcTypeKind_ObjCSel = 29,
  66. DxcTypeKind_FirstBuiltin = DxcTypeKind_Void,
  67. DxcTypeKind_LastBuiltin = DxcTypeKind_ObjCSel,
  68. DxcTypeKind_Complex = 100,
  69. DxcTypeKind_Pointer = 101,
  70. DxcTypeKind_BlockPointer = 102,
  71. DxcTypeKind_LValueReference = 103,
  72. DxcTypeKind_RValueReference = 104,
  73. DxcTypeKind_Record = 105,
  74. DxcTypeKind_Enum = 106,
  75. DxcTypeKind_Typedef = 107,
  76. DxcTypeKind_ObjCInterface = 108,
  77. DxcTypeKind_ObjCObjectPointer = 109,
  78. DxcTypeKind_FunctionNoProto = 110,
  79. DxcTypeKind_FunctionProto = 111,
  80. DxcTypeKind_ConstantArray = 112,
  81. DxcTypeKind_Vector = 113,
  82. DxcTypeKind_IncompleteArray = 114,
  83. DxcTypeKind_VariableArray = 115,
  84. DxcTypeKind_DependentSizedArray = 116,
  85. DxcTypeKind_MemberPointer = 117
  86. } DxcTypeKind;
  87. // Describes the severity of a particular diagnostic.
  88. typedef enum DxcDiagnosticSeverity
  89. {
  90. // A diagnostic that has been suppressed, e.g., by a command-line option.
  91. DxcDiagnostic_Ignored = 0,
  92. // This diagnostic is a note that should be attached to the previous (non-note) diagnostic.
  93. DxcDiagnostic_Note = 1,
  94. // This diagnostic indicates suspicious code that may not be wrong.
  95. DxcDiagnostic_Warning = 2,
  96. // This diagnostic indicates that the code is ill-formed.
  97. DxcDiagnostic_Error = 3,
  98. // This diagnostic indicates that the code is ill-formed such that future
  99. // parser rec unlikely to produce useful results.
  100. DxcDiagnostic_Fatal = 4
  101. } DxcDiagnosticSeverity;
  102. // Options to control the display of diagnostics.
  103. typedef enum DxcDiagnosticDisplayOptions
  104. {
  105. // Display the source-location information where the diagnostic was located.
  106. DxcDiagnostic_DisplaySourceLocation = 0x01,
  107. // If displaying the source-location information of the diagnostic,
  108. // also include the column number.
  109. DxcDiagnostic_DisplayColumn = 0x02,
  110. // If displaying the source-location information of the diagnostic,
  111. // also include information about source ranges in a machine-parsable format.
  112. DxcDiagnostic_DisplaySourceRanges = 0x04,
  113. // Display the option name associated with this diagnostic, if any.
  114. DxcDiagnostic_DisplayOption = 0x08,
  115. // Display the category number associated with this diagnostic, if any.
  116. DxcDiagnostic_DisplayCategoryId = 0x10,
  117. // Display the category name associated with this diagnostic, if any.
  118. DxcDiagnostic_DisplayCategoryName = 0x20,
  119. // Display the severity of the diagnostic message.
  120. DxcDiagnostic_DisplaySeverity = 0x200
  121. } DxcDiagnosticDisplayOptions;
  122. typedef enum DxcTranslationUnitFlags
  123. {
  124. // Used to indicate that no special translation-unit options are needed.
  125. DxcTranslationUnitFlags_None = 0x0,
  126. // Used to indicate that the parser should construct a "detailed"
  127. // preprocessing record, including all macro definitions and instantiations.
  128. DxcTranslationUnitFlags_DetailedPreprocessingRecord = 0x01,
  129. // Used to indicate that the translation unit is incomplete.
  130. DxcTranslationUnitFlags_Incomplete = 0x02,
  131. // Used to indicate that the translation unit should be built with an
  132. // implicit precompiled header for the preamble.
  133. DxcTranslationUnitFlags_PrecompiledPreamble = 0x04,
  134. // Used to indicate that the translation unit should cache some
  135. // code-completion results with each reparse of the source file.
  136. DxcTranslationUnitFlags_CacheCompletionResults = 0x08,
  137. // Used to indicate that the translation unit will be serialized with
  138. // SaveTranslationUnit.
  139. DxcTranslationUnitFlags_ForSerialization = 0x10,
  140. // DEPRECATED
  141. DxcTranslationUnitFlags_CXXChainedPCH = 0x20,
  142. // Used to indicate that function/method bodies should be skipped while parsing.
  143. DxcTranslationUnitFlags_SkipFunctionBodies = 0x40,
  144. // Used to indicate that brief documentation comments should be
  145. // included into the set of code completions returned from this translation
  146. // unit.
  147. DxcTranslationUnitFlags_IncludeBriefCommentsInCodeCompletion = 0x80,
  148. // Used to indicate that compilation should occur on the caller's thread.
  149. DxcTranslationUnitFlags_UseCallerThread = 0x800
  150. } DxcTranslationUnitFlags;
  151. typedef enum DxcCursorFormatting
  152. {
  153. DxcCursorFormatting_Default = 0x0, // Default rules, language-insensitive formatting.
  154. DxcCursorFormatting_UseLanguageOptions = 0x1, // Language-sensitive formatting.
  155. DxcCursorFormatting_SuppressSpecifiers = 0x2, // Supresses type specifiers.
  156. DxcCursorFormatting_SuppressTagKeyword = 0x4, // Suppressed tag keyword (eg, 'class').
  157. DxcCursorFormatting_IncludeNamespaceKeyword = 0x8, // Include namespace keyword.
  158. } DxcCursorFormatting;
  159. enum DxcCursorKind {
  160. /* Declarations */
  161. DxcCursor_UnexposedDecl = 1, // A declaration whose specific kind is not exposed via this interface.
  162. DxcCursor_StructDecl = 2, // A C or C++ struct.
  163. DxcCursor_UnionDecl = 3, // A C or C++ union.
  164. DxcCursor_ClassDecl = 4, // A C++ class.
  165. DxcCursor_EnumDecl = 5, // An enumeration.
  166. DxcCursor_FieldDecl = 6, // A field (in C) or non-static data member (in C++) in a struct, union, or C++ class.
  167. DxcCursor_EnumConstantDecl = 7, // An enumerator constant.
  168. DxcCursor_FunctionDecl = 8, // A function.
  169. DxcCursor_VarDecl = 9, // A variable.
  170. DxcCursor_ParmDecl = 10, // A function or method parameter.
  171. DxcCursor_ObjCInterfaceDecl = 11, // An Objective-C interface.
  172. DxcCursor_ObjCCategoryDecl = 12, // An Objective-C interface for a category.
  173. DxcCursor_ObjCProtocolDecl = 13, // An Objective-C protocol declaration.
  174. DxcCursor_ObjCPropertyDecl = 14, // An Objective-C property declaration.
  175. DxcCursor_ObjCIvarDecl = 15, // An Objective-C instance variable.
  176. DxcCursor_ObjCInstanceMethodDecl = 16, // An Objective-C instance method.
  177. DxcCursor_ObjCClassMethodDecl = 17, // An Objective-C class method.
  178. DxcCursor_ObjCImplementationDecl = 18, // An Objective-C \@implementation.
  179. DxcCursor_ObjCCategoryImplDecl = 19, // An Objective-C \@implementation for a category.
  180. DxcCursor_TypedefDecl = 20, // A typedef
  181. DxcCursor_CXXMethod = 21, // A C++ class method.
  182. DxcCursor_Namespace = 22, // A C++ namespace.
  183. DxcCursor_LinkageSpec = 23, // A linkage specification, e.g. 'extern "C"'.
  184. DxcCursor_Constructor = 24, // A C++ constructor.
  185. DxcCursor_Destructor = 25, // A C++ destructor.
  186. DxcCursor_ConversionFunction = 26, // A C++ conversion function.
  187. DxcCursor_TemplateTypeParameter = 27, // A C++ template type parameter.
  188. DxcCursor_NonTypeTemplateParameter = 28, // A C++ non-type template parameter.
  189. DxcCursor_TemplateTemplateParameter = 29, // A C++ template template parameter.
  190. DxcCursor_FunctionTemplate = 30, // A C++ function template.
  191. DxcCursor_ClassTemplate = 31, // A C++ class template.
  192. DxcCursor_ClassTemplatePartialSpecialization = 32, // A C++ class template partial specialization.
  193. DxcCursor_NamespaceAlias = 33, // A C++ namespace alias declaration.
  194. DxcCursor_UsingDirective = 34, // A C++ using directive.
  195. DxcCursor_UsingDeclaration = 35, // A C++ using declaration.
  196. DxcCursor_TypeAliasDecl = 36, // A C++ alias declaration
  197. DxcCursor_ObjCSynthesizeDecl = 37, // An Objective-C \@synthesize definition.
  198. DxcCursor_ObjCDynamicDecl = 38, // An Objective-C \@dynamic definition.
  199. DxcCursor_CXXAccessSpecifier = 39, // An access specifier.
  200. DxcCursor_FirstDecl = DxcCursor_UnexposedDecl,
  201. DxcCursor_LastDecl = DxcCursor_CXXAccessSpecifier,
  202. /* References */
  203. DxcCursor_FirstRef = 40, /* Decl references */
  204. DxcCursor_ObjCSuperClassRef = 40,
  205. DxcCursor_ObjCProtocolRef = 41,
  206. DxcCursor_ObjCClassRef = 42,
  207. /**
  208. * \brief A reference to a type declaration.
  209. *
  210. * A type reference occurs anywhere where a type is named but not
  211. * declared. For example, given:
  212. *
  213. * \code
  214. * typedef unsigned size_type;
  215. * size_type size;
  216. * \endcode
  217. *
  218. * The typedef is a declaration of size_type (DxcCursor_TypedefDecl),
  219. * while the type of the variable "size" is referenced. The cursor
  220. * referenced by the type of size is the typedef for size_type.
  221. */
  222. DxcCursor_TypeRef = 43, // A reference to a type declaration.
  223. DxcCursor_CXXBaseSpecifier = 44,
  224. DxcCursor_TemplateRef = 45, // A reference to a class template, function template, template template parameter, or class template partial specialization.
  225. DxcCursor_NamespaceRef = 46, // A reference to a namespace or namespace alias.
  226. DxcCursor_MemberRef = 47, // A reference to a member of a struct, union, or class that occurs in some non-expression context, e.g., a designated initializer.
  227. /**
  228. * \brief A reference to a labeled statement.
  229. *
  230. * This cursor kind is used to describe the jump to "start_over" in the
  231. * goto statement in the following example:
  232. *
  233. * \code
  234. * start_over:
  235. * ++counter;
  236. *
  237. * goto start_over;
  238. * \endcode
  239. *
  240. * A label reference cursor refers to a label statement.
  241. */
  242. DxcCursor_LabelRef = 48, // A reference to a labeled statement.
  243. // A reference to a set of overloaded functions or function templates
  244. // that has not yet been resolved to a specific function or function template.
  245. //
  246. // An overloaded declaration reference cursor occurs in C++ templates where
  247. // a dependent name refers to a function.
  248. DxcCursor_OverloadedDeclRef = 49,
  249. DxcCursor_VariableRef = 50, // A reference to a variable that occurs in some non-expression context, e.g., a C++ lambda capture list.
  250. DxcCursor_LastRef = DxcCursor_VariableRef,
  251. /* Error conditions */
  252. DxcCursor_FirstInvalid = 70,
  253. DxcCursor_InvalidFile = 70,
  254. DxcCursor_NoDeclFound = 71,
  255. DxcCursor_NotImplemented = 72,
  256. DxcCursor_InvalidCode = 73,
  257. DxcCursor_LastInvalid = DxcCursor_InvalidCode,
  258. /* Expressions */
  259. DxcCursor_FirstExpr = 100,
  260. /**
  261. * \brief An expression whose specific kind is not exposed via this
  262. * interface.
  263. *
  264. * Unexposed expressions have the same operations as any other kind
  265. * of expression; one can extract their location information,
  266. * spelling, children, etc. However, the specific kind of the
  267. * expression is not reported.
  268. */
  269. DxcCursor_UnexposedExpr = 100, // An expression whose specific kind is not exposed via this interface.
  270. DxcCursor_DeclRefExpr = 101, // An expression that refers to some value declaration, such as a function, varible, or enumerator.
  271. DxcCursor_MemberRefExpr = 102, // An expression that refers to a member of a struct, union, class, Objective-C class, etc.
  272. DxcCursor_CallExpr = 103, // An expression that calls a function.
  273. DxcCursor_ObjCMessageExpr = 104, // An expression that sends a message to an Objective-C object or class.
  274. DxcCursor_BlockExpr = 105, // An expression that represents a block literal.
  275. DxcCursor_IntegerLiteral = 106, // An integer literal.
  276. DxcCursor_FloatingLiteral = 107, // A floating point number literal.
  277. DxcCursor_ImaginaryLiteral = 108, // An imaginary number literal.
  278. DxcCursor_StringLiteral = 109, // A string literal.
  279. DxcCursor_CharacterLiteral = 110, // A character literal.
  280. DxcCursor_ParenExpr = 111, // A parenthesized expression, e.g. "(1)". This AST node is only formed if full location information is requested.
  281. DxcCursor_UnaryOperator = 112, // This represents the unary-expression's (except sizeof and alignof).
  282. DxcCursor_ArraySubscriptExpr = 113, // [C99 6.5.2.1] Array Subscripting.
  283. DxcCursor_BinaryOperator = 114, // A builtin binary operation expression such as "x + y" or "x <= y".
  284. DxcCursor_CompoundAssignOperator = 115, // Compound assignment such as "+=".
  285. DxcCursor_ConditionalOperator = 116, // The ?: ternary operator.
  286. DxcCursor_CStyleCastExpr = 117, // An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr, eg: (int)f.
  287. DxcCursor_CompoundLiteralExpr = 118, // [C99 6.5.2.5]
  288. DxcCursor_InitListExpr = 119, // Describes an C or C++ initializer list.
  289. DxcCursor_AddrLabelExpr = 120, // The GNU address of label extension, representing &&label.
  290. DxcCursor_StmtExpr = 121, // This is the GNU Statement Expression extension: ({int X=4; X;})
  291. DxcCursor_GenericSelectionExpr = 122, // Represents a C11 generic selection.
  292. /** \brief Implements the GNU __null extension, which is a name for a null
  293. * pointer constant that has integral type (e.g., int or long) and is the same
  294. * size and alignment as a pointer.
  295. *
  296. * The __null extension is typically only used by system headers, which define
  297. * NULL as __null in C++ rather than using 0 (which is an integer that may not
  298. * match the size of a pointer).
  299. */
  300. DxcCursor_GNUNullExpr = 123,
  301. DxcCursor_CXXStaticCastExpr = 124, // C++'s static_cast<> expression.
  302. DxcCursor_CXXDynamicCastExpr = 125, // C++'s dynamic_cast<> expression.
  303. DxcCursor_CXXReinterpretCastExpr = 126, // C++'s reinterpret_cast<> expression.
  304. DxcCursor_CXXConstCastExpr = 127, // C++'s const_cast<> expression.
  305. /** \brief Represents an explicit C++ type conversion that uses "functional"
  306. * notion (C++ [expr.type.conv]).
  307. *
  308. * Example:
  309. * \code
  310. * x = int(0.5);
  311. * \endcode
  312. */
  313. DxcCursor_CXXFunctionalCastExpr = 128,
  314. DxcCursor_CXXTypeidExpr = 129, // A C++ typeid expression (C++ [expr.typeid]).
  315. DxcCursor_CXXBoolLiteralExpr = 130, // [C++ 2.13.5] C++ Boolean Literal.
  316. DxcCursor_CXXNullPtrLiteralExpr = 131, // [C++0x 2.14.7] C++ Pointer Literal.
  317. DxcCursor_CXXThisExpr = 132, // Represents the "this" expression in C++
  318. DxcCursor_CXXThrowExpr = 133, // [C++ 15] C++ Throw Expression, both 'throw' and 'throw' assignment-expression.
  319. DxcCursor_CXXNewExpr = 134, // A new expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
  320. DxcCursor_CXXDeleteExpr = 135, // A delete expression for memory deallocation and destructor calls, e.g. "delete[] pArray".
  321. DxcCursor_UnaryExpr = 136, // A unary expression.
  322. DxcCursor_ObjCStringLiteral = 137, // An Objective-C string literal i.e. @"foo".
  323. DxcCursor_ObjCEncodeExpr = 138, // An Objective-C \@encode expression.
  324. DxcCursor_ObjCSelectorExpr = 139, // An Objective-C \@selector expression.
  325. DxcCursor_ObjCProtocolExpr = 140, // An Objective-C \@protocol expression.
  326. /** \brief An Objective-C "bridged" cast expression, which casts between
  327. * Objective-C pointers and C pointers, transferring ownership in the process.
  328. *
  329. * \code
  330. * NSString *str = (__bridge_transfer NSString *)CFCreateString();
  331. * \endcode
  332. */
  333. DxcCursor_ObjCBridgedCastExpr = 141,
  334. /** \brief Represents a C++0x pack expansion that produces a sequence of
  335. * expressions.
  336. *
  337. * A pack expansion expression contains a pattern (which itself is an
  338. * expression) followed by an ellipsis. For example:
  339. *
  340. * \code
  341. * template<typename F, typename ...Types>
  342. * void forward(F f, Types &&...args) {
  343. * f(static_cast<Types&&>(args)...);
  344. * }
  345. * \endcode
  346. */
  347. DxcCursor_PackExpansionExpr = 142,
  348. /** \brief Represents an expression that computes the length of a parameter
  349. * pack.
  350. *
  351. * \code
  352. * template<typename ...Types>
  353. * struct count {
  354. * static const unsigned value = sizeof...(Types);
  355. * };
  356. * \endcode
  357. */
  358. DxcCursor_SizeOfPackExpr = 143,
  359. /* \brief Represents a C++ lambda expression that produces a local function
  360. * object.
  361. *
  362. * \code
  363. * void abssort(float *x, unsigned N) {
  364. * std::sort(x, x + N,
  365. * [](float a, float b) {
  366. * return std::abs(a) < std::abs(b);
  367. * });
  368. * }
  369. * \endcode
  370. */
  371. DxcCursor_LambdaExpr = 144,
  372. DxcCursor_ObjCBoolLiteralExpr = 145, // Objective-c Boolean Literal.
  373. DxcCursor_ObjCSelfExpr = 146, // Represents the "self" expression in a ObjC method.
  374. DxcCursor_LastExpr = DxcCursor_ObjCSelfExpr,
  375. /* Statements */
  376. DxcCursor_FirstStmt = 200,
  377. /**
  378. * \brief A statement whose specific kind is not exposed via this
  379. * interface.
  380. *
  381. * Unexposed statements have the same operations as any other kind of
  382. * statement; one can extract their location information, spelling,
  383. * children, etc. However, the specific kind of the statement is not
  384. * reported.
  385. */
  386. DxcCursor_UnexposedStmt = 200,
  387. /** \brief A labelled statement in a function.
  388. *
  389. * This cursor kind is used to describe the "start_over:" label statement in
  390. * the following example:
  391. *
  392. * \code
  393. * start_over:
  394. * ++counter;
  395. * \endcode
  396. *
  397. */
  398. DxcCursor_LabelStmt = 201,
  399. DxcCursor_CompoundStmt = 202, // A group of statements like { stmt stmt }. This cursor kind is used to describe compound statements, e.g. function bodies.
  400. DxcCursor_CaseStmt = 203, // A case statement.
  401. DxcCursor_DefaultStmt = 204, // A default statement.
  402. DxcCursor_IfStmt = 205, // An if statement
  403. DxcCursor_SwitchStmt = 206, // A switch statement.
  404. DxcCursor_WhileStmt = 207, // A while statement.
  405. DxcCursor_DoStmt = 208, // A do statement.
  406. DxcCursor_ForStmt = 209, // A for statement.
  407. DxcCursor_GotoStmt = 210, // A goto statement.
  408. DxcCursor_IndirectGotoStmt = 211, // An indirect goto statement.
  409. DxcCursor_ContinueStmt = 212, // A continue statement.
  410. DxcCursor_BreakStmt = 213, // A break statement.
  411. DxcCursor_ReturnStmt = 214, // A return statement.
  412. DxcCursor_GCCAsmStmt = 215, // A GCC inline assembly statement extension.
  413. DxcCursor_AsmStmt = DxcCursor_GCCAsmStmt,
  414. DxcCursor_ObjCAtTryStmt = 216, // Objective-C's overall \@try-\@catch-\@finally statement.
  415. DxcCursor_ObjCAtCatchStmt = 217, // Objective-C's \@catch statement.
  416. DxcCursor_ObjCAtFinallyStmt = 218, // Objective-C's \@finally statement.
  417. DxcCursor_ObjCAtThrowStmt = 219, // Objective-C's \@throw statement.
  418. DxcCursor_ObjCAtSynchronizedStmt = 220, // Objective-C's \@synchronized statement.
  419. DxcCursor_ObjCAutoreleasePoolStmt = 221, // Objective-C's autorelease pool statement.
  420. DxcCursor_ObjCForCollectionStmt = 222, // Objective-C's collection statement.
  421. DxcCursor_CXXCatchStmt = 223, // C++'s catch statement.
  422. DxcCursor_CXXTryStmt = 224, // C++'s try statement.
  423. DxcCursor_CXXForRangeStmt = 225, // C++'s for (* : *) statement.
  424. DxcCursor_SEHTryStmt = 226, // Windows Structured Exception Handling's try statement.
  425. DxcCursor_SEHExceptStmt = 227, // Windows Structured Exception Handling's except statement.
  426. DxcCursor_SEHFinallyStmt = 228, // Windows Structured Exception Handling's finally statement.
  427. DxcCursor_MSAsmStmt = 229, // A MS inline assembly statement extension.
  428. DxcCursor_NullStmt = 230, // The null satement ";": C99 6.8.3p3.
  429. DxcCursor_DeclStmt = 231, // Adaptor class for mixing declarations with statements and expressions.
  430. DxcCursor_OMPParallelDirective = 232, // OpenMP parallel directive.
  431. DxcCursor_OMPSimdDirective = 233, // OpenMP SIMD directive.
  432. DxcCursor_OMPForDirective = 234, // OpenMP for directive.
  433. DxcCursor_OMPSectionsDirective = 235, // OpenMP sections directive.
  434. DxcCursor_OMPSectionDirective = 236, // OpenMP section directive.
  435. DxcCursor_OMPSingleDirective = 237, // OpenMP single directive.
  436. DxcCursor_OMPParallelForDirective = 238, // OpenMP parallel for directive.
  437. DxcCursor_OMPParallelSectionsDirective = 239, // OpenMP parallel sections directive.
  438. DxcCursor_OMPTaskDirective = 240, // OpenMP task directive.
  439. DxcCursor_OMPMasterDirective = 241, // OpenMP master directive.
  440. DxcCursor_OMPCriticalDirective = 242, // OpenMP critical directive.
  441. DxcCursor_OMPTaskyieldDirective = 243, // OpenMP taskyield directive.
  442. DxcCursor_OMPBarrierDirective = 244, // OpenMP barrier directive.
  443. DxcCursor_OMPTaskwaitDirective = 245, // OpenMP taskwait directive.
  444. DxcCursor_OMPFlushDirective = 246, // OpenMP flush directive.
  445. DxcCursor_SEHLeaveStmt = 247, // Windows Structured Exception Handling's leave statement.
  446. DxcCursor_OMPOrderedDirective = 248, // OpenMP ordered directive.
  447. DxcCursor_OMPAtomicDirective = 249, // OpenMP atomic directive.
  448. DxcCursor_OMPForSimdDirective = 250, // OpenMP for SIMD directive.
  449. DxcCursor_OMPParallelForSimdDirective = 251, // OpenMP parallel for SIMD directive.
  450. DxcCursor_OMPTargetDirective = 252, // OpenMP target directive.
  451. DxcCursor_OMPTeamsDirective = 253, // OpenMP teams directive.
  452. DxcCursor_OMPTaskgroupDirective = 254, // OpenMP taskgroup directive.
  453. DxcCursor_OMPCancellationPointDirective = 255, // OpenMP cancellation point directive.
  454. DxcCursor_OMPCancelDirective = 256, // OpenMP cancel directive.
  455. DxcCursor_LastStmt = DxcCursor_OMPCancelDirective,
  456. DxcCursor_TranslationUnit = 300, // Cursor that represents the translation unit itself.
  457. /* Attributes */
  458. DxcCursor_FirstAttr = 400,
  459. /**
  460. * \brief An attribute whose specific kind is not exposed via this
  461. * interface.
  462. */
  463. DxcCursor_UnexposedAttr = 400,
  464. DxcCursor_IBActionAttr = 401,
  465. DxcCursor_IBOutletAttr = 402,
  466. DxcCursor_IBOutletCollectionAttr = 403,
  467. DxcCursor_CXXFinalAttr = 404,
  468. DxcCursor_CXXOverrideAttr = 405,
  469. DxcCursor_AnnotateAttr = 406,
  470. DxcCursor_AsmLabelAttr = 407,
  471. DxcCursor_PackedAttr = 408,
  472. DxcCursor_PureAttr = 409,
  473. DxcCursor_ConstAttr = 410,
  474. DxcCursor_NoDuplicateAttr = 411,
  475. DxcCursor_CUDAConstantAttr = 412,
  476. DxcCursor_CUDADeviceAttr = 413,
  477. DxcCursor_CUDAGlobalAttr = 414,
  478. DxcCursor_CUDAHostAttr = 415,
  479. DxcCursor_CUDASharedAttr = 416,
  480. DxcCursor_LastAttr = DxcCursor_CUDASharedAttr,
  481. /* Preprocessing */
  482. DxcCursor_PreprocessingDirective = 500,
  483. DxcCursor_MacroDefinition = 501,
  484. DxcCursor_MacroExpansion = 502,
  485. DxcCursor_MacroInstantiation = DxcCursor_MacroExpansion,
  486. DxcCursor_InclusionDirective = 503,
  487. DxcCursor_FirstPreprocessing = DxcCursor_PreprocessingDirective,
  488. DxcCursor_LastPreprocessing = DxcCursor_InclusionDirective,
  489. /* Extra Declarations */
  490. /**
  491. * \brief A module import declaration.
  492. */
  493. DxcCursor_ModuleImportDecl = 600,
  494. DxcCursor_FirstExtraDecl = DxcCursor_ModuleImportDecl,
  495. DxcCursor_LastExtraDecl = DxcCursor_ModuleImportDecl
  496. };
  497. enum DxcCursorKindFlags
  498. {
  499. DxcCursorKind_None = 0,
  500. DxcCursorKind_Declaration = 0x1,
  501. DxcCursorKind_Reference = 0x2,
  502. DxcCursorKind_Expression = 0x4,
  503. DxcCursorKind_Statement = 0x8,
  504. DxcCursorKind_Attribute = 0x10,
  505. DxcCursorKind_Invalid = 0x20,
  506. DxcCursorKind_TranslationUnit = 0x40,
  507. DxcCursorKind_Preprocessing = 0x80,
  508. DxcCursorKind_Unexposed = 0x100,
  509. };
  510. enum DxcCodeCompleteFlags
  511. {
  512. DxcCodeCompleteFlags_None = 0,
  513. DxcCodeCompleteFlags_IncludeMacros = 0x1,
  514. DxcCodeCompleteFlags_IncludeCodePatterns = 0x2,
  515. DxcCodeCompleteFlags_IncludeBriefComments = 0x4,
  516. };
  517. enum DxcCompletionChunkKind
  518. {
  519. DxcCompletionChunk_Optional = 0,
  520. DxcCompletionChunk_TypedText = 1,
  521. DxcCompletionChunk_Text = 2,
  522. DxcCompletionChunk_Placeholder = 3,
  523. DxcCompletionChunk_Informative = 4,
  524. DxcCompletionChunk_CurrentParameter = 5,
  525. DxcCompletionChunk_LeftParen = 6,
  526. DxcCompletionChunk_RightParen = 7,
  527. DxcCompletionChunk_LeftBracket = 8,
  528. DxcCompletionChunk_RightBracket = 9,
  529. DxcCompletionChunk_LeftBrace = 10,
  530. DxcCompletionChunk_RightBrace = 11,
  531. DxcCompletionChunk_LeftAngle = 12,
  532. DxcCompletionChunk_RightAngle = 13,
  533. DxcCompletionChunk_Comma = 14,
  534. DxcCompletionChunk_ResultType = 15,
  535. DxcCompletionChunk_Colon = 16,
  536. DxcCompletionChunk_SemiColon = 17,
  537. DxcCompletionChunk_Equal = 18,
  538. DxcCompletionChunk_HorizontalSpace = 19,
  539. DxcCompletionChunk_VerticalSpace = 20,
  540. };
  541. struct IDxcCursor;
  542. struct IDxcDiagnostic;
  543. struct IDxcFile;
  544. struct IDxcInclusion;
  545. struct IDxcIntelliSense;
  546. struct IDxcIndex;
  547. struct IDxcSourceLocation;
  548. struct IDxcSourceRange;
  549. struct IDxcToken;
  550. struct IDxcTranslationUnit;
  551. struct IDxcType;
  552. struct IDxcUnsavedFile;
  553. struct IDxcCodeCompleteResults;
  554. struct IDxcCompletionResult;
  555. struct IDxcCompletionString;
  556. CROSS_PLATFORM_UUIDOF(IDxcCursor, "1467b985-288d-4d2a-80c1-ef89c42c40bc")
  557. struct IDxcCursor : public IUnknown
  558. {
  559. virtual HRESULT STDMETHODCALLTYPE GetExtent(_Outptr_result_nullonfailure_ IDxcSourceRange** pRange) = 0;
  560. virtual HRESULT STDMETHODCALLTYPE GetLocation(_Outptr_result_nullonfailure_ IDxcSourceLocation** pResult) = 0;
  561. virtual HRESULT STDMETHODCALLTYPE GetKind(_Out_ DxcCursorKind* pResult) = 0;
  562. virtual HRESULT STDMETHODCALLTYPE GetKindFlags(_Out_ DxcCursorKindFlags* pResult) = 0;
  563. virtual HRESULT STDMETHODCALLTYPE GetSemanticParent(_Outptr_result_nullonfailure_ IDxcCursor** pResult) = 0;
  564. virtual HRESULT STDMETHODCALLTYPE GetLexicalParent(_Outptr_result_nullonfailure_ IDxcCursor** pResult) = 0;
  565. virtual HRESULT STDMETHODCALLTYPE GetCursorType(_Outptr_result_nullonfailure_ IDxcType** pResult) = 0;
  566. virtual HRESULT STDMETHODCALLTYPE GetNumArguments(_Out_ int* pResult) = 0;
  567. virtual HRESULT STDMETHODCALLTYPE GetArgumentAt(int index, _Outptr_result_nullonfailure_ IDxcCursor** pResult) = 0;
  568. virtual HRESULT STDMETHODCALLTYPE GetReferencedCursor(_Outptr_result_nullonfailure_ IDxcCursor** pResult) = 0;
  569. /// <summary>For a cursor that is either a reference to or a declaration of some entity, retrieve a cursor that describes the definition of that entity.</summary>
  570. /// <remarks>Some entities can be declared multiple times within a translation unit, but only one of those declarations can also be a definition.</remarks>
  571. /// <returns>A cursor to the definition of this entity; nullptr if there is no definition in this translation unit.</returns>
  572. virtual HRESULT STDMETHODCALLTYPE GetDefinitionCursor(_Outptr_result_nullonfailure_ IDxcCursor** pResult) = 0;
  573. virtual HRESULT STDMETHODCALLTYPE FindReferencesInFile(
  574. _In_ IDxcFile* file, unsigned skip, unsigned top,
  575. _Out_ unsigned* pResultLength, _Outptr_result_buffer_maybenull_(*pResultLength) IDxcCursor*** pResult) = 0;
  576. /// <summary>Gets the name for the entity references by the cursor, e.g. foo for an 'int foo' variable.</summary>
  577. virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Outptr_result_maybenull_ LPSTR* pResult) = 0;
  578. virtual HRESULT STDMETHODCALLTYPE IsEqualTo(_In_ IDxcCursor* other, _Out_ BOOL* pResult) = 0;
  579. virtual HRESULT STDMETHODCALLTYPE IsNull(_Out_ BOOL* pResult) = 0;
  580. virtual HRESULT STDMETHODCALLTYPE IsDefinition(_Out_ BOOL* pResult) = 0;
  581. /// <summary>Gets the display name for the cursor, including e.g. parameter types for a function.</summary>
  582. virtual HRESULT STDMETHODCALLTYPE GetDisplayName(_Out_ BSTR* pResult) = 0;
  583. /// <summary>Gets the qualified name for the symbol the cursor refers to.</summary>
  584. virtual HRESULT STDMETHODCALLTYPE GetQualifiedName(BOOL includeTemplateArgs, _Outptr_result_maybenull_ BSTR* pResult) = 0;
  585. /// <summary>Gets a name for the cursor, applying the specified formatting flags.</summary>
  586. virtual HRESULT STDMETHODCALLTYPE GetFormattedName(DxcCursorFormatting formatting , _Outptr_result_maybenull_ BSTR* pResult) = 0;
  587. /// <summary>Gets children in pResult up to top elements.</summary>
  588. virtual HRESULT STDMETHODCALLTYPE GetChildren(
  589. unsigned skip, unsigned top,
  590. _Out_ unsigned* pResultLength, _Outptr_result_buffer_maybenull_(*pResultLength) IDxcCursor*** pResult) = 0;
  591. /// <summary>Gets the cursor following a location within a compound cursor.</summary>
  592. virtual HRESULT STDMETHODCALLTYPE GetSnappedChild(_In_ IDxcSourceLocation* location, _Outptr_result_maybenull_ IDxcCursor** pResult) = 0;
  593. };
  594. CROSS_PLATFORM_UUIDOF(IDxcDiagnostic, "4f76b234-3659-4d33-99b0-3b0db994b564")
  595. struct IDxcDiagnostic : public IUnknown
  596. {
  597. virtual HRESULT STDMETHODCALLTYPE FormatDiagnostic(
  598. DxcDiagnosticDisplayOptions options,
  599. _Outptr_result_maybenull_ LPSTR* pResult) = 0;
  600. virtual HRESULT STDMETHODCALLTYPE GetSeverity(_Out_ DxcDiagnosticSeverity* pResult) = 0;
  601. virtual HRESULT STDMETHODCALLTYPE GetLocation(_Outptr_result_nullonfailure_ IDxcSourceLocation** pResult) = 0;
  602. virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Outptr_result_maybenull_ LPSTR* pResult) = 0;
  603. virtual HRESULT STDMETHODCALLTYPE GetCategoryText(_Outptr_result_maybenull_ LPSTR* pResult) = 0;
  604. virtual HRESULT STDMETHODCALLTYPE GetNumRanges(_Out_ unsigned* pResult) = 0;
  605. virtual HRESULT STDMETHODCALLTYPE GetRangeAt(unsigned index, _Outptr_result_nullonfailure_ IDxcSourceRange** pResult) = 0;
  606. virtual HRESULT STDMETHODCALLTYPE GetNumFixIts(_Out_ unsigned* pResult) = 0;
  607. virtual HRESULT STDMETHODCALLTYPE GetFixItAt(unsigned index,
  608. _Outptr_result_nullonfailure_ IDxcSourceRange** pReplacementRange, _Outptr_result_maybenull_ LPSTR* pText) = 0;
  609. };
  610. CROSS_PLATFORM_UUIDOF(IDxcFile, "bb2fca9e-1478-47ba-b08c-2c502ada4895")
  611. struct IDxcFile : public IUnknown
  612. {
  613. /// <summary>Gets the file name for this file.</summary>
  614. virtual HRESULT STDMETHODCALLTYPE GetName(_Outptr_result_maybenull_ LPSTR* pResult) = 0;
  615. /// <summary>Checks whether this file is equal to the other specified file.</summary>
  616. virtual HRESULT STDMETHODCALLTYPE IsEqualTo(_In_ IDxcFile* other, _Out_ BOOL* pResult) = 0;
  617. };
  618. CROSS_PLATFORM_UUIDOF(IDxcInclusion, "0c364d65-df44-4412-888e-4e552fc5e3d6")
  619. struct IDxcInclusion : public IUnknown
  620. {
  621. virtual HRESULT STDMETHODCALLTYPE GetIncludedFile(_Outptr_result_nullonfailure_ IDxcFile** pResult) = 0;
  622. virtual HRESULT STDMETHODCALLTYPE GetStackLength(_Out_ unsigned *pResult) = 0;
  623. virtual HRESULT STDMETHODCALLTYPE GetStackItem(unsigned index, _Outptr_result_nullonfailure_ IDxcSourceLocation **pResult) = 0;
  624. };
  625. CROSS_PLATFORM_UUIDOF(IDxcIntelliSense, "b1f99513-46d6-4112-8169-dd0d6053f17d")
  626. struct IDxcIntelliSense : public IUnknown
  627. {
  628. virtual HRESULT STDMETHODCALLTYPE CreateIndex(_Outptr_result_nullonfailure_ IDxcIndex** index) = 0;
  629. virtual HRESULT STDMETHODCALLTYPE GetNullLocation(_Outptr_result_nullonfailure_ IDxcSourceLocation** location) = 0;
  630. virtual HRESULT STDMETHODCALLTYPE GetNullRange(_Outptr_result_nullonfailure_ IDxcSourceRange** location) = 0;
  631. virtual HRESULT STDMETHODCALLTYPE GetRange(
  632. _In_ IDxcSourceLocation* start,
  633. _In_ IDxcSourceLocation* end,
  634. _Outptr_result_nullonfailure_ IDxcSourceRange** location) = 0;
  635. virtual HRESULT STDMETHODCALLTYPE GetDefaultDiagnosticDisplayOptions(
  636. _Out_ DxcDiagnosticDisplayOptions* pValue) = 0;
  637. virtual HRESULT STDMETHODCALLTYPE GetDefaultEditingTUOptions(_Out_ DxcTranslationUnitFlags* pValue) = 0;
  638. virtual HRESULT STDMETHODCALLTYPE CreateUnsavedFile(_In_ LPCSTR fileName, _In_ LPCSTR contents, unsigned contentLength, _Outptr_result_nullonfailure_ IDxcUnsavedFile** pResult) = 0;
  639. };
  640. CROSS_PLATFORM_UUIDOF(IDxcIndex, "937824a0-7f5a-4815-9ba7-7fc0424f4173")
  641. struct IDxcIndex : public IUnknown
  642. {
  643. virtual HRESULT STDMETHODCALLTYPE SetGlobalOptions(DxcGlobalOptions options) = 0;
  644. virtual HRESULT STDMETHODCALLTYPE GetGlobalOptions(_Out_ DxcGlobalOptions* options) = 0;
  645. virtual HRESULT STDMETHODCALLTYPE ParseTranslationUnit(
  646. _In_z_ const char *source_filename,
  647. _In_count_(num_command_line_args) const char * const *command_line_args,
  648. int num_command_line_args,
  649. _In_count_(num_unsaved_files) IDxcUnsavedFile** unsaved_files,
  650. unsigned num_unsaved_files,
  651. DxcTranslationUnitFlags options,
  652. _Out_ IDxcTranslationUnit** pTranslationUnit) = 0;
  653. };
  654. CROSS_PLATFORM_UUIDOF(IDxcSourceLocation, "8e7ddf1c-d7d3-4d69-b286-85fccba1e0cf")
  655. struct IDxcSourceLocation : public IUnknown
  656. {
  657. virtual HRESULT STDMETHODCALLTYPE IsEqualTo(_In_ IDxcSourceLocation* other, _Out_ BOOL* pResult) = 0;
  658. virtual HRESULT STDMETHODCALLTYPE GetSpellingLocation(
  659. _Outptr_opt_ IDxcFile** pFile,
  660. _Out_opt_ unsigned* pLine,
  661. _Out_opt_ unsigned* pCol,
  662. _Out_opt_ unsigned* pOffset) = 0;
  663. virtual HRESULT STDMETHODCALLTYPE IsNull(_Out_ BOOL* pResult) = 0;
  664. virtual HRESULT STDMETHODCALLTYPE GetPresumedLocation(
  665. _Outptr_opt_ LPSTR* pFilename,
  666. _Out_opt_ unsigned* pLine,
  667. _Out_opt_ unsigned* pCol) = 0;
  668. };
  669. CROSS_PLATFORM_UUIDOF(IDxcSourceRange, "f1359b36-a53f-4e81-b514-b6b84122a13f")
  670. struct IDxcSourceRange : public IUnknown
  671. {
  672. virtual HRESULT STDMETHODCALLTYPE IsNull(_Out_ BOOL* pValue) = 0;
  673. virtual HRESULT STDMETHODCALLTYPE GetStart(_Out_ IDxcSourceLocation** pValue) = 0;
  674. virtual HRESULT STDMETHODCALLTYPE GetEnd(_Out_ IDxcSourceLocation** pValue) = 0;
  675. virtual HRESULT STDMETHODCALLTYPE GetOffsets(_Out_ unsigned* startOffset, _Out_ unsigned* endOffset) = 0;
  676. };
  677. CROSS_PLATFORM_UUIDOF(IDxcToken, "7f90b9ff-a275-4932-97d8-3cfd234482a2")
  678. struct IDxcToken : public IUnknown
  679. {
  680. virtual HRESULT STDMETHODCALLTYPE GetKind(_Out_ DxcTokenKind* pValue) = 0;
  681. virtual HRESULT STDMETHODCALLTYPE GetLocation(_Out_ IDxcSourceLocation** pValue) = 0;
  682. virtual HRESULT STDMETHODCALLTYPE GetExtent(_Out_ IDxcSourceRange** pValue) = 0;
  683. virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Out_ LPSTR* pValue) = 0;
  684. };
  685. CROSS_PLATFORM_UUIDOF(IDxcTranslationUnit, "9677dee0-c0e5-46a1-8b40-3db3168be63d")
  686. struct IDxcTranslationUnit : public IUnknown
  687. {
  688. virtual HRESULT STDMETHODCALLTYPE GetCursor(_Out_ IDxcCursor** pCursor) = 0;
  689. virtual HRESULT STDMETHODCALLTYPE Tokenize(
  690. _In_ IDxcSourceRange* range,
  691. _Outptr_result_buffer_maybenull_(*pTokenCount) IDxcToken*** pTokens,
  692. _Out_ unsigned* pTokenCount) = 0;
  693. virtual HRESULT STDMETHODCALLTYPE GetLocation(
  694. _In_ IDxcFile* file,
  695. unsigned line, unsigned column,
  696. _Outptr_result_nullonfailure_ IDxcSourceLocation** pResult) = 0;
  697. virtual HRESULT STDMETHODCALLTYPE GetNumDiagnostics(_Out_ unsigned* pValue) = 0;
  698. virtual HRESULT STDMETHODCALLTYPE GetDiagnostic(unsigned index, _Outptr_result_nullonfailure_ IDxcDiagnostic** pValue) = 0;
  699. virtual HRESULT STDMETHODCALLTYPE GetFile(_In_ const char* name, _Outptr_result_nullonfailure_ IDxcFile** pResult) = 0;
  700. virtual HRESULT STDMETHODCALLTYPE GetFileName(_Outptr_result_maybenull_ LPSTR* pResult) = 0;
  701. virtual HRESULT STDMETHODCALLTYPE Reparse(
  702. _In_count_(num_unsaved_files) IDxcUnsavedFile** unsaved_files,
  703. unsigned num_unsaved_files) = 0;
  704. virtual HRESULT STDMETHODCALLTYPE GetCursorForLocation(_In_ IDxcSourceLocation* location, _Outptr_result_nullonfailure_ IDxcCursor** pResult) = 0;
  705. virtual HRESULT STDMETHODCALLTYPE GetLocationForOffset(_In_ IDxcFile* file, unsigned offset, _Outptr_result_nullonfailure_ IDxcSourceLocation** pResult) = 0;
  706. virtual HRESULT STDMETHODCALLTYPE GetSkippedRanges(_In_ IDxcFile* file, _Out_ unsigned* pResultCount, _Outptr_result_buffer_(*pResultCount) IDxcSourceRange*** pResult) = 0;
  707. virtual HRESULT STDMETHODCALLTYPE GetDiagnosticDetails(unsigned index, DxcDiagnosticDisplayOptions options,
  708. _Out_ unsigned* errorCode,
  709. _Out_ unsigned* errorLine,
  710. _Out_ unsigned* errorColumn,
  711. _Out_ BSTR* errorFile,
  712. _Out_ unsigned* errorOffset,
  713. _Out_ unsigned* errorLength,
  714. _Out_ BSTR* errorMessage) = 0;
  715. virtual HRESULT STDMETHODCALLTYPE GetInclusionList(_Out_ unsigned* pResultCount, _Outptr_result_buffer_(*pResultCount) IDxcInclusion*** pResult) = 0;
  716. virtual HRESULT STDMETHODCALLTYPE CodeCompleteAt(
  717. _In_ const char *fileName, unsigned line, unsigned column,
  718. _In_ IDxcUnsavedFile** pUnsavedFiles, unsigned numUnsavedFiles,
  719. _In_ DxcCodeCompleteFlags options,
  720. _Outptr_result_nullonfailure_ IDxcCodeCompleteResults **pResult) = 0;
  721. };
  722. CROSS_PLATFORM_UUIDOF(IDxcType, "2ec912fd-b144-4a15-ad0d-1c5439c81e46")
  723. struct IDxcType : public IUnknown
  724. {
  725. virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Outptr_result_z_ LPSTR* pResult) = 0;
  726. virtual HRESULT STDMETHODCALLTYPE IsEqualTo(_In_ IDxcType* other, _Out_ BOOL* pResult) = 0;
  727. virtual HRESULT STDMETHODCALLTYPE GetKind(_Out_ DxcTypeKind* pResult) = 0;
  728. };
  729. CROSS_PLATFORM_UUIDOF(IDxcUnsavedFile, "8ec00f98-07d0-4e60-9d7c-5a50b5b0017f")
  730. struct IDxcUnsavedFile : public IUnknown
  731. {
  732. virtual HRESULT STDMETHODCALLTYPE GetFileName(_Outptr_result_z_ LPSTR* pFileName) = 0;
  733. virtual HRESULT STDMETHODCALLTYPE GetContents(_Outptr_result_z_ LPSTR* pContents) = 0;
  734. virtual HRESULT STDMETHODCALLTYPE GetLength(_Out_ unsigned* pLength) = 0;
  735. };
  736. CROSS_PLATFORM_UUIDOF(IDxcCodeCompleteResults, "1E06466A-FD8B-45F3-A78F-8A3F76EBB552")
  737. struct IDxcCodeCompleteResults : public IUnknown
  738. {
  739. virtual HRESULT STDMETHODCALLTYPE GetNumResults(_Out_ unsigned* pResult) = 0;
  740. virtual HRESULT STDMETHODCALLTYPE GetResultAt(unsigned index, _Outptr_result_nullonfailure_ IDxcCompletionResult** pResult) = 0;
  741. };
  742. CROSS_PLATFORM_UUIDOF(IDxcCompletionResult, "943C0588-22D0-4784-86FC-701F802AC2B6")
  743. struct IDxcCompletionResult : public IUnknown
  744. {
  745. virtual HRESULT STDMETHODCALLTYPE GetCursorKind(_Out_ DxcCursorKind* pResult) = 0;
  746. virtual HRESULT STDMETHODCALLTYPE GetCompletionString(_Outptr_result_nullonfailure_ IDxcCompletionString** pResult) = 0;
  747. };
  748. CROSS_PLATFORM_UUIDOF(IDxcCompletionString, "06B51E0F-A605-4C69-A110-CD6E14B58EEC")
  749. struct IDxcCompletionString : public IUnknown
  750. {
  751. virtual HRESULT STDMETHODCALLTYPE GetNumCompletionChunks(_Out_ unsigned* pResult) = 0;
  752. virtual HRESULT STDMETHODCALLTYPE GetCompletionChunkKind(unsigned chunkNumber, _Out_ DxcCompletionChunkKind* pResult) = 0;
  753. virtual HRESULT STDMETHODCALLTYPE GetCompletionChunkText(unsigned chunkNumber, _Out_ LPSTR* pResult) = 0;
  754. };
  755. // Fun fact: 'extern' is required because const is by default static in C++, so
  756. // CLSID_DxcIntelliSense is not visible externally (this is OK in C, since const is
  757. // not by default static in C)
  758. #ifdef _MSC_VER
  759. #define CLSID_SCOPE __declspec(selectany) extern
  760. #else
  761. #define CLSID_SCOPE
  762. #endif
  763. CLSID_SCOPE const CLSID
  764. CLSID_DxcIntelliSense = {/* 3047833c-d1c0-4b8e-9d40-102878605985 */
  765. 0x3047833c,
  766. 0xd1c0,
  767. 0x4b8e,
  768. {0x9d, 0x40, 0x10, 0x28, 0x78, 0x60, 0x59, 0x85}};
  769. #endif