dxcisense.h 41 KB

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