Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | /*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\ |
| 2 | |* *| |
| 3 | |* The LLVM Compiler Infrastructure *| |
| 4 | |* *| |
| 5 | |* This file is distributed under the University of Illinois Open Source *| |
| 6 | |* License. See LICENSE.TXT for details. *| |
| 7 | |* *| |
| 8 | |*===----------------------------------------------------------------------===*| |
| 9 | |* *| |
| 10 | |* This header provides a public interface to a Clang library for extracting *| |
| 11 | |* high-level symbol information from source files without exposing the full *| |
| 12 | |* Clang C++ API. *| |
| 13 | |* *| |
| 14 | \*===----------------------------------------------------------------------===*/ |
| 15 | |
| 16 | #ifndef LLVM_CLANG_C_INDEX_H |
| 17 | #define LLVM_CLANG_C_INDEX_H |
| 18 | |
| 19 | #include <time.h> |
| 20 | |
| 21 | #include "clang-c/Platform.h" |
| 22 | #include "clang-c/CXErrorCode.h" |
| 23 | #include "clang-c/CXString.h" |
| 24 | #include "clang-c/BuildSystem.h" |
| 25 | |
| 26 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 27 | * The version constants for the libclang API. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 28 | * CINDEX_VERSION_MINOR should increase when there are API additions. |
| 29 | * CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes. |
| 30 | * |
| 31 | * The policy about the libclang API was always to keep it source and ABI |
| 32 | * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. |
| 33 | */ |
| 34 | #define CINDEX_VERSION_MAJOR 0 |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 35 | #define CINDEX_VERSION_MINOR 50 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 36 | |
| 37 | #define CINDEX_VERSION_ENCODE(major, minor) ( \ |
| 38 | ((major) * 10000) \ |
| 39 | + ((minor) * 1)) |
| 40 | |
| 41 | #define CINDEX_VERSION CINDEX_VERSION_ENCODE( \ |
| 42 | CINDEX_VERSION_MAJOR, \ |
| 43 | CINDEX_VERSION_MINOR ) |
| 44 | |
| 45 | #define CINDEX_VERSION_STRINGIZE_(major, minor) \ |
| 46 | #major"."#minor |
| 47 | #define CINDEX_VERSION_STRINGIZE(major, minor) \ |
| 48 | CINDEX_VERSION_STRINGIZE_(major, minor) |
| 49 | |
| 50 | #define CINDEX_VERSION_STRING CINDEX_VERSION_STRINGIZE( \ |
| 51 | CINDEX_VERSION_MAJOR, \ |
| 52 | CINDEX_VERSION_MINOR) |
| 53 | |
| 54 | #ifdef __cplusplus |
| 55 | extern "C" { |
| 56 | #endif |
| 57 | |
| 58 | /** \defgroup CINDEX libclang: C Interface to Clang |
| 59 | * |
| 60 | * The C Interface to Clang provides a relatively small API that exposes |
| 61 | * facilities for parsing source code into an abstract syntax tree (AST), |
| 62 | * loading already-parsed ASTs, traversing the AST, associating |
| 63 | * physical source locations with elements within the AST, and other |
| 64 | * facilities that support Clang-based development tools. |
| 65 | * |
| 66 | * This C interface to Clang will never provide all of the information |
| 67 | * representation stored in Clang's C++ AST, nor should it: the intent is to |
| 68 | * maintain an API that is relatively stable from one release to the next, |
| 69 | * providing only the basic functionality needed to support development tools. |
| 70 | * |
| 71 | * To avoid namespace pollution, data types are prefixed with "CX" and |
| 72 | * functions are prefixed with "clang_". |
| 73 | * |
| 74 | * @{ |
| 75 | */ |
| 76 | |
| 77 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 78 | * An "index" that consists of a set of translation units that would |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 79 | * typically be linked together into an executable or library. |
| 80 | */ |
| 81 | typedef void *CXIndex; |
| 82 | |
| 83 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 84 | * An opaque type representing target information for a given translation |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 85 | * unit. |
| 86 | */ |
| 87 | typedef struct CXTargetInfoImpl *CXTargetInfo; |
| 88 | |
| 89 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 90 | * A single translation unit, which resides in an index. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 91 | */ |
| 92 | typedef struct CXTranslationUnitImpl *CXTranslationUnit; |
| 93 | |
| 94 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 95 | * Opaque pointer representing client data that will be passed through |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 96 | * to various callbacks and visitors. |
| 97 | */ |
| 98 | typedef void *CXClientData; |
| 99 | |
| 100 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 101 | * Provides the contents of a file that has not yet been saved to disk. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 102 | * |
| 103 | * Each CXUnsavedFile instance provides the name of a file on the |
| 104 | * system along with the current contents of that file that have not |
| 105 | * yet been saved to disk. |
| 106 | */ |
| 107 | struct CXUnsavedFile { |
| 108 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 109 | * The file whose contents have not yet been saved. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 110 | * |
| 111 | * This file must already exist in the file system. |
| 112 | */ |
| 113 | const char *Filename; |
| 114 | |
| 115 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 116 | * A buffer containing the unsaved contents of this file. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 117 | */ |
| 118 | const char *Contents; |
| 119 | |
| 120 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 121 | * The length of the unsaved contents of this buffer. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 122 | */ |
| 123 | unsigned long Length; |
| 124 | }; |
| 125 | |
| 126 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 127 | * Describes the availability of a particular entity, which indicates |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 128 | * whether the use of this entity will result in a warning or error due to |
| 129 | * it being deprecated or unavailable. |
| 130 | */ |
| 131 | enum CXAvailabilityKind { |
| 132 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 133 | * The entity is available. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 134 | */ |
| 135 | CXAvailability_Available, |
| 136 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 137 | * The entity is available, but has been deprecated (and its use is |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 138 | * not recommended). |
| 139 | */ |
| 140 | CXAvailability_Deprecated, |
| 141 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 142 | * The entity is not available; any use of it will be an error. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 143 | */ |
| 144 | CXAvailability_NotAvailable, |
| 145 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 146 | * The entity is available, but not accessible; any use of it will be |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 147 | * an error. |
| 148 | */ |
| 149 | CXAvailability_NotAccessible |
| 150 | }; |
| 151 | |
| 152 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 153 | * Describes a version number of the form major.minor.subminor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 154 | */ |
| 155 | typedef struct CXVersion { |
| 156 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 157 | * The major version number, e.g., the '10' in '10.7.3'. A negative |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 158 | * value indicates that there is no version number at all. |
| 159 | */ |
| 160 | int Major; |
| 161 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 162 | * The minor version number, e.g., the '7' in '10.7.3'. This value |
| 163 | * will be negative if no minor version number was provided, e.g., for |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 164 | * version '10'. |
| 165 | */ |
| 166 | int Minor; |
| 167 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 168 | * The subminor version number, e.g., the '3' in '10.7.3'. This value |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 169 | * will be negative if no minor or subminor version number was provided, |
| 170 | * e.g., in version '10' or '10.7'. |
| 171 | */ |
| 172 | int Subminor; |
| 173 | } CXVersion; |
| 174 | |
| 175 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 176 | * Describes the exception specification of a cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 177 | * |
| 178 | * A negative value indicates that the cursor is not a function declaration. |
| 179 | */ |
| 180 | enum CXCursor_ExceptionSpecificationKind { |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 181 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 182 | * The cursor has no exception specification. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 183 | */ |
| 184 | CXCursor_ExceptionSpecificationKind_None, |
| 185 | |
| 186 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 187 | * The cursor has exception specification throw() |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 188 | */ |
| 189 | CXCursor_ExceptionSpecificationKind_DynamicNone, |
| 190 | |
| 191 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 192 | * The cursor has exception specification throw(T1, T2) |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 193 | */ |
| 194 | CXCursor_ExceptionSpecificationKind_Dynamic, |
| 195 | |
| 196 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 197 | * The cursor has exception specification throw(...). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 198 | */ |
| 199 | CXCursor_ExceptionSpecificationKind_MSAny, |
| 200 | |
| 201 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 202 | * The cursor has exception specification basic noexcept. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 203 | */ |
| 204 | CXCursor_ExceptionSpecificationKind_BasicNoexcept, |
| 205 | |
| 206 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 207 | * The cursor has exception specification computed noexcept. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 208 | */ |
| 209 | CXCursor_ExceptionSpecificationKind_ComputedNoexcept, |
| 210 | |
| 211 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 212 | * The exception specification has not yet been evaluated. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 213 | */ |
| 214 | CXCursor_ExceptionSpecificationKind_Unevaluated, |
| 215 | |
| 216 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 217 | * The exception specification has not yet been instantiated. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 218 | */ |
| 219 | CXCursor_ExceptionSpecificationKind_Uninstantiated, |
| 220 | |
| 221 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 222 | * The exception specification has not been parsed yet. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 223 | */ |
| 224 | CXCursor_ExceptionSpecificationKind_Unparsed |
| 225 | }; |
| 226 | |
| 227 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 228 | * Provides a shared context for creating translation units. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 229 | * |
| 230 | * It provides two options: |
| 231 | * |
| 232 | * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local" |
| 233 | * declarations (when loading any new translation units). A "local" declaration |
| 234 | * is one that belongs in the translation unit itself and not in a precompiled |
| 235 | * header that was used by the translation unit. If zero, all declarations |
| 236 | * will be enumerated. |
| 237 | * |
| 238 | * Here is an example: |
| 239 | * |
| 240 | * \code |
| 241 | * // excludeDeclsFromPCH = 1, displayDiagnostics=1 |
| 242 | * Idx = clang_createIndex(1, 1); |
| 243 | * |
| 244 | * // IndexTest.pch was produced with the following command: |
| 245 | * // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch" |
| 246 | * TU = clang_createTranslationUnit(Idx, "IndexTest.pch"); |
| 247 | * |
| 248 | * // This will load all the symbols from 'IndexTest.pch' |
| 249 | * clang_visitChildren(clang_getTranslationUnitCursor(TU), |
| 250 | * TranslationUnitVisitor, 0); |
| 251 | * clang_disposeTranslationUnit(TU); |
| 252 | * |
| 253 | * // This will load all the symbols from 'IndexTest.c', excluding symbols |
| 254 | * // from 'IndexTest.pch'. |
| 255 | * char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" }; |
| 256 | * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args, |
| 257 | * 0, 0); |
| 258 | * clang_visitChildren(clang_getTranslationUnitCursor(TU), |
| 259 | * TranslationUnitVisitor, 0); |
| 260 | * clang_disposeTranslationUnit(TU); |
| 261 | * \endcode |
| 262 | * |
| 263 | * This process of creating the 'pch', loading it separately, and using it (via |
| 264 | * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks |
| 265 | * (which gives the indexer the same performance benefit as the compiler). |
| 266 | */ |
| 267 | CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH, |
| 268 | int displayDiagnostics); |
| 269 | |
| 270 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 271 | * Destroy the given index. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 272 | * |
| 273 | * The index must not be destroyed until all of the translation units created |
| 274 | * within that index have been destroyed. |
| 275 | */ |
| 276 | CINDEX_LINKAGE void clang_disposeIndex(CXIndex index); |
| 277 | |
| 278 | typedef enum { |
| 279 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 280 | * Used to indicate that no special CXIndex options are needed. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 281 | */ |
| 282 | CXGlobalOpt_None = 0x0, |
| 283 | |
| 284 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 285 | * Used to indicate that threads that libclang creates for indexing |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 286 | * purposes should use background priority. |
| 287 | * |
| 288 | * Affects #clang_indexSourceFile, #clang_indexTranslationUnit, |
| 289 | * #clang_parseTranslationUnit, #clang_saveTranslationUnit. |
| 290 | */ |
| 291 | CXGlobalOpt_ThreadBackgroundPriorityForIndexing = 0x1, |
| 292 | |
| 293 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 294 | * Used to indicate that threads that libclang creates for editing |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 295 | * purposes should use background priority. |
| 296 | * |
| 297 | * Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt, |
| 298 | * #clang_annotateTokens |
| 299 | */ |
| 300 | CXGlobalOpt_ThreadBackgroundPriorityForEditing = 0x2, |
| 301 | |
| 302 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 303 | * Used to indicate that all threads that libclang creates should use |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 304 | * background priority. |
| 305 | */ |
| 306 | CXGlobalOpt_ThreadBackgroundPriorityForAll = |
| 307 | CXGlobalOpt_ThreadBackgroundPriorityForIndexing | |
| 308 | CXGlobalOpt_ThreadBackgroundPriorityForEditing |
| 309 | |
| 310 | } CXGlobalOptFlags; |
| 311 | |
| 312 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 313 | * Sets general options associated with a CXIndex. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 314 | * |
| 315 | * For example: |
| 316 | * \code |
| 317 | * CXIndex idx = ...; |
| 318 | * clang_CXIndex_setGlobalOptions(idx, |
| 319 | * clang_CXIndex_getGlobalOptions(idx) | |
| 320 | * CXGlobalOpt_ThreadBackgroundPriorityForIndexing); |
| 321 | * \endcode |
| 322 | * |
| 323 | * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags. |
| 324 | */ |
| 325 | CINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options); |
| 326 | |
| 327 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 328 | * Gets the general options associated with a CXIndex. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 329 | * |
| 330 | * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that |
| 331 | * are associated with the given CXIndex object. |
| 332 | */ |
| 333 | CINDEX_LINKAGE unsigned clang_CXIndex_getGlobalOptions(CXIndex); |
| 334 | |
| 335 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 336 | * Sets the invocation emission path option in a CXIndex. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 337 | * |
| 338 | * The invocation emission path specifies a path which will contain log |
| 339 | * files for certain libclang invocations. A null value (default) implies that |
| 340 | * libclang invocations are not logged.. |
| 341 | */ |
| 342 | CINDEX_LINKAGE void |
| 343 | clang_CXIndex_setInvocationEmissionPathOption(CXIndex, const char *Path); |
| 344 | |
| 345 | /** |
| 346 | * \defgroup CINDEX_FILES File manipulation routines |
| 347 | * |
| 348 | * @{ |
| 349 | */ |
| 350 | |
| 351 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 352 | * A particular source file that is part of a translation unit. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 353 | */ |
| 354 | typedef void *CXFile; |
| 355 | |
| 356 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 357 | * Retrieve the complete file and path name of the given file. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 358 | */ |
| 359 | CINDEX_LINKAGE CXString clang_getFileName(CXFile SFile); |
| 360 | |
| 361 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 362 | * Retrieve the last modification time of the given file. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 363 | */ |
| 364 | CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile); |
| 365 | |
| 366 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 367 | * Uniquely identifies a CXFile, that refers to the same underlying file, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 368 | * across an indexing session. |
| 369 | */ |
| 370 | typedef struct { |
| 371 | unsigned long long data[3]; |
| 372 | } CXFileUniqueID; |
| 373 | |
| 374 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 375 | * Retrieve the unique ID for the given \c file. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 376 | * |
| 377 | * \param file the file to get the ID for. |
| 378 | * \param outID stores the returned CXFileUniqueID. |
| 379 | * \returns If there was a failure getting the unique ID, returns non-zero, |
| 380 | * otherwise returns 0. |
| 381 | */ |
| 382 | CINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID); |
| 383 | |
| 384 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 385 | * Determine whether the given header is guarded against |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 386 | * multiple inclusions, either with the conventional |
| 387 | * \#ifndef/\#define/\#endif macro guards or with \#pragma once. |
| 388 | */ |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 389 | CINDEX_LINKAGE unsigned |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 390 | clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file); |
| 391 | |
| 392 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 393 | * Retrieve a file handle within the given translation unit. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 394 | * |
| 395 | * \param tu the translation unit |
| 396 | * |
| 397 | * \param file_name the name of the file. |
| 398 | * |
| 399 | * \returns the file handle for the named file in the translation unit \p tu, |
| 400 | * or a NULL file handle if the file was not a part of this translation unit. |
| 401 | */ |
| 402 | CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu, |
| 403 | const char *file_name); |
| 404 | |
| 405 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 406 | * Retrieve the buffer associated with the given file. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 407 | * |
| 408 | * \param tu the translation unit |
| 409 | * |
| 410 | * \param file the file for which to retrieve the buffer. |
| 411 | * |
| 412 | * \param size [out] if non-NULL, will be set to the size of the buffer. |
| 413 | * |
| 414 | * \returns a pointer to the buffer in memory that holds the contents of |
| 415 | * \p file, or a NULL pointer when the file is not loaded. |
| 416 | */ |
| 417 | CINDEX_LINKAGE const char *clang_getFileContents(CXTranslationUnit tu, |
| 418 | CXFile file, size_t *size); |
| 419 | |
| 420 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 421 | * Returns non-zero if the \c file1 and \c file2 point to the same file, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 422 | * or they are both NULL. |
| 423 | */ |
| 424 | CINDEX_LINKAGE int clang_File_isEqual(CXFile file1, CXFile file2); |
| 425 | |
| 426 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 427 | * Returns the real path name of \c file. |
| 428 | * |
| 429 | * An empty string may be returned. Use \c clang_getFileName() in that case. |
| 430 | */ |
| 431 | CINDEX_LINKAGE CXString clang_File_tryGetRealPathName(CXFile file); |
| 432 | |
| 433 | /** |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 434 | * @} |
| 435 | */ |
| 436 | |
| 437 | /** |
| 438 | * \defgroup CINDEX_LOCATIONS Physical source locations |
| 439 | * |
| 440 | * Clang represents physical source locations in its abstract syntax tree in |
| 441 | * great detail, with file, line, and column information for the majority of |
| 442 | * the tokens parsed in the source code. These data types and functions are |
| 443 | * used to represent source location information, either for a particular |
| 444 | * point in the program or for a range of points in the program, and extract |
| 445 | * specific location information from those data types. |
| 446 | * |
| 447 | * @{ |
| 448 | */ |
| 449 | |
| 450 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 451 | * Identifies a specific source location within a translation |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 452 | * unit. |
| 453 | * |
| 454 | * Use clang_getExpansionLocation() or clang_getSpellingLocation() |
| 455 | * to map a source location to a particular file, line, and column. |
| 456 | */ |
| 457 | typedef struct { |
| 458 | const void *ptr_data[2]; |
| 459 | unsigned int_data; |
| 460 | } CXSourceLocation; |
| 461 | |
| 462 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 463 | * Identifies a half-open character range in the source code. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 464 | * |
| 465 | * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the |
| 466 | * starting and end locations from a source range, respectively. |
| 467 | */ |
| 468 | typedef struct { |
| 469 | const void *ptr_data[2]; |
| 470 | unsigned begin_int_data; |
| 471 | unsigned end_int_data; |
| 472 | } CXSourceRange; |
| 473 | |
| 474 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 475 | * Retrieve a NULL (invalid) source location. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 476 | */ |
| 477 | CINDEX_LINKAGE CXSourceLocation clang_getNullLocation(void); |
| 478 | |
| 479 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 480 | * Determine whether two source locations, which must refer into |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 481 | * the same translation unit, refer to exactly the same point in the source |
| 482 | * code. |
| 483 | * |
| 484 | * \returns non-zero if the source locations refer to the same location, zero |
| 485 | * if they refer to different locations. |
| 486 | */ |
| 487 | CINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1, |
| 488 | CXSourceLocation loc2); |
| 489 | |
| 490 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 491 | * Retrieves the source location associated with a given file/line/column |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 492 | * in a particular translation unit. |
| 493 | */ |
| 494 | CINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu, |
| 495 | CXFile file, |
| 496 | unsigned line, |
| 497 | unsigned column); |
| 498 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 499 | * Retrieves the source location associated with a given character offset |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 500 | * in a particular translation unit. |
| 501 | */ |
| 502 | CINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu, |
| 503 | CXFile file, |
| 504 | unsigned offset); |
| 505 | |
| 506 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 507 | * Returns non-zero if the given source location is in a system header. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 508 | */ |
| 509 | CINDEX_LINKAGE int clang_Location_isInSystemHeader(CXSourceLocation location); |
| 510 | |
| 511 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 512 | * Returns non-zero if the given source location is in the main file of |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 513 | * the corresponding translation unit. |
| 514 | */ |
| 515 | CINDEX_LINKAGE int clang_Location_isFromMainFile(CXSourceLocation location); |
| 516 | |
| 517 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 518 | * Retrieve a NULL (invalid) source range. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 519 | */ |
| 520 | CINDEX_LINKAGE CXSourceRange clang_getNullRange(void); |
| 521 | |
| 522 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 523 | * Retrieve a source range given the beginning and ending source |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 524 | * locations. |
| 525 | */ |
| 526 | CINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin, |
| 527 | CXSourceLocation end); |
| 528 | |
| 529 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 530 | * Determine whether two ranges are equivalent. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 531 | * |
| 532 | * \returns non-zero if the ranges are the same, zero if they differ. |
| 533 | */ |
| 534 | CINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1, |
| 535 | CXSourceRange range2); |
| 536 | |
| 537 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 538 | * Returns non-zero if \p range is null. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 539 | */ |
| 540 | CINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range); |
| 541 | |
| 542 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 543 | * Retrieve the file, line, column, and offset represented by |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 544 | * the given source location. |
| 545 | * |
| 546 | * If the location refers into a macro expansion, retrieves the |
| 547 | * location of the macro expansion. |
| 548 | * |
| 549 | * \param location the location within a source file that will be decomposed |
| 550 | * into its parts. |
| 551 | * |
| 552 | * \param file [out] if non-NULL, will be set to the file to which the given |
| 553 | * source location points. |
| 554 | * |
| 555 | * \param line [out] if non-NULL, will be set to the line to which the given |
| 556 | * source location points. |
| 557 | * |
| 558 | * \param column [out] if non-NULL, will be set to the column to which the given |
| 559 | * source location points. |
| 560 | * |
| 561 | * \param offset [out] if non-NULL, will be set to the offset into the |
| 562 | * buffer to which the given source location points. |
| 563 | */ |
| 564 | CINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location, |
| 565 | CXFile *file, |
| 566 | unsigned *line, |
| 567 | unsigned *column, |
| 568 | unsigned *offset); |
| 569 | |
| 570 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 571 | * Retrieve the file, line and column represented by the given source |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 572 | * location, as specified in a # line directive. |
| 573 | * |
| 574 | * Example: given the following source code in a file somefile.c |
| 575 | * |
| 576 | * \code |
| 577 | * #123 "dummy.c" 1 |
| 578 | * |
| 579 | * static int func(void) |
| 580 | * { |
| 581 | * return 0; |
| 582 | * } |
| 583 | * \endcode |
| 584 | * |
| 585 | * the location information returned by this function would be |
| 586 | * |
| 587 | * File: dummy.c Line: 124 Column: 12 |
| 588 | * |
| 589 | * whereas clang_getExpansionLocation would have returned |
| 590 | * |
| 591 | * File: somefile.c Line: 3 Column: 12 |
| 592 | * |
| 593 | * \param location the location within a source file that will be decomposed |
| 594 | * into its parts. |
| 595 | * |
| 596 | * \param filename [out] if non-NULL, will be set to the filename of the |
| 597 | * source location. Note that filenames returned will be for "virtual" files, |
| 598 | * which don't necessarily exist on the machine running clang - e.g. when |
| 599 | * parsing preprocessed output obtained from a different environment. If |
| 600 | * a non-NULL value is passed in, remember to dispose of the returned value |
| 601 | * using \c clang_disposeString() once you've finished with it. For an invalid |
| 602 | * source location, an empty string is returned. |
| 603 | * |
| 604 | * \param line [out] if non-NULL, will be set to the line number of the |
| 605 | * source location. For an invalid source location, zero is returned. |
| 606 | * |
| 607 | * \param column [out] if non-NULL, will be set to the column number of the |
| 608 | * source location. For an invalid source location, zero is returned. |
| 609 | */ |
| 610 | CINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location, |
| 611 | CXString *filename, |
| 612 | unsigned *line, |
| 613 | unsigned *column); |
| 614 | |
| 615 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 616 | * Legacy API to retrieve the file, line, column, and offset represented |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 617 | * by the given source location. |
| 618 | * |
| 619 | * This interface has been replaced by the newer interface |
| 620 | * #clang_getExpansionLocation(). See that interface's documentation for |
| 621 | * details. |
| 622 | */ |
| 623 | CINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location, |
| 624 | CXFile *file, |
| 625 | unsigned *line, |
| 626 | unsigned *column, |
| 627 | unsigned *offset); |
| 628 | |
| 629 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 630 | * Retrieve the file, line, column, and offset represented by |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 631 | * the given source location. |
| 632 | * |
| 633 | * If the location refers into a macro instantiation, return where the |
| 634 | * location was originally spelled in the source file. |
| 635 | * |
| 636 | * \param location the location within a source file that will be decomposed |
| 637 | * into its parts. |
| 638 | * |
| 639 | * \param file [out] if non-NULL, will be set to the file to which the given |
| 640 | * source location points. |
| 641 | * |
| 642 | * \param line [out] if non-NULL, will be set to the line to which the given |
| 643 | * source location points. |
| 644 | * |
| 645 | * \param column [out] if non-NULL, will be set to the column to which the given |
| 646 | * source location points. |
| 647 | * |
| 648 | * \param offset [out] if non-NULL, will be set to the offset into the |
| 649 | * buffer to which the given source location points. |
| 650 | */ |
| 651 | CINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location, |
| 652 | CXFile *file, |
| 653 | unsigned *line, |
| 654 | unsigned *column, |
| 655 | unsigned *offset); |
| 656 | |
| 657 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 658 | * Retrieve the file, line, column, and offset represented by |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 659 | * the given source location. |
| 660 | * |
| 661 | * If the location refers into a macro expansion, return where the macro was |
| 662 | * expanded or where the macro argument was written, if the location points at |
| 663 | * a macro argument. |
| 664 | * |
| 665 | * \param location the location within a source file that will be decomposed |
| 666 | * into its parts. |
| 667 | * |
| 668 | * \param file [out] if non-NULL, will be set to the file to which the given |
| 669 | * source location points. |
| 670 | * |
| 671 | * \param line [out] if non-NULL, will be set to the line to which the given |
| 672 | * source location points. |
| 673 | * |
| 674 | * \param column [out] if non-NULL, will be set to the column to which the given |
| 675 | * source location points. |
| 676 | * |
| 677 | * \param offset [out] if non-NULL, will be set to the offset into the |
| 678 | * buffer to which the given source location points. |
| 679 | */ |
| 680 | CINDEX_LINKAGE void clang_getFileLocation(CXSourceLocation location, |
| 681 | CXFile *file, |
| 682 | unsigned *line, |
| 683 | unsigned *column, |
| 684 | unsigned *offset); |
| 685 | |
| 686 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 687 | * Retrieve a source location representing the first character within a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 688 | * source range. |
| 689 | */ |
| 690 | CINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range); |
| 691 | |
| 692 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 693 | * Retrieve a source location representing the last character within a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 694 | * source range. |
| 695 | */ |
| 696 | CINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range); |
| 697 | |
| 698 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 699 | * Identifies an array of ranges. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 700 | */ |
| 701 | typedef struct { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 702 | /** The number of ranges in the \c ranges array. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 703 | unsigned count; |
| 704 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 705 | * An array of \c CXSourceRanges. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 706 | */ |
| 707 | CXSourceRange *ranges; |
| 708 | } CXSourceRangeList; |
| 709 | |
| 710 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 711 | * Retrieve all ranges that were skipped by the preprocessor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 712 | * |
| 713 | * The preprocessor will skip lines when they are surrounded by an |
| 714 | * if/ifdef/ifndef directive whose condition does not evaluate to true. |
| 715 | */ |
| 716 | CINDEX_LINKAGE CXSourceRangeList *clang_getSkippedRanges(CXTranslationUnit tu, |
| 717 | CXFile file); |
| 718 | |
| 719 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 720 | * Retrieve all ranges from all files that were skipped by the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 721 | * preprocessor. |
| 722 | * |
| 723 | * The preprocessor will skip lines when they are surrounded by an |
| 724 | * if/ifdef/ifndef directive whose condition does not evaluate to true. |
| 725 | */ |
| 726 | CINDEX_LINKAGE CXSourceRangeList *clang_getAllSkippedRanges(CXTranslationUnit tu); |
| 727 | |
| 728 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 729 | * Destroy the given \c CXSourceRangeList. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 730 | */ |
| 731 | CINDEX_LINKAGE void clang_disposeSourceRangeList(CXSourceRangeList *ranges); |
| 732 | |
| 733 | /** |
| 734 | * @} |
| 735 | */ |
| 736 | |
| 737 | /** |
| 738 | * \defgroup CINDEX_DIAG Diagnostic reporting |
| 739 | * |
| 740 | * @{ |
| 741 | */ |
| 742 | |
| 743 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 744 | * Describes the severity of a particular diagnostic. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 745 | */ |
| 746 | enum CXDiagnosticSeverity { |
| 747 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 748 | * A diagnostic that has been suppressed, e.g., by a command-line |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 749 | * option. |
| 750 | */ |
| 751 | CXDiagnostic_Ignored = 0, |
| 752 | |
| 753 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 754 | * This diagnostic is a note that should be attached to the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 755 | * previous (non-note) diagnostic. |
| 756 | */ |
| 757 | CXDiagnostic_Note = 1, |
| 758 | |
| 759 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 760 | * This diagnostic indicates suspicious code that may not be |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 761 | * wrong. |
| 762 | */ |
| 763 | CXDiagnostic_Warning = 2, |
| 764 | |
| 765 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 766 | * This diagnostic indicates that the code is ill-formed. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 767 | */ |
| 768 | CXDiagnostic_Error = 3, |
| 769 | |
| 770 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 771 | * This diagnostic indicates that the code is ill-formed such |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 772 | * that future parser recovery is unlikely to produce useful |
| 773 | * results. |
| 774 | */ |
| 775 | CXDiagnostic_Fatal = 4 |
| 776 | }; |
| 777 | |
| 778 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 779 | * A single diagnostic, containing the diagnostic's severity, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 780 | * location, text, source ranges, and fix-it hints. |
| 781 | */ |
| 782 | typedef void *CXDiagnostic; |
| 783 | |
| 784 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 785 | * A group of CXDiagnostics. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 786 | */ |
| 787 | typedef void *CXDiagnosticSet; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 788 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 789 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 790 | * Determine the number of diagnostics in a CXDiagnosticSet. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 791 | */ |
| 792 | CINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags); |
| 793 | |
| 794 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 795 | * Retrieve a diagnostic associated with the given CXDiagnosticSet. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 796 | * |
| 797 | * \param Diags the CXDiagnosticSet to query. |
| 798 | * \param Index the zero-based diagnostic number to retrieve. |
| 799 | * |
| 800 | * \returns the requested diagnostic. This diagnostic must be freed |
| 801 | * via a call to \c clang_disposeDiagnostic(). |
| 802 | */ |
| 803 | CINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 804 | unsigned Index); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 805 | |
| 806 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 807 | * Describes the kind of error that occurred (if any) in a call to |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 808 | * \c clang_loadDiagnostics. |
| 809 | */ |
| 810 | enum CXLoadDiag_Error { |
| 811 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 812 | * Indicates that no error occurred. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 813 | */ |
| 814 | CXLoadDiag_None = 0, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 815 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 816 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 817 | * Indicates that an unknown error occurred while attempting to |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 818 | * deserialize diagnostics. |
| 819 | */ |
| 820 | CXLoadDiag_Unknown = 1, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 821 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 822 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 823 | * Indicates that the file containing the serialized diagnostics |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 824 | * could not be opened. |
| 825 | */ |
| 826 | CXLoadDiag_CannotLoad = 2, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 827 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 828 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 829 | * Indicates that the serialized diagnostics file is invalid or |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 830 | * corrupt. |
| 831 | */ |
| 832 | CXLoadDiag_InvalidFile = 3 |
| 833 | }; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 834 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 835 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 836 | * Deserialize a set of diagnostics from a Clang diagnostics bitcode |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 837 | * file. |
| 838 | * |
| 839 | * \param file The name of the file to deserialize. |
| 840 | * \param error A pointer to a enum value recording if there was a problem |
| 841 | * deserializing the diagnostics. |
| 842 | * \param errorString A pointer to a CXString for recording the error string |
| 843 | * if the file was not successfully loaded. |
| 844 | * |
| 845 | * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise. These |
| 846 | * diagnostics should be released using clang_disposeDiagnosticSet(). |
| 847 | */ |
| 848 | CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file, |
| 849 | enum CXLoadDiag_Error *error, |
| 850 | CXString *errorString); |
| 851 | |
| 852 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 853 | * Release a CXDiagnosticSet and all of its contained diagnostics. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 854 | */ |
| 855 | CINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags); |
| 856 | |
| 857 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 858 | * Retrieve the child diagnostics of a CXDiagnostic. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 859 | * |
| 860 | * This CXDiagnosticSet does not need to be released by |
| 861 | * clang_disposeDiagnosticSet. |
| 862 | */ |
| 863 | CINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D); |
| 864 | |
| 865 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 866 | * Determine the number of diagnostics produced for the given |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 867 | * translation unit. |
| 868 | */ |
| 869 | CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit); |
| 870 | |
| 871 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 872 | * Retrieve a diagnostic associated with the given translation unit. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 873 | * |
| 874 | * \param Unit the translation unit to query. |
| 875 | * \param Index the zero-based diagnostic number to retrieve. |
| 876 | * |
| 877 | * \returns the requested diagnostic. This diagnostic must be freed |
| 878 | * via a call to \c clang_disposeDiagnostic(). |
| 879 | */ |
| 880 | CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, |
| 881 | unsigned Index); |
| 882 | |
| 883 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 884 | * Retrieve the complete set of diagnostics associated with a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 885 | * translation unit. |
| 886 | * |
| 887 | * \param Unit the translation unit to query. |
| 888 | */ |
| 889 | CINDEX_LINKAGE CXDiagnosticSet |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 890 | clang_getDiagnosticSetFromTU(CXTranslationUnit Unit); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 891 | |
| 892 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 893 | * Destroy a diagnostic. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 894 | */ |
| 895 | CINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic); |
| 896 | |
| 897 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 898 | * Options to control the display of diagnostics. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 899 | * |
| 900 | * The values in this enum are meant to be combined to customize the |
| 901 | * behavior of \c clang_formatDiagnostic(). |
| 902 | */ |
| 903 | enum CXDiagnosticDisplayOptions { |
| 904 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 905 | * Display the source-location information where the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 906 | * diagnostic was located. |
| 907 | * |
| 908 | * When set, diagnostics will be prefixed by the file, line, and |
| 909 | * (optionally) column to which the diagnostic refers. For example, |
| 910 | * |
| 911 | * \code |
| 912 | * test.c:28: warning: extra tokens at end of #endif directive |
| 913 | * \endcode |
| 914 | * |
| 915 | * This option corresponds to the clang flag \c -fshow-source-location. |
| 916 | */ |
| 917 | CXDiagnostic_DisplaySourceLocation = 0x01, |
| 918 | |
| 919 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 920 | * If displaying the source-location information of the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 921 | * diagnostic, also include the column number. |
| 922 | * |
| 923 | * This option corresponds to the clang flag \c -fshow-column. |
| 924 | */ |
| 925 | CXDiagnostic_DisplayColumn = 0x02, |
| 926 | |
| 927 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 928 | * If displaying the source-location information of the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 929 | * diagnostic, also include information about source ranges in a |
| 930 | * machine-parsable format. |
| 931 | * |
| 932 | * This option corresponds to the clang flag |
| 933 | * \c -fdiagnostics-print-source-range-info. |
| 934 | */ |
| 935 | CXDiagnostic_DisplaySourceRanges = 0x04, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 936 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 937 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 938 | * Display the option name associated with this diagnostic, if any. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 939 | * |
| 940 | * The option name displayed (e.g., -Wconversion) will be placed in brackets |
| 941 | * after the diagnostic text. This option corresponds to the clang flag |
| 942 | * \c -fdiagnostics-show-option. |
| 943 | */ |
| 944 | CXDiagnostic_DisplayOption = 0x08, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 945 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 946 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 947 | * Display the category number associated with this diagnostic, if any. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 948 | * |
| 949 | * The category number is displayed within brackets after the diagnostic text. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 950 | * This option corresponds to the clang flag |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 951 | * \c -fdiagnostics-show-category=id. |
| 952 | */ |
| 953 | CXDiagnostic_DisplayCategoryId = 0x10, |
| 954 | |
| 955 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 956 | * Display the category name associated with this diagnostic, if any. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 957 | * |
| 958 | * The category name is displayed within brackets after the diagnostic text. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 959 | * This option corresponds to the clang flag |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 960 | * \c -fdiagnostics-show-category=name. |
| 961 | */ |
| 962 | CXDiagnostic_DisplayCategoryName = 0x20 |
| 963 | }; |
| 964 | |
| 965 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 966 | * Format the given diagnostic in a manner that is suitable for display. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 967 | * |
| 968 | * This routine will format the given diagnostic to a string, rendering |
| 969 | * the diagnostic according to the various options given. The |
| 970 | * \c clang_defaultDiagnosticDisplayOptions() function returns the set of |
| 971 | * options that most closely mimics the behavior of the clang compiler. |
| 972 | * |
| 973 | * \param Diagnostic The diagnostic to print. |
| 974 | * |
| 975 | * \param Options A set of options that control the diagnostic display, |
| 976 | * created by combining \c CXDiagnosticDisplayOptions values. |
| 977 | * |
| 978 | * \returns A new string containing for formatted diagnostic. |
| 979 | */ |
| 980 | CINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, |
| 981 | unsigned Options); |
| 982 | |
| 983 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 984 | * Retrieve the set of display options most similar to the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 985 | * default behavior of the clang compiler. |
| 986 | * |
| 987 | * \returns A set of display options suitable for use with \c |
| 988 | * clang_formatDiagnostic(). |
| 989 | */ |
| 990 | CINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void); |
| 991 | |
| 992 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 993 | * Determine the severity of the given diagnostic. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 994 | */ |
| 995 | CINDEX_LINKAGE enum CXDiagnosticSeverity |
| 996 | clang_getDiagnosticSeverity(CXDiagnostic); |
| 997 | |
| 998 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 999 | * Retrieve the source location of the given diagnostic. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1000 | * |
| 1001 | * This location is where Clang would print the caret ('^') when |
| 1002 | * displaying the diagnostic on the command line. |
| 1003 | */ |
| 1004 | CINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic); |
| 1005 | |
| 1006 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1007 | * Retrieve the text of the given diagnostic. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1008 | */ |
| 1009 | CINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic); |
| 1010 | |
| 1011 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1012 | * Retrieve the name of the command-line option that enabled this |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1013 | * diagnostic. |
| 1014 | * |
| 1015 | * \param Diag The diagnostic to be queried. |
| 1016 | * |
| 1017 | * \param Disable If non-NULL, will be set to the option that disables this |
| 1018 | * diagnostic (if any). |
| 1019 | * |
| 1020 | * \returns A string that contains the command-line option used to enable this |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1021 | * warning, such as "-Wconversion" or "-pedantic". |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1022 | */ |
| 1023 | CINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag, |
| 1024 | CXString *Disable); |
| 1025 | |
| 1026 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1027 | * Retrieve the category number for this diagnostic. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1028 | * |
| 1029 | * Diagnostics can be categorized into groups along with other, related |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1030 | * diagnostics (e.g., diagnostics under the same warning flag). This routine |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1031 | * retrieves the category number for the given diagnostic. |
| 1032 | * |
| 1033 | * \returns The number of the category that contains this diagnostic, or zero |
| 1034 | * if this diagnostic is uncategorized. |
| 1035 | */ |
| 1036 | CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic); |
| 1037 | |
| 1038 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1039 | * Retrieve the name of a particular diagnostic category. This |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1040 | * is now deprecated. Use clang_getDiagnosticCategoryText() |
| 1041 | * instead. |
| 1042 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1043 | * \param Category A diagnostic category number, as returned by |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1044 | * \c clang_getDiagnosticCategory(). |
| 1045 | * |
| 1046 | * \returns The name of the given diagnostic category. |
| 1047 | */ |
| 1048 | CINDEX_DEPRECATED CINDEX_LINKAGE |
| 1049 | CXString clang_getDiagnosticCategoryName(unsigned Category); |
| 1050 | |
| 1051 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1052 | * Retrieve the diagnostic category text for a given diagnostic. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1053 | * |
| 1054 | * \returns The text of the given diagnostic category. |
| 1055 | */ |
| 1056 | CINDEX_LINKAGE CXString clang_getDiagnosticCategoryText(CXDiagnostic); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1057 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1058 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1059 | * Determine the number of source ranges associated with the given |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1060 | * diagnostic. |
| 1061 | */ |
| 1062 | CINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic); |
| 1063 | |
| 1064 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1065 | * Retrieve a source range associated with the diagnostic. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1066 | * |
| 1067 | * A diagnostic's source ranges highlight important elements in the source |
| 1068 | * code. On the command line, Clang displays source ranges by |
| 1069 | * underlining them with '~' characters. |
| 1070 | * |
| 1071 | * \param Diagnostic the diagnostic whose range is being extracted. |
| 1072 | * |
| 1073 | * \param Range the zero-based index specifying which range to |
| 1074 | * |
| 1075 | * \returns the requested source range. |
| 1076 | */ |
| 1077 | CINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic, |
| 1078 | unsigned Range); |
| 1079 | |
| 1080 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1081 | * Determine the number of fix-it hints associated with the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1082 | * given diagnostic. |
| 1083 | */ |
| 1084 | CINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic); |
| 1085 | |
| 1086 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1087 | * Retrieve the replacement information for a given fix-it. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1088 | * |
| 1089 | * Fix-its are described in terms of a source range whose contents |
| 1090 | * should be replaced by a string. This approach generalizes over |
| 1091 | * three kinds of operations: removal of source code (the range covers |
| 1092 | * the code to be removed and the replacement string is empty), |
| 1093 | * replacement of source code (the range covers the code to be |
| 1094 | * replaced and the replacement string provides the new code), and |
| 1095 | * insertion (both the start and end of the range point at the |
| 1096 | * insertion location, and the replacement string provides the text to |
| 1097 | * insert). |
| 1098 | * |
| 1099 | * \param Diagnostic The diagnostic whose fix-its are being queried. |
| 1100 | * |
| 1101 | * \param FixIt The zero-based index of the fix-it. |
| 1102 | * |
| 1103 | * \param ReplacementRange The source range whose contents will be |
| 1104 | * replaced with the returned replacement string. Note that source |
| 1105 | * ranges are half-open ranges [a, b), so the source code should be |
| 1106 | * replaced from a and up to (but not including) b. |
| 1107 | * |
| 1108 | * \returns A string containing text that should be replace the source |
| 1109 | * code indicated by the \c ReplacementRange. |
| 1110 | */ |
| 1111 | CINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic, |
| 1112 | unsigned FixIt, |
| 1113 | CXSourceRange *ReplacementRange); |
| 1114 | |
| 1115 | /** |
| 1116 | * @} |
| 1117 | */ |
| 1118 | |
| 1119 | /** |
| 1120 | * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation |
| 1121 | * |
| 1122 | * The routines in this group provide the ability to create and destroy |
| 1123 | * translation units from files, either by parsing the contents of the files or |
| 1124 | * by reading in a serialized representation of a translation unit. |
| 1125 | * |
| 1126 | * @{ |
| 1127 | */ |
| 1128 | |
| 1129 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1130 | * Get the original translation unit source file name. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1131 | */ |
| 1132 | CINDEX_LINKAGE CXString |
| 1133 | clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit); |
| 1134 | |
| 1135 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1136 | * Return the CXTranslationUnit for a given source file and the provided |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1137 | * command line arguments one would pass to the compiler. |
| 1138 | * |
| 1139 | * Note: The 'source_filename' argument is optional. If the caller provides a |
| 1140 | * NULL pointer, the name of the source file is expected to reside in the |
| 1141 | * specified command line arguments. |
| 1142 | * |
| 1143 | * Note: When encountered in 'clang_command_line_args', the following options |
| 1144 | * are ignored: |
| 1145 | * |
| 1146 | * '-c' |
| 1147 | * '-emit-ast' |
| 1148 | * '-fsyntax-only' |
| 1149 | * '-o \<output file>' (both '-o' and '\<output file>' are ignored) |
| 1150 | * |
| 1151 | * \param CIdx The index object with which the translation unit will be |
| 1152 | * associated. |
| 1153 | * |
| 1154 | * \param source_filename The name of the source file to load, or NULL if the |
| 1155 | * source file is included in \p clang_command_line_args. |
| 1156 | * |
| 1157 | * \param num_clang_command_line_args The number of command-line arguments in |
| 1158 | * \p clang_command_line_args. |
| 1159 | * |
| 1160 | * \param clang_command_line_args The command-line arguments that would be |
| 1161 | * passed to the \c clang executable if it were being invoked out-of-process. |
| 1162 | * These command-line options will be parsed and will affect how the translation |
| 1163 | * unit is parsed. Note that the following options are ignored: '-c', |
| 1164 | * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. |
| 1165 | * |
| 1166 | * \param num_unsaved_files the number of unsaved file entries in \p |
| 1167 | * unsaved_files. |
| 1168 | * |
| 1169 | * \param unsaved_files the files that have not yet been saved to disk |
| 1170 | * but may be required for code completion, including the contents of |
| 1171 | * those files. The contents and name of these files (as specified by |
| 1172 | * CXUnsavedFile) are copied when necessary, so the client only needs to |
| 1173 | * guarantee their validity until the call to this function returns. |
| 1174 | */ |
| 1175 | CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile( |
| 1176 | CXIndex CIdx, |
| 1177 | const char *source_filename, |
| 1178 | int num_clang_command_line_args, |
| 1179 | const char * const *clang_command_line_args, |
| 1180 | unsigned num_unsaved_files, |
| 1181 | struct CXUnsavedFile *unsaved_files); |
| 1182 | |
| 1183 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1184 | * Same as \c clang_createTranslationUnit2, but returns |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1185 | * the \c CXTranslationUnit instead of an error code. In case of an error this |
| 1186 | * routine returns a \c NULL \c CXTranslationUnit, without further detailed |
| 1187 | * error codes. |
| 1188 | */ |
| 1189 | CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit( |
| 1190 | CXIndex CIdx, |
| 1191 | const char *ast_filename); |
| 1192 | |
| 1193 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1194 | * Create a translation unit from an AST file (\c -emit-ast). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1195 | * |
| 1196 | * \param[out] out_TU A non-NULL pointer to store the created |
| 1197 | * \c CXTranslationUnit. |
| 1198 | * |
| 1199 | * \returns Zero on success, otherwise returns an error code. |
| 1200 | */ |
| 1201 | CINDEX_LINKAGE enum CXErrorCode clang_createTranslationUnit2( |
| 1202 | CXIndex CIdx, |
| 1203 | const char *ast_filename, |
| 1204 | CXTranslationUnit *out_TU); |
| 1205 | |
| 1206 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1207 | * Flags that control the creation of translation units. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1208 | * |
| 1209 | * The enumerators in this enumeration type are meant to be bitwise |
| 1210 | * ORed together to specify which options should be used when |
| 1211 | * constructing the translation unit. |
| 1212 | */ |
| 1213 | enum CXTranslationUnit_Flags { |
| 1214 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1215 | * Used to indicate that no special translation-unit options are |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1216 | * needed. |
| 1217 | */ |
| 1218 | CXTranslationUnit_None = 0x0, |
| 1219 | |
| 1220 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1221 | * Used to indicate that the parser should construct a "detailed" |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1222 | * preprocessing record, including all macro definitions and instantiations. |
| 1223 | * |
| 1224 | * Constructing a detailed preprocessing record requires more memory |
| 1225 | * and time to parse, since the information contained in the record |
| 1226 | * is usually not retained. However, it can be useful for |
| 1227 | * applications that require more detailed information about the |
| 1228 | * behavior of the preprocessor. |
| 1229 | */ |
| 1230 | CXTranslationUnit_DetailedPreprocessingRecord = 0x01, |
| 1231 | |
| 1232 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1233 | * Used to indicate that the translation unit is incomplete. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1234 | * |
| 1235 | * When a translation unit is considered "incomplete", semantic |
| 1236 | * analysis that is typically performed at the end of the |
| 1237 | * translation unit will be suppressed. For example, this suppresses |
| 1238 | * the completion of tentative declarations in C and of |
| 1239 | * instantiation of implicitly-instantiation function templates in |
| 1240 | * C++. This option is typically used when parsing a header with the |
| 1241 | * intent of producing a precompiled header. |
| 1242 | */ |
| 1243 | CXTranslationUnit_Incomplete = 0x02, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1244 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1245 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1246 | * Used to indicate that the translation unit should be built with an |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1247 | * implicit precompiled header for the preamble. |
| 1248 | * |
| 1249 | * An implicit precompiled header is used as an optimization when a |
| 1250 | * particular translation unit is likely to be reparsed many times |
| 1251 | * when the sources aren't changing that often. In this case, an |
| 1252 | * implicit precompiled header will be built containing all of the |
| 1253 | * initial includes at the top of the main file (what we refer to as |
| 1254 | * the "preamble" of the file). In subsequent parses, if the |
| 1255 | * preamble or the files in it have not changed, \c |
| 1256 | * clang_reparseTranslationUnit() will re-use the implicit |
| 1257 | * precompiled header to improve parsing performance. |
| 1258 | */ |
| 1259 | CXTranslationUnit_PrecompiledPreamble = 0x04, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1260 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1261 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1262 | * Used to indicate that the translation unit should cache some |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1263 | * code-completion results with each reparse of the source file. |
| 1264 | * |
| 1265 | * Caching of code-completion results is a performance optimization that |
| 1266 | * introduces some overhead to reparsing but improves the performance of |
| 1267 | * code-completion operations. |
| 1268 | */ |
| 1269 | CXTranslationUnit_CacheCompletionResults = 0x08, |
| 1270 | |
| 1271 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1272 | * Used to indicate that the translation unit will be serialized with |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1273 | * \c clang_saveTranslationUnit. |
| 1274 | * |
| 1275 | * This option is typically used when parsing a header with the intent of |
| 1276 | * producing a precompiled header. |
| 1277 | */ |
| 1278 | CXTranslationUnit_ForSerialization = 0x10, |
| 1279 | |
| 1280 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1281 | * DEPRECATED: Enabled chained precompiled preambles in C++. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1282 | * |
| 1283 | * Note: this is a *temporary* option that is available only while |
| 1284 | * we are testing C++ precompiled preamble support. It is deprecated. |
| 1285 | */ |
| 1286 | CXTranslationUnit_CXXChainedPCH = 0x20, |
| 1287 | |
| 1288 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1289 | * Used to indicate that function/method bodies should be skipped while |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1290 | * parsing. |
| 1291 | * |
| 1292 | * This option can be used to search for declarations/definitions while |
| 1293 | * ignoring the usages. |
| 1294 | */ |
| 1295 | CXTranslationUnit_SkipFunctionBodies = 0x40, |
| 1296 | |
| 1297 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1298 | * Used to indicate that brief documentation comments should be |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1299 | * included into the set of code completions returned from this translation |
| 1300 | * unit. |
| 1301 | */ |
| 1302 | CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 0x80, |
| 1303 | |
| 1304 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1305 | * Used to indicate that the precompiled preamble should be created on |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1306 | * the first parse. Otherwise it will be created on the first reparse. This |
| 1307 | * trades runtime on the first parse (serializing the preamble takes time) for |
| 1308 | * reduced runtime on the second parse (can now reuse the preamble). |
| 1309 | */ |
| 1310 | CXTranslationUnit_CreatePreambleOnFirstParse = 0x100, |
| 1311 | |
| 1312 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1313 | * Do not stop processing when fatal errors are encountered. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1314 | * |
| 1315 | * When fatal errors are encountered while parsing a translation unit, |
| 1316 | * semantic analysis is typically stopped early when compiling code. A common |
| 1317 | * source for fatal errors are unresolvable include files. For the |
| 1318 | * purposes of an IDE, this is undesirable behavior and as much information |
| 1319 | * as possible should be reported. Use this flag to enable this behavior. |
| 1320 | */ |
| 1321 | CXTranslationUnit_KeepGoing = 0x200, |
| 1322 | |
| 1323 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1324 | * Sets the preprocessor in a mode for parsing a single file only. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1325 | */ |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1326 | CXTranslationUnit_SingleFileParse = 0x400, |
| 1327 | |
| 1328 | /** |
| 1329 | * Used in combination with CXTranslationUnit_SkipFunctionBodies to |
| 1330 | * constrain the skipping of function bodies to the preamble. |
| 1331 | * |
| 1332 | * The function bodies of the main file are not skipped. |
| 1333 | */ |
| 1334 | CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 0x800, |
| 1335 | |
| 1336 | /** |
| 1337 | * Used to indicate that attributed types should be included in CXType. |
| 1338 | */ |
| 1339 | CXTranslationUnit_IncludeAttributedTypes = 0x1000, |
| 1340 | |
| 1341 | /** |
| 1342 | * Used to indicate that implicit attributes should be visited. |
| 1343 | */ |
| 1344 | CXTranslationUnit_VisitImplicitAttributes = 0x2000 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1345 | }; |
| 1346 | |
| 1347 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1348 | * Returns the set of flags that is suitable for parsing a translation |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1349 | * unit that is being edited. |
| 1350 | * |
| 1351 | * The set of flags returned provide options for \c clang_parseTranslationUnit() |
| 1352 | * to indicate that the translation unit is likely to be reparsed many times, |
| 1353 | * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly |
| 1354 | * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1355 | * set contains an unspecified set of optimizations (e.g., the precompiled |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1356 | * preamble) geared toward improving the performance of these routines. The |
| 1357 | * set of optimizations enabled may change from one version to the next. |
| 1358 | */ |
| 1359 | CINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void); |
| 1360 | |
| 1361 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1362 | * Same as \c clang_parseTranslationUnit2, but returns |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1363 | * the \c CXTranslationUnit instead of an error code. In case of an error this |
| 1364 | * routine returns a \c NULL \c CXTranslationUnit, without further detailed |
| 1365 | * error codes. |
| 1366 | */ |
| 1367 | CINDEX_LINKAGE CXTranslationUnit |
| 1368 | clang_parseTranslationUnit(CXIndex CIdx, |
| 1369 | const char *source_filename, |
| 1370 | const char *const *command_line_args, |
| 1371 | int num_command_line_args, |
| 1372 | struct CXUnsavedFile *unsaved_files, |
| 1373 | unsigned num_unsaved_files, |
| 1374 | unsigned options); |
| 1375 | |
| 1376 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1377 | * Parse the given source file and the translation unit corresponding |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1378 | * to that file. |
| 1379 | * |
| 1380 | * This routine is the main entry point for the Clang C API, providing the |
| 1381 | * ability to parse a source file into a translation unit that can then be |
| 1382 | * queried by other functions in the API. This routine accepts a set of |
| 1383 | * command-line arguments so that the compilation can be configured in the same |
| 1384 | * way that the compiler is configured on the command line. |
| 1385 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1386 | * \param CIdx The index object with which the translation unit will be |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1387 | * associated. |
| 1388 | * |
| 1389 | * \param source_filename The name of the source file to load, or NULL if the |
| 1390 | * source file is included in \c command_line_args. |
| 1391 | * |
| 1392 | * \param command_line_args The command-line arguments that would be |
| 1393 | * passed to the \c clang executable if it were being invoked out-of-process. |
| 1394 | * These command-line options will be parsed and will affect how the translation |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1395 | * unit is parsed. Note that the following options are ignored: '-c', |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1396 | * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. |
| 1397 | * |
| 1398 | * \param num_command_line_args The number of command-line arguments in |
| 1399 | * \c command_line_args. |
| 1400 | * |
| 1401 | * \param unsaved_files the files that have not yet been saved to disk |
| 1402 | * but may be required for parsing, including the contents of |
| 1403 | * those files. The contents and name of these files (as specified by |
| 1404 | * CXUnsavedFile) are copied when necessary, so the client only needs to |
| 1405 | * guarantee their validity until the call to this function returns. |
| 1406 | * |
| 1407 | * \param num_unsaved_files the number of unsaved file entries in \p |
| 1408 | * unsaved_files. |
| 1409 | * |
| 1410 | * \param options A bitmask of options that affects how the translation unit |
| 1411 | * is managed but not its compilation. This should be a bitwise OR of the |
| 1412 | * CXTranslationUnit_XXX flags. |
| 1413 | * |
| 1414 | * \param[out] out_TU A non-NULL pointer to store the created |
| 1415 | * \c CXTranslationUnit, describing the parsed code and containing any |
| 1416 | * diagnostics produced by the compiler. |
| 1417 | * |
| 1418 | * \returns Zero on success, otherwise returns an error code. |
| 1419 | */ |
| 1420 | CINDEX_LINKAGE enum CXErrorCode |
| 1421 | clang_parseTranslationUnit2(CXIndex CIdx, |
| 1422 | const char *source_filename, |
| 1423 | const char *const *command_line_args, |
| 1424 | int num_command_line_args, |
| 1425 | struct CXUnsavedFile *unsaved_files, |
| 1426 | unsigned num_unsaved_files, |
| 1427 | unsigned options, |
| 1428 | CXTranslationUnit *out_TU); |
| 1429 | |
| 1430 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1431 | * Same as clang_parseTranslationUnit2 but requires a full command line |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1432 | * for \c command_line_args including argv[0]. This is useful if the standard |
| 1433 | * library paths are relative to the binary. |
| 1434 | */ |
| 1435 | CINDEX_LINKAGE enum CXErrorCode clang_parseTranslationUnit2FullArgv( |
| 1436 | CXIndex CIdx, const char *source_filename, |
| 1437 | const char *const *command_line_args, int num_command_line_args, |
| 1438 | struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files, |
| 1439 | unsigned options, CXTranslationUnit *out_TU); |
| 1440 | |
| 1441 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1442 | * Flags that control how translation units are saved. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1443 | * |
| 1444 | * The enumerators in this enumeration type are meant to be bitwise |
| 1445 | * ORed together to specify which options should be used when |
| 1446 | * saving the translation unit. |
| 1447 | */ |
| 1448 | enum CXSaveTranslationUnit_Flags { |
| 1449 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1450 | * Used to indicate that no special saving options are needed. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1451 | */ |
| 1452 | CXSaveTranslationUnit_None = 0x0 |
| 1453 | }; |
| 1454 | |
| 1455 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1456 | * Returns the set of flags that is suitable for saving a translation |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1457 | * unit. |
| 1458 | * |
| 1459 | * The set of flags returned provide options for |
| 1460 | * \c clang_saveTranslationUnit() by default. The returned flag |
| 1461 | * set contains an unspecified set of options that save translation units with |
| 1462 | * the most commonly-requested data. |
| 1463 | */ |
| 1464 | CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU); |
| 1465 | |
| 1466 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1467 | * Describes the kind of error that occurred (if any) in a call to |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1468 | * \c clang_saveTranslationUnit(). |
| 1469 | */ |
| 1470 | enum CXSaveError { |
| 1471 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1472 | * Indicates that no error occurred while saving a translation unit. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1473 | */ |
| 1474 | CXSaveError_None = 0, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1475 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1476 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1477 | * Indicates that an unknown error occurred while attempting to save |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1478 | * the file. |
| 1479 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1480 | * This error typically indicates that file I/O failed when attempting to |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1481 | * write the file. |
| 1482 | */ |
| 1483 | CXSaveError_Unknown = 1, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1484 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1485 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1486 | * Indicates that errors during translation prevented this attempt |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1487 | * to save the translation unit. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1488 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1489 | * Errors that prevent the translation unit from being saved can be |
| 1490 | * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic(). |
| 1491 | */ |
| 1492 | CXSaveError_TranslationErrors = 2, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1493 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1494 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1495 | * Indicates that the translation unit to be saved was somehow |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1496 | * invalid (e.g., NULL). |
| 1497 | */ |
| 1498 | CXSaveError_InvalidTU = 3 |
| 1499 | }; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1500 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1501 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1502 | * Saves a translation unit into a serialized representation of |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1503 | * that translation unit on disk. |
| 1504 | * |
| 1505 | * Any translation unit that was parsed without error can be saved |
| 1506 | * into a file. The translation unit can then be deserialized into a |
| 1507 | * new \c CXTranslationUnit with \c clang_createTranslationUnit() or, |
| 1508 | * if it is an incomplete translation unit that corresponds to a |
| 1509 | * header, used as a precompiled header when parsing other translation |
| 1510 | * units. |
| 1511 | * |
| 1512 | * \param TU The translation unit to save. |
| 1513 | * |
| 1514 | * \param FileName The file to which the translation unit will be saved. |
| 1515 | * |
| 1516 | * \param options A bitmask of options that affects how the translation unit |
| 1517 | * is saved. This should be a bitwise OR of the |
| 1518 | * CXSaveTranslationUnit_XXX flags. |
| 1519 | * |
| 1520 | * \returns A value that will match one of the enumerators of the CXSaveError |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1521 | * enumeration. Zero (CXSaveError_None) indicates that the translation unit was |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1522 | * saved successfully, while a non-zero value indicates that a problem occurred. |
| 1523 | */ |
| 1524 | CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU, |
| 1525 | const char *FileName, |
| 1526 | unsigned options); |
| 1527 | |
| 1528 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1529 | * Suspend a translation unit in order to free memory associated with it. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1530 | * |
| 1531 | * A suspended translation unit uses significantly less memory but on the other |
| 1532 | * side does not support any other calls than \c clang_reparseTranslationUnit |
| 1533 | * to resume it or \c clang_disposeTranslationUnit to dispose it completely. |
| 1534 | */ |
| 1535 | CINDEX_LINKAGE unsigned clang_suspendTranslationUnit(CXTranslationUnit); |
| 1536 | |
| 1537 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1538 | * Destroy the specified CXTranslationUnit object. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1539 | */ |
| 1540 | CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit); |
| 1541 | |
| 1542 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1543 | * Flags that control the reparsing of translation units. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1544 | * |
| 1545 | * The enumerators in this enumeration type are meant to be bitwise |
| 1546 | * ORed together to specify which options should be used when |
| 1547 | * reparsing the translation unit. |
| 1548 | */ |
| 1549 | enum CXReparse_Flags { |
| 1550 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1551 | * Used to indicate that no special reparsing options are needed. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1552 | */ |
| 1553 | CXReparse_None = 0x0 |
| 1554 | }; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1555 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1556 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1557 | * Returns the set of flags that is suitable for reparsing a translation |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1558 | * unit. |
| 1559 | * |
| 1560 | * The set of flags returned provide options for |
| 1561 | * \c clang_reparseTranslationUnit() by default. The returned flag |
| 1562 | * set contains an unspecified set of optimizations geared toward common uses |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1563 | * of reparsing. The set of optimizations enabled may change from one version |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1564 | * to the next. |
| 1565 | */ |
| 1566 | CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU); |
| 1567 | |
| 1568 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1569 | * Reparse the source files that produced this translation unit. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1570 | * |
| 1571 | * This routine can be used to re-parse the source files that originally |
| 1572 | * created the given translation unit, for example because those source files |
| 1573 | * have changed (either on disk or as passed via \p unsaved_files). The |
| 1574 | * source code will be reparsed with the same command-line options as it |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1575 | * was originally parsed. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1576 | * |
| 1577 | * Reparsing a translation unit invalidates all cursors and source locations |
| 1578 | * that refer into that translation unit. This makes reparsing a translation |
| 1579 | * unit semantically equivalent to destroying the translation unit and then |
| 1580 | * creating a new translation unit with the same command-line arguments. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1581 | * However, it may be more efficient to reparse a translation |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1582 | * unit using this routine. |
| 1583 | * |
| 1584 | * \param TU The translation unit whose contents will be re-parsed. The |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1585 | * translation unit must originally have been built with |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1586 | * \c clang_createTranslationUnitFromSourceFile(). |
| 1587 | * |
| 1588 | * \param num_unsaved_files The number of unsaved file entries in \p |
| 1589 | * unsaved_files. |
| 1590 | * |
| 1591 | * \param unsaved_files The files that have not yet been saved to disk |
| 1592 | * but may be required for parsing, including the contents of |
| 1593 | * those files. The contents and name of these files (as specified by |
| 1594 | * CXUnsavedFile) are copied when necessary, so the client only needs to |
| 1595 | * guarantee their validity until the call to this function returns. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1596 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1597 | * \param options A bitset of options composed of the flags in CXReparse_Flags. |
| 1598 | * The function \c clang_defaultReparseOptions() produces a default set of |
| 1599 | * options recommended for most uses, based on the translation unit. |
| 1600 | * |
| 1601 | * \returns 0 if the sources could be reparsed. A non-zero error code will be |
| 1602 | * returned if reparsing was impossible, such that the translation unit is |
| 1603 | * invalid. In such cases, the only valid call for \c TU is |
| 1604 | * \c clang_disposeTranslationUnit(TU). The error codes returned by this |
| 1605 | * routine are described by the \c CXErrorCode enum. |
| 1606 | */ |
| 1607 | CINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU, |
| 1608 | unsigned num_unsaved_files, |
| 1609 | struct CXUnsavedFile *unsaved_files, |
| 1610 | unsigned options); |
| 1611 | |
| 1612 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1613 | * Categorizes how memory is being used by a translation unit. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1614 | */ |
| 1615 | enum CXTUResourceUsageKind { |
| 1616 | CXTUResourceUsage_AST = 1, |
| 1617 | CXTUResourceUsage_Identifiers = 2, |
| 1618 | CXTUResourceUsage_Selectors = 3, |
| 1619 | CXTUResourceUsage_GlobalCompletionResults = 4, |
| 1620 | CXTUResourceUsage_SourceManagerContentCache = 5, |
| 1621 | CXTUResourceUsage_AST_SideTables = 6, |
| 1622 | CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7, |
| 1623 | CXTUResourceUsage_SourceManager_Membuffer_MMap = 8, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1624 | CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9, |
| 1625 | CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1626 | CXTUResourceUsage_Preprocessor = 11, |
| 1627 | CXTUResourceUsage_PreprocessingRecord = 12, |
| 1628 | CXTUResourceUsage_SourceManager_DataStructures = 13, |
| 1629 | CXTUResourceUsage_Preprocessor_HeaderSearch = 14, |
| 1630 | CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST, |
| 1631 | CXTUResourceUsage_MEMORY_IN_BYTES_END = |
| 1632 | CXTUResourceUsage_Preprocessor_HeaderSearch, |
| 1633 | |
| 1634 | CXTUResourceUsage_First = CXTUResourceUsage_AST, |
| 1635 | CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch |
| 1636 | }; |
| 1637 | |
| 1638 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1639 | * Returns the human-readable null-terminated C string that represents |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1640 | * the name of the memory category. This string should never be freed. |
| 1641 | */ |
| 1642 | CINDEX_LINKAGE |
| 1643 | const char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind); |
| 1644 | |
| 1645 | typedef struct CXTUResourceUsageEntry { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1646 | /* The memory usage category. */ |
| 1647 | enum CXTUResourceUsageKind kind; |
| 1648 | /* Amount of resources used. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1649 | The units will depend on the resource kind. */ |
| 1650 | unsigned long amount; |
| 1651 | } CXTUResourceUsageEntry; |
| 1652 | |
| 1653 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1654 | * The memory usage of a CXTranslationUnit, broken into categories. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1655 | */ |
| 1656 | typedef struct CXTUResourceUsage { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1657 | /* Private data member, used for queries. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1658 | void *data; |
| 1659 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1660 | /* The number of entries in the 'entries' array. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1661 | unsigned numEntries; |
| 1662 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1663 | /* An array of key-value pairs, representing the breakdown of memory |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1664 | usage. */ |
| 1665 | CXTUResourceUsageEntry *entries; |
| 1666 | |
| 1667 | } CXTUResourceUsage; |
| 1668 | |
| 1669 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1670 | * Return the memory usage of a translation unit. This object |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1671 | * should be released with clang_disposeCXTUResourceUsage(). |
| 1672 | */ |
| 1673 | CINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU); |
| 1674 | |
| 1675 | CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage); |
| 1676 | |
| 1677 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1678 | * Get target information for this translation unit. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1679 | * |
| 1680 | * The CXTargetInfo object cannot outlive the CXTranslationUnit object. |
| 1681 | */ |
| 1682 | CINDEX_LINKAGE CXTargetInfo |
| 1683 | clang_getTranslationUnitTargetInfo(CXTranslationUnit CTUnit); |
| 1684 | |
| 1685 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1686 | * Destroy the CXTargetInfo object. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1687 | */ |
| 1688 | CINDEX_LINKAGE void |
| 1689 | clang_TargetInfo_dispose(CXTargetInfo Info); |
| 1690 | |
| 1691 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1692 | * Get the normalized target triple as a string. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1693 | * |
| 1694 | * Returns the empty string in case of any error. |
| 1695 | */ |
| 1696 | CINDEX_LINKAGE CXString |
| 1697 | clang_TargetInfo_getTriple(CXTargetInfo Info); |
| 1698 | |
| 1699 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1700 | * Get the pointer width of the target in bits. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1701 | * |
| 1702 | * Returns -1 in case of error. |
| 1703 | */ |
| 1704 | CINDEX_LINKAGE int |
| 1705 | clang_TargetInfo_getPointerWidth(CXTargetInfo Info); |
| 1706 | |
| 1707 | /** |
| 1708 | * @} |
| 1709 | */ |
| 1710 | |
| 1711 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1712 | * Describes the kind of entity that a cursor refers to. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1713 | */ |
| 1714 | enum CXCursorKind { |
| 1715 | /* Declarations */ |
| 1716 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1717 | * A declaration whose specific kind is not exposed via this |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1718 | * interface. |
| 1719 | * |
| 1720 | * Unexposed declarations have the same operations as any other kind |
| 1721 | * of declaration; one can extract their location information, |
| 1722 | * spelling, find their definitions, etc. However, the specific kind |
| 1723 | * of the declaration is not reported. |
| 1724 | */ |
| 1725 | CXCursor_UnexposedDecl = 1, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1726 | /** A C or C++ struct. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1727 | CXCursor_StructDecl = 2, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1728 | /** A C or C++ union. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1729 | CXCursor_UnionDecl = 3, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1730 | /** A C++ class. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1731 | CXCursor_ClassDecl = 4, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1732 | /** An enumeration. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1733 | CXCursor_EnumDecl = 5, |
| 1734 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1735 | * A field (in C) or non-static data member (in C++) in a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1736 | * struct, union, or C++ class. |
| 1737 | */ |
| 1738 | CXCursor_FieldDecl = 6, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1739 | /** An enumerator constant. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1740 | CXCursor_EnumConstantDecl = 7, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1741 | /** A function. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1742 | CXCursor_FunctionDecl = 8, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1743 | /** A variable. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1744 | CXCursor_VarDecl = 9, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1745 | /** A function or method parameter. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1746 | CXCursor_ParmDecl = 10, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1747 | /** An Objective-C \@interface. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1748 | CXCursor_ObjCInterfaceDecl = 11, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1749 | /** An Objective-C \@interface for a category. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1750 | CXCursor_ObjCCategoryDecl = 12, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1751 | /** An Objective-C \@protocol declaration. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1752 | CXCursor_ObjCProtocolDecl = 13, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1753 | /** An Objective-C \@property declaration. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1754 | CXCursor_ObjCPropertyDecl = 14, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1755 | /** An Objective-C instance variable. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1756 | CXCursor_ObjCIvarDecl = 15, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1757 | /** An Objective-C instance method. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1758 | CXCursor_ObjCInstanceMethodDecl = 16, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1759 | /** An Objective-C class method. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1760 | CXCursor_ObjCClassMethodDecl = 17, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1761 | /** An Objective-C \@implementation. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1762 | CXCursor_ObjCImplementationDecl = 18, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1763 | /** An Objective-C \@implementation for a category. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1764 | CXCursor_ObjCCategoryImplDecl = 19, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1765 | /** A typedef. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1766 | CXCursor_TypedefDecl = 20, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1767 | /** A C++ class method. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1768 | CXCursor_CXXMethod = 21, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1769 | /** A C++ namespace. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1770 | CXCursor_Namespace = 22, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1771 | /** A linkage specification, e.g. 'extern "C"'. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1772 | CXCursor_LinkageSpec = 23, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1773 | /** A C++ constructor. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1774 | CXCursor_Constructor = 24, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1775 | /** A C++ destructor. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1776 | CXCursor_Destructor = 25, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1777 | /** A C++ conversion function. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1778 | CXCursor_ConversionFunction = 26, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1779 | /** A C++ template type parameter. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1780 | CXCursor_TemplateTypeParameter = 27, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1781 | /** A C++ non-type template parameter. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1782 | CXCursor_NonTypeTemplateParameter = 28, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1783 | /** A C++ template template parameter. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1784 | CXCursor_TemplateTemplateParameter = 29, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1785 | /** A C++ function template. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1786 | CXCursor_FunctionTemplate = 30, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1787 | /** A C++ class template. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1788 | CXCursor_ClassTemplate = 31, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1789 | /** A C++ class template partial specialization. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1790 | CXCursor_ClassTemplatePartialSpecialization = 32, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1791 | /** A C++ namespace alias declaration. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1792 | CXCursor_NamespaceAlias = 33, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1793 | /** A C++ using directive. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1794 | CXCursor_UsingDirective = 34, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1795 | /** A C++ using declaration. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1796 | CXCursor_UsingDeclaration = 35, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1797 | /** A C++ alias declaration */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1798 | CXCursor_TypeAliasDecl = 36, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1799 | /** An Objective-C \@synthesize definition. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1800 | CXCursor_ObjCSynthesizeDecl = 37, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1801 | /** An Objective-C \@dynamic definition. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1802 | CXCursor_ObjCDynamicDecl = 38, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1803 | /** An access specifier. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1804 | CXCursor_CXXAccessSpecifier = 39, |
| 1805 | |
| 1806 | CXCursor_FirstDecl = CXCursor_UnexposedDecl, |
| 1807 | CXCursor_LastDecl = CXCursor_CXXAccessSpecifier, |
| 1808 | |
| 1809 | /* References */ |
| 1810 | CXCursor_FirstRef = 40, /* Decl references */ |
| 1811 | CXCursor_ObjCSuperClassRef = 40, |
| 1812 | CXCursor_ObjCProtocolRef = 41, |
| 1813 | CXCursor_ObjCClassRef = 42, |
| 1814 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1815 | * A reference to a type declaration. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1816 | * |
| 1817 | * A type reference occurs anywhere where a type is named but not |
| 1818 | * declared. For example, given: |
| 1819 | * |
| 1820 | * \code |
| 1821 | * typedef unsigned size_type; |
| 1822 | * size_type size; |
| 1823 | * \endcode |
| 1824 | * |
| 1825 | * The typedef is a declaration of size_type (CXCursor_TypedefDecl), |
| 1826 | * while the type of the variable "size" is referenced. The cursor |
| 1827 | * referenced by the type of size is the typedef for size_type. |
| 1828 | */ |
| 1829 | CXCursor_TypeRef = 43, |
| 1830 | CXCursor_CXXBaseSpecifier = 44, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1831 | /** |
| 1832 | * A reference to a class template, function template, template |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1833 | * template parameter, or class template partial specialization. |
| 1834 | */ |
| 1835 | CXCursor_TemplateRef = 45, |
| 1836 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1837 | * A reference to a namespace or namespace alias. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1838 | */ |
| 1839 | CXCursor_NamespaceRef = 46, |
| 1840 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1841 | * A reference to a member of a struct, union, or class that occurs in |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1842 | * some non-expression context, e.g., a designated initializer. |
| 1843 | */ |
| 1844 | CXCursor_MemberRef = 47, |
| 1845 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1846 | * A reference to a labeled statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1847 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1848 | * This cursor kind is used to describe the jump to "start_over" in the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1849 | * goto statement in the following example: |
| 1850 | * |
| 1851 | * \code |
| 1852 | * start_over: |
| 1853 | * ++counter; |
| 1854 | * |
| 1855 | * goto start_over; |
| 1856 | * \endcode |
| 1857 | * |
| 1858 | * A label reference cursor refers to a label statement. |
| 1859 | */ |
| 1860 | CXCursor_LabelRef = 48, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1861 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1862 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1863 | * A reference to a set of overloaded functions or function templates |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1864 | * that has not yet been resolved to a specific function or function template. |
| 1865 | * |
| 1866 | * An overloaded declaration reference cursor occurs in C++ templates where |
| 1867 | * a dependent name refers to a function. For example: |
| 1868 | * |
| 1869 | * \code |
| 1870 | * template<typename T> void swap(T&, T&); |
| 1871 | * |
| 1872 | * struct X { ... }; |
| 1873 | * void swap(X&, X&); |
| 1874 | * |
| 1875 | * template<typename T> |
| 1876 | * void reverse(T* first, T* last) { |
| 1877 | * while (first < last - 1) { |
| 1878 | * swap(*first, *--last); |
| 1879 | * ++first; |
| 1880 | * } |
| 1881 | * } |
| 1882 | * |
| 1883 | * struct Y { }; |
| 1884 | * void swap(Y&, Y&); |
| 1885 | * \endcode |
| 1886 | * |
| 1887 | * Here, the identifier "swap" is associated with an overloaded declaration |
| 1888 | * reference. In the template definition, "swap" refers to either of the two |
| 1889 | * "swap" functions declared above, so both results will be available. At |
| 1890 | * instantiation time, "swap" may also refer to other functions found via |
| 1891 | * argument-dependent lookup (e.g., the "swap" function at the end of the |
| 1892 | * example). |
| 1893 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1894 | * The functions \c clang_getNumOverloadedDecls() and |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1895 | * \c clang_getOverloadedDecl() can be used to retrieve the definitions |
| 1896 | * referenced by this cursor. |
| 1897 | */ |
| 1898 | CXCursor_OverloadedDeclRef = 49, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1899 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1900 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1901 | * A reference to a variable that occurs in some non-expression |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1902 | * context, e.g., a C++ lambda capture list. |
| 1903 | */ |
| 1904 | CXCursor_VariableRef = 50, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1905 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1906 | CXCursor_LastRef = CXCursor_VariableRef, |
| 1907 | |
| 1908 | /* Error conditions */ |
| 1909 | CXCursor_FirstInvalid = 70, |
| 1910 | CXCursor_InvalidFile = 70, |
| 1911 | CXCursor_NoDeclFound = 71, |
| 1912 | CXCursor_NotImplemented = 72, |
| 1913 | CXCursor_InvalidCode = 73, |
| 1914 | CXCursor_LastInvalid = CXCursor_InvalidCode, |
| 1915 | |
| 1916 | /* Expressions */ |
| 1917 | CXCursor_FirstExpr = 100, |
| 1918 | |
| 1919 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1920 | * An expression whose specific kind is not exposed via this |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1921 | * interface. |
| 1922 | * |
| 1923 | * Unexposed expressions have the same operations as any other kind |
| 1924 | * of expression; one can extract their location information, |
| 1925 | * spelling, children, etc. However, the specific kind of the |
| 1926 | * expression is not reported. |
| 1927 | */ |
| 1928 | CXCursor_UnexposedExpr = 100, |
| 1929 | |
| 1930 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1931 | * An expression that refers to some value declaration, such |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1932 | * as a function, variable, or enumerator. |
| 1933 | */ |
| 1934 | CXCursor_DeclRefExpr = 101, |
| 1935 | |
| 1936 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1937 | * An expression that refers to a member of a struct, union, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1938 | * class, Objective-C class, etc. |
| 1939 | */ |
| 1940 | CXCursor_MemberRefExpr = 102, |
| 1941 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1942 | /** An expression that calls a function. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1943 | CXCursor_CallExpr = 103, |
| 1944 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1945 | /** An expression that sends a message to an Objective-C |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1946 | object or class. */ |
| 1947 | CXCursor_ObjCMessageExpr = 104, |
| 1948 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1949 | /** An expression that represents a block literal. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1950 | CXCursor_BlockExpr = 105, |
| 1951 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1952 | /** An integer literal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1953 | */ |
| 1954 | CXCursor_IntegerLiteral = 106, |
| 1955 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1956 | /** A floating point number literal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1957 | */ |
| 1958 | CXCursor_FloatingLiteral = 107, |
| 1959 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1960 | /** An imaginary number literal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1961 | */ |
| 1962 | CXCursor_ImaginaryLiteral = 108, |
| 1963 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1964 | /** A string literal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1965 | */ |
| 1966 | CXCursor_StringLiteral = 109, |
| 1967 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1968 | /** A character literal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1969 | */ |
| 1970 | CXCursor_CharacterLiteral = 110, |
| 1971 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1972 | /** A parenthesized expression, e.g. "(1)". |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1973 | * |
| 1974 | * This AST node is only formed if full location information is requested. |
| 1975 | */ |
| 1976 | CXCursor_ParenExpr = 111, |
| 1977 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1978 | /** This represents the unary-expression's (except sizeof and |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1979 | * alignof). |
| 1980 | */ |
| 1981 | CXCursor_UnaryOperator = 112, |
| 1982 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1983 | /** [C99 6.5.2.1] Array Subscripting. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1984 | */ |
| 1985 | CXCursor_ArraySubscriptExpr = 113, |
| 1986 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1987 | /** A builtin binary operation expression such as "x + y" or |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1988 | * "x <= y". |
| 1989 | */ |
| 1990 | CXCursor_BinaryOperator = 114, |
| 1991 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1992 | /** Compound assignment such as "+=". |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1993 | */ |
| 1994 | CXCursor_CompoundAssignOperator = 115, |
| 1995 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1996 | /** The ?: ternary operator. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1997 | */ |
| 1998 | CXCursor_ConditionalOperator = 116, |
| 1999 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2000 | /** An explicit cast in C (C99 6.5.4) or a C-style cast in C++ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2001 | * (C++ [expr.cast]), which uses the syntax (Type)expr. |
| 2002 | * |
| 2003 | * For example: (int)f. |
| 2004 | */ |
| 2005 | CXCursor_CStyleCastExpr = 117, |
| 2006 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2007 | /** [C99 6.5.2.5] |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2008 | */ |
| 2009 | CXCursor_CompoundLiteralExpr = 118, |
| 2010 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2011 | /** Describes an C or C++ initializer list. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2012 | */ |
| 2013 | CXCursor_InitListExpr = 119, |
| 2014 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2015 | /** The GNU address of label extension, representing &&label. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2016 | */ |
| 2017 | CXCursor_AddrLabelExpr = 120, |
| 2018 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2019 | /** This is the GNU Statement Expression extension: ({int X=4; X;}) |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2020 | */ |
| 2021 | CXCursor_StmtExpr = 121, |
| 2022 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2023 | /** Represents a C11 generic selection. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2024 | */ |
| 2025 | CXCursor_GenericSelectionExpr = 122, |
| 2026 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2027 | /** Implements the GNU __null extension, which is a name for a null |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2028 | * pointer constant that has integral type (e.g., int or long) and is the same |
| 2029 | * size and alignment as a pointer. |
| 2030 | * |
| 2031 | * The __null extension is typically only used by system headers, which define |
| 2032 | * NULL as __null in C++ rather than using 0 (which is an integer that may not |
| 2033 | * match the size of a pointer). |
| 2034 | */ |
| 2035 | CXCursor_GNUNullExpr = 123, |
| 2036 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2037 | /** C++'s static_cast<> expression. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2038 | */ |
| 2039 | CXCursor_CXXStaticCastExpr = 124, |
| 2040 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2041 | /** C++'s dynamic_cast<> expression. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2042 | */ |
| 2043 | CXCursor_CXXDynamicCastExpr = 125, |
| 2044 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2045 | /** C++'s reinterpret_cast<> expression. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2046 | */ |
| 2047 | CXCursor_CXXReinterpretCastExpr = 126, |
| 2048 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2049 | /** C++'s const_cast<> expression. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2050 | */ |
| 2051 | CXCursor_CXXConstCastExpr = 127, |
| 2052 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2053 | /** Represents an explicit C++ type conversion that uses "functional" |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2054 | * notion (C++ [expr.type.conv]). |
| 2055 | * |
| 2056 | * Example: |
| 2057 | * \code |
| 2058 | * x = int(0.5); |
| 2059 | * \endcode |
| 2060 | */ |
| 2061 | CXCursor_CXXFunctionalCastExpr = 128, |
| 2062 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2063 | /** A C++ typeid expression (C++ [expr.typeid]). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2064 | */ |
| 2065 | CXCursor_CXXTypeidExpr = 129, |
| 2066 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2067 | /** [C++ 2.13.5] C++ Boolean Literal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2068 | */ |
| 2069 | CXCursor_CXXBoolLiteralExpr = 130, |
| 2070 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2071 | /** [C++0x 2.14.7] C++ Pointer Literal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2072 | */ |
| 2073 | CXCursor_CXXNullPtrLiteralExpr = 131, |
| 2074 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2075 | /** Represents the "this" expression in C++ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2076 | */ |
| 2077 | CXCursor_CXXThisExpr = 132, |
| 2078 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2079 | /** [C++ 15] C++ Throw Expression. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2080 | * |
| 2081 | * This handles 'throw' and 'throw' assignment-expression. When |
| 2082 | * assignment-expression isn't present, Op will be null. |
| 2083 | */ |
| 2084 | CXCursor_CXXThrowExpr = 133, |
| 2085 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2086 | /** A new expression for memory allocation and constructor calls, e.g: |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2087 | * "new CXXNewExpr(foo)". |
| 2088 | */ |
| 2089 | CXCursor_CXXNewExpr = 134, |
| 2090 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2091 | /** A delete expression for memory deallocation and destructor calls, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2092 | * e.g. "delete[] pArray". |
| 2093 | */ |
| 2094 | CXCursor_CXXDeleteExpr = 135, |
| 2095 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2096 | /** A unary expression. (noexcept, sizeof, or other traits) |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2097 | */ |
| 2098 | CXCursor_UnaryExpr = 136, |
| 2099 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2100 | /** An Objective-C string literal i.e. @"foo". |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2101 | */ |
| 2102 | CXCursor_ObjCStringLiteral = 137, |
| 2103 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2104 | /** An Objective-C \@encode expression. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2105 | */ |
| 2106 | CXCursor_ObjCEncodeExpr = 138, |
| 2107 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2108 | /** An Objective-C \@selector expression. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2109 | */ |
| 2110 | CXCursor_ObjCSelectorExpr = 139, |
| 2111 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2112 | /** An Objective-C \@protocol expression. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2113 | */ |
| 2114 | CXCursor_ObjCProtocolExpr = 140, |
| 2115 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2116 | /** An Objective-C "bridged" cast expression, which casts between |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2117 | * Objective-C pointers and C pointers, transferring ownership in the process. |
| 2118 | * |
| 2119 | * \code |
| 2120 | * NSString *str = (__bridge_transfer NSString *)CFCreateString(); |
| 2121 | * \endcode |
| 2122 | */ |
| 2123 | CXCursor_ObjCBridgedCastExpr = 141, |
| 2124 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2125 | /** Represents a C++0x pack expansion that produces a sequence of |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2126 | * expressions. |
| 2127 | * |
| 2128 | * A pack expansion expression contains a pattern (which itself is an |
| 2129 | * expression) followed by an ellipsis. For example: |
| 2130 | * |
| 2131 | * \code |
| 2132 | * template<typename F, typename ...Types> |
| 2133 | * void forward(F f, Types &&...args) { |
| 2134 | * f(static_cast<Types&&>(args)...); |
| 2135 | * } |
| 2136 | * \endcode |
| 2137 | */ |
| 2138 | CXCursor_PackExpansionExpr = 142, |
| 2139 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2140 | /** Represents an expression that computes the length of a parameter |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2141 | * pack. |
| 2142 | * |
| 2143 | * \code |
| 2144 | * template<typename ...Types> |
| 2145 | * struct count { |
| 2146 | * static const unsigned value = sizeof...(Types); |
| 2147 | * }; |
| 2148 | * \endcode |
| 2149 | */ |
| 2150 | CXCursor_SizeOfPackExpr = 143, |
| 2151 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2152 | /* Represents a C++ lambda expression that produces a local function |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2153 | * object. |
| 2154 | * |
| 2155 | * \code |
| 2156 | * void abssort(float *x, unsigned N) { |
| 2157 | * std::sort(x, x + N, |
| 2158 | * [](float a, float b) { |
| 2159 | * return std::abs(a) < std::abs(b); |
| 2160 | * }); |
| 2161 | * } |
| 2162 | * \endcode |
| 2163 | */ |
| 2164 | CXCursor_LambdaExpr = 144, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2165 | |
| 2166 | /** Objective-c Boolean Literal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2167 | */ |
| 2168 | CXCursor_ObjCBoolLiteralExpr = 145, |
| 2169 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2170 | /** Represents the "self" expression in an Objective-C method. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2171 | */ |
| 2172 | CXCursor_ObjCSelfExpr = 146, |
| 2173 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2174 | /** OpenMP 4.0 [2.4, Array Section]. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2175 | */ |
| 2176 | CXCursor_OMPArraySectionExpr = 147, |
| 2177 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2178 | /** Represents an @available(...) check. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2179 | */ |
| 2180 | CXCursor_ObjCAvailabilityCheckExpr = 148, |
| 2181 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2182 | /** |
| 2183 | * Fixed point literal |
| 2184 | */ |
| 2185 | CXCursor_FixedPointLiteral = 149, |
| 2186 | |
| 2187 | CXCursor_LastExpr = CXCursor_FixedPointLiteral, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2188 | |
| 2189 | /* Statements */ |
| 2190 | CXCursor_FirstStmt = 200, |
| 2191 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2192 | * A statement whose specific kind is not exposed via this |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2193 | * interface. |
| 2194 | * |
| 2195 | * Unexposed statements have the same operations as any other kind of |
| 2196 | * statement; one can extract their location information, spelling, |
| 2197 | * children, etc. However, the specific kind of the statement is not |
| 2198 | * reported. |
| 2199 | */ |
| 2200 | CXCursor_UnexposedStmt = 200, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2201 | |
| 2202 | /** A labelled statement in a function. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2203 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2204 | * This cursor kind is used to describe the "start_over:" label statement in |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2205 | * the following example: |
| 2206 | * |
| 2207 | * \code |
| 2208 | * start_over: |
| 2209 | * ++counter; |
| 2210 | * \endcode |
| 2211 | * |
| 2212 | */ |
| 2213 | CXCursor_LabelStmt = 201, |
| 2214 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2215 | /** A group of statements like { stmt stmt }. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2216 | * |
| 2217 | * This cursor kind is used to describe compound statements, e.g. function |
| 2218 | * bodies. |
| 2219 | */ |
| 2220 | CXCursor_CompoundStmt = 202, |
| 2221 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2222 | /** A case statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2223 | */ |
| 2224 | CXCursor_CaseStmt = 203, |
| 2225 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2226 | /** A default statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2227 | */ |
| 2228 | CXCursor_DefaultStmt = 204, |
| 2229 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2230 | /** An if statement |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2231 | */ |
| 2232 | CXCursor_IfStmt = 205, |
| 2233 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2234 | /** A switch statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2235 | */ |
| 2236 | CXCursor_SwitchStmt = 206, |
| 2237 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2238 | /** A while statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2239 | */ |
| 2240 | CXCursor_WhileStmt = 207, |
| 2241 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2242 | /** A do statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2243 | */ |
| 2244 | CXCursor_DoStmt = 208, |
| 2245 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2246 | /** A for statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2247 | */ |
| 2248 | CXCursor_ForStmt = 209, |
| 2249 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2250 | /** A goto statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2251 | */ |
| 2252 | CXCursor_GotoStmt = 210, |
| 2253 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2254 | /** An indirect goto statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2255 | */ |
| 2256 | CXCursor_IndirectGotoStmt = 211, |
| 2257 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2258 | /** A continue statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2259 | */ |
| 2260 | CXCursor_ContinueStmt = 212, |
| 2261 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2262 | /** A break statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2263 | */ |
| 2264 | CXCursor_BreakStmt = 213, |
| 2265 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2266 | /** A return statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2267 | */ |
| 2268 | CXCursor_ReturnStmt = 214, |
| 2269 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2270 | /** A GCC inline assembly statement extension. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2271 | */ |
| 2272 | CXCursor_GCCAsmStmt = 215, |
| 2273 | CXCursor_AsmStmt = CXCursor_GCCAsmStmt, |
| 2274 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2275 | /** Objective-C's overall \@try-\@catch-\@finally statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2276 | */ |
| 2277 | CXCursor_ObjCAtTryStmt = 216, |
| 2278 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2279 | /** Objective-C's \@catch statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2280 | */ |
| 2281 | CXCursor_ObjCAtCatchStmt = 217, |
| 2282 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2283 | /** Objective-C's \@finally statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2284 | */ |
| 2285 | CXCursor_ObjCAtFinallyStmt = 218, |
| 2286 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2287 | /** Objective-C's \@throw statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2288 | */ |
| 2289 | CXCursor_ObjCAtThrowStmt = 219, |
| 2290 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2291 | /** Objective-C's \@synchronized statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2292 | */ |
| 2293 | CXCursor_ObjCAtSynchronizedStmt = 220, |
| 2294 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2295 | /** Objective-C's autorelease pool statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2296 | */ |
| 2297 | CXCursor_ObjCAutoreleasePoolStmt = 221, |
| 2298 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2299 | /** Objective-C's collection statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2300 | */ |
| 2301 | CXCursor_ObjCForCollectionStmt = 222, |
| 2302 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2303 | /** C++'s catch statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2304 | */ |
| 2305 | CXCursor_CXXCatchStmt = 223, |
| 2306 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2307 | /** C++'s try statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2308 | */ |
| 2309 | CXCursor_CXXTryStmt = 224, |
| 2310 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2311 | /** C++'s for (* : *) statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2312 | */ |
| 2313 | CXCursor_CXXForRangeStmt = 225, |
| 2314 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2315 | /** Windows Structured Exception Handling's try statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2316 | */ |
| 2317 | CXCursor_SEHTryStmt = 226, |
| 2318 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2319 | /** Windows Structured Exception Handling's except statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2320 | */ |
| 2321 | CXCursor_SEHExceptStmt = 227, |
| 2322 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2323 | /** Windows Structured Exception Handling's finally statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2324 | */ |
| 2325 | CXCursor_SEHFinallyStmt = 228, |
| 2326 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2327 | /** A MS inline assembly statement extension. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2328 | */ |
| 2329 | CXCursor_MSAsmStmt = 229, |
| 2330 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2331 | /** The null statement ";": C99 6.8.3p3. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2332 | * |
| 2333 | * This cursor kind is used to describe the null statement. |
| 2334 | */ |
| 2335 | CXCursor_NullStmt = 230, |
| 2336 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2337 | /** Adaptor class for mixing declarations with statements and |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2338 | * expressions. |
| 2339 | */ |
| 2340 | CXCursor_DeclStmt = 231, |
| 2341 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2342 | /** OpenMP parallel directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2343 | */ |
| 2344 | CXCursor_OMPParallelDirective = 232, |
| 2345 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2346 | /** OpenMP SIMD directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2347 | */ |
| 2348 | CXCursor_OMPSimdDirective = 233, |
| 2349 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2350 | /** OpenMP for directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2351 | */ |
| 2352 | CXCursor_OMPForDirective = 234, |
| 2353 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2354 | /** OpenMP sections directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2355 | */ |
| 2356 | CXCursor_OMPSectionsDirective = 235, |
| 2357 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2358 | /** OpenMP section directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2359 | */ |
| 2360 | CXCursor_OMPSectionDirective = 236, |
| 2361 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2362 | /** OpenMP single directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2363 | */ |
| 2364 | CXCursor_OMPSingleDirective = 237, |
| 2365 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2366 | /** OpenMP parallel for directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2367 | */ |
| 2368 | CXCursor_OMPParallelForDirective = 238, |
| 2369 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2370 | /** OpenMP parallel sections directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2371 | */ |
| 2372 | CXCursor_OMPParallelSectionsDirective = 239, |
| 2373 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2374 | /** OpenMP task directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2375 | */ |
| 2376 | CXCursor_OMPTaskDirective = 240, |
| 2377 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2378 | /** OpenMP master directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2379 | */ |
| 2380 | CXCursor_OMPMasterDirective = 241, |
| 2381 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2382 | /** OpenMP critical directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2383 | */ |
| 2384 | CXCursor_OMPCriticalDirective = 242, |
| 2385 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2386 | /** OpenMP taskyield directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2387 | */ |
| 2388 | CXCursor_OMPTaskyieldDirective = 243, |
| 2389 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2390 | /** OpenMP barrier directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2391 | */ |
| 2392 | CXCursor_OMPBarrierDirective = 244, |
| 2393 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2394 | /** OpenMP taskwait directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2395 | */ |
| 2396 | CXCursor_OMPTaskwaitDirective = 245, |
| 2397 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2398 | /** OpenMP flush directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2399 | */ |
| 2400 | CXCursor_OMPFlushDirective = 246, |
| 2401 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2402 | /** Windows Structured Exception Handling's leave statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2403 | */ |
| 2404 | CXCursor_SEHLeaveStmt = 247, |
| 2405 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2406 | /** OpenMP ordered directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2407 | */ |
| 2408 | CXCursor_OMPOrderedDirective = 248, |
| 2409 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2410 | /** OpenMP atomic directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2411 | */ |
| 2412 | CXCursor_OMPAtomicDirective = 249, |
| 2413 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2414 | /** OpenMP for SIMD directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2415 | */ |
| 2416 | CXCursor_OMPForSimdDirective = 250, |
| 2417 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2418 | /** OpenMP parallel for SIMD directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2419 | */ |
| 2420 | CXCursor_OMPParallelForSimdDirective = 251, |
| 2421 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2422 | /** OpenMP target directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2423 | */ |
| 2424 | CXCursor_OMPTargetDirective = 252, |
| 2425 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2426 | /** OpenMP teams directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2427 | */ |
| 2428 | CXCursor_OMPTeamsDirective = 253, |
| 2429 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2430 | /** OpenMP taskgroup directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2431 | */ |
| 2432 | CXCursor_OMPTaskgroupDirective = 254, |
| 2433 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2434 | /** OpenMP cancellation point directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2435 | */ |
| 2436 | CXCursor_OMPCancellationPointDirective = 255, |
| 2437 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2438 | /** OpenMP cancel directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2439 | */ |
| 2440 | CXCursor_OMPCancelDirective = 256, |
| 2441 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2442 | /** OpenMP target data directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2443 | */ |
| 2444 | CXCursor_OMPTargetDataDirective = 257, |
| 2445 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2446 | /** OpenMP taskloop directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2447 | */ |
| 2448 | CXCursor_OMPTaskLoopDirective = 258, |
| 2449 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2450 | /** OpenMP taskloop simd directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2451 | */ |
| 2452 | CXCursor_OMPTaskLoopSimdDirective = 259, |
| 2453 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2454 | /** OpenMP distribute directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2455 | */ |
| 2456 | CXCursor_OMPDistributeDirective = 260, |
| 2457 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2458 | /** OpenMP target enter data directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2459 | */ |
| 2460 | CXCursor_OMPTargetEnterDataDirective = 261, |
| 2461 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2462 | /** OpenMP target exit data directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2463 | */ |
| 2464 | CXCursor_OMPTargetExitDataDirective = 262, |
| 2465 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2466 | /** OpenMP target parallel directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2467 | */ |
| 2468 | CXCursor_OMPTargetParallelDirective = 263, |
| 2469 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2470 | /** OpenMP target parallel for directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2471 | */ |
| 2472 | CXCursor_OMPTargetParallelForDirective = 264, |
| 2473 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2474 | /** OpenMP target update directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2475 | */ |
| 2476 | CXCursor_OMPTargetUpdateDirective = 265, |
| 2477 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2478 | /** OpenMP distribute parallel for directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2479 | */ |
| 2480 | CXCursor_OMPDistributeParallelForDirective = 266, |
| 2481 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2482 | /** OpenMP distribute parallel for simd directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2483 | */ |
| 2484 | CXCursor_OMPDistributeParallelForSimdDirective = 267, |
| 2485 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2486 | /** OpenMP distribute simd directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2487 | */ |
| 2488 | CXCursor_OMPDistributeSimdDirective = 268, |
| 2489 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2490 | /** OpenMP target parallel for simd directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2491 | */ |
| 2492 | CXCursor_OMPTargetParallelForSimdDirective = 269, |
| 2493 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2494 | /** OpenMP target simd directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2495 | */ |
| 2496 | CXCursor_OMPTargetSimdDirective = 270, |
| 2497 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2498 | /** OpenMP teams distribute directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2499 | */ |
| 2500 | CXCursor_OMPTeamsDistributeDirective = 271, |
| 2501 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2502 | /** OpenMP teams distribute simd directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2503 | */ |
| 2504 | CXCursor_OMPTeamsDistributeSimdDirective = 272, |
| 2505 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2506 | /** OpenMP teams distribute parallel for simd directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2507 | */ |
| 2508 | CXCursor_OMPTeamsDistributeParallelForSimdDirective = 273, |
| 2509 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2510 | /** OpenMP teams distribute parallel for directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2511 | */ |
| 2512 | CXCursor_OMPTeamsDistributeParallelForDirective = 274, |
| 2513 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2514 | /** OpenMP target teams directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2515 | */ |
| 2516 | CXCursor_OMPTargetTeamsDirective = 275, |
| 2517 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2518 | /** OpenMP target teams distribute directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2519 | */ |
| 2520 | CXCursor_OMPTargetTeamsDistributeDirective = 276, |
| 2521 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2522 | /** OpenMP target teams distribute parallel for directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2523 | */ |
| 2524 | CXCursor_OMPTargetTeamsDistributeParallelForDirective = 277, |
| 2525 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2526 | /** OpenMP target teams distribute parallel for simd directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2527 | */ |
| 2528 | CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective = 278, |
| 2529 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2530 | /** OpenMP target teams distribute simd directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2531 | */ |
| 2532 | CXCursor_OMPTargetTeamsDistributeSimdDirective = 279, |
| 2533 | |
| 2534 | CXCursor_LastStmt = CXCursor_OMPTargetTeamsDistributeSimdDirective, |
| 2535 | |
| 2536 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2537 | * Cursor that represents the translation unit itself. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2538 | * |
| 2539 | * The translation unit cursor exists primarily to act as the root |
| 2540 | * cursor for traversing the contents of a translation unit. |
| 2541 | */ |
| 2542 | CXCursor_TranslationUnit = 300, |
| 2543 | |
| 2544 | /* Attributes */ |
| 2545 | CXCursor_FirstAttr = 400, |
| 2546 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2547 | * An attribute whose specific kind is not exposed via this |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2548 | * interface. |
| 2549 | */ |
| 2550 | CXCursor_UnexposedAttr = 400, |
| 2551 | |
| 2552 | CXCursor_IBActionAttr = 401, |
| 2553 | CXCursor_IBOutletAttr = 402, |
| 2554 | CXCursor_IBOutletCollectionAttr = 403, |
| 2555 | CXCursor_CXXFinalAttr = 404, |
| 2556 | CXCursor_CXXOverrideAttr = 405, |
| 2557 | CXCursor_AnnotateAttr = 406, |
| 2558 | CXCursor_AsmLabelAttr = 407, |
| 2559 | CXCursor_PackedAttr = 408, |
| 2560 | CXCursor_PureAttr = 409, |
| 2561 | CXCursor_ConstAttr = 410, |
| 2562 | CXCursor_NoDuplicateAttr = 411, |
| 2563 | CXCursor_CUDAConstantAttr = 412, |
| 2564 | CXCursor_CUDADeviceAttr = 413, |
| 2565 | CXCursor_CUDAGlobalAttr = 414, |
| 2566 | CXCursor_CUDAHostAttr = 415, |
| 2567 | CXCursor_CUDASharedAttr = 416, |
| 2568 | CXCursor_VisibilityAttr = 417, |
| 2569 | CXCursor_DLLExport = 418, |
| 2570 | CXCursor_DLLImport = 419, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2571 | CXCursor_NSReturnsRetained = 420, |
| 2572 | CXCursor_NSReturnsNotRetained = 421, |
| 2573 | CXCursor_NSReturnsAutoreleased = 422, |
| 2574 | CXCursor_NSConsumesSelf = 423, |
| 2575 | CXCursor_NSConsumed = 424, |
| 2576 | CXCursor_ObjCException = 425, |
| 2577 | CXCursor_ObjCNSObject = 426, |
| 2578 | CXCursor_ObjCIndependentClass = 427, |
| 2579 | CXCursor_ObjCPreciseLifetime = 428, |
| 2580 | CXCursor_ObjCReturnsInnerPointer = 429, |
| 2581 | CXCursor_ObjCRequiresSuper = 430, |
| 2582 | CXCursor_ObjCRootClass = 431, |
| 2583 | CXCursor_ObjCSubclassingRestricted = 432, |
| 2584 | CXCursor_ObjCExplicitProtocolImpl = 433, |
| 2585 | CXCursor_ObjCDesignatedInitializer = 434, |
| 2586 | CXCursor_ObjCRuntimeVisible = 435, |
| 2587 | CXCursor_ObjCBoxable = 436, |
| 2588 | CXCursor_FlagEnum = 437, |
| 2589 | CXCursor_LastAttr = CXCursor_FlagEnum, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2590 | |
| 2591 | /* Preprocessing */ |
| 2592 | CXCursor_PreprocessingDirective = 500, |
| 2593 | CXCursor_MacroDefinition = 501, |
| 2594 | CXCursor_MacroExpansion = 502, |
| 2595 | CXCursor_MacroInstantiation = CXCursor_MacroExpansion, |
| 2596 | CXCursor_InclusionDirective = 503, |
| 2597 | CXCursor_FirstPreprocessing = CXCursor_PreprocessingDirective, |
| 2598 | CXCursor_LastPreprocessing = CXCursor_InclusionDirective, |
| 2599 | |
| 2600 | /* Extra Declarations */ |
| 2601 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2602 | * A module import declaration. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2603 | */ |
| 2604 | CXCursor_ModuleImportDecl = 600, |
| 2605 | CXCursor_TypeAliasTemplateDecl = 601, |
| 2606 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2607 | * A static_assert or _Static_assert node |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2608 | */ |
| 2609 | CXCursor_StaticAssert = 602, |
| 2610 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2611 | * a friend declaration. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2612 | */ |
| 2613 | CXCursor_FriendDecl = 603, |
| 2614 | CXCursor_FirstExtraDecl = CXCursor_ModuleImportDecl, |
| 2615 | CXCursor_LastExtraDecl = CXCursor_FriendDecl, |
| 2616 | |
| 2617 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2618 | * A code completion overload candidate. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2619 | */ |
| 2620 | CXCursor_OverloadCandidate = 700 |
| 2621 | }; |
| 2622 | |
| 2623 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2624 | * A cursor representing some element in the abstract syntax tree for |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2625 | * a translation unit. |
| 2626 | * |
| 2627 | * The cursor abstraction unifies the different kinds of entities in a |
| 2628 | * program--declaration, statements, expressions, references to declarations, |
| 2629 | * etc.--under a single "cursor" abstraction with a common set of operations. |
| 2630 | * Common operation for a cursor include: getting the physical location in |
| 2631 | * a source file where the cursor points, getting the name associated with a |
| 2632 | * cursor, and retrieving cursors for any child nodes of a particular cursor. |
| 2633 | * |
| 2634 | * Cursors can be produced in two specific ways. |
| 2635 | * clang_getTranslationUnitCursor() produces a cursor for a translation unit, |
| 2636 | * from which one can use clang_visitChildren() to explore the rest of the |
| 2637 | * translation unit. clang_getCursor() maps from a physical source location |
| 2638 | * to the entity that resides at that location, allowing one to map from the |
| 2639 | * source code into the AST. |
| 2640 | */ |
| 2641 | typedef struct { |
| 2642 | enum CXCursorKind kind; |
| 2643 | int xdata; |
| 2644 | const void *data[3]; |
| 2645 | } CXCursor; |
| 2646 | |
| 2647 | /** |
| 2648 | * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations |
| 2649 | * |
| 2650 | * @{ |
| 2651 | */ |
| 2652 | |
| 2653 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2654 | * Retrieve the NULL cursor, which represents no entity. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2655 | */ |
| 2656 | CINDEX_LINKAGE CXCursor clang_getNullCursor(void); |
| 2657 | |
| 2658 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2659 | * Retrieve the cursor that represents the given translation unit. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2660 | * |
| 2661 | * The translation unit cursor can be used to start traversing the |
| 2662 | * various declarations within the given translation unit. |
| 2663 | */ |
| 2664 | CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit); |
| 2665 | |
| 2666 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2667 | * Determine whether two cursors are equivalent. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2668 | */ |
| 2669 | CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor); |
| 2670 | |
| 2671 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2672 | * Returns non-zero if \p cursor is null. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2673 | */ |
| 2674 | CINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor); |
| 2675 | |
| 2676 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2677 | * Compute a hash value for the given cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2678 | */ |
| 2679 | CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2680 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2681 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2682 | * Retrieve the kind of the given cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2683 | */ |
| 2684 | CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor); |
| 2685 | |
| 2686 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2687 | * Determine whether the given cursor kind represents a declaration. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2688 | */ |
| 2689 | CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind); |
| 2690 | |
| 2691 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2692 | * Determine whether the given declaration is invalid. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2693 | * |
| 2694 | * A declaration is invalid if it could not be parsed successfully. |
| 2695 | * |
| 2696 | * \returns non-zero if the cursor represents a declaration and it is |
| 2697 | * invalid, otherwise NULL. |
| 2698 | */ |
| 2699 | CINDEX_LINKAGE unsigned clang_isInvalidDeclaration(CXCursor); |
| 2700 | |
| 2701 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2702 | * Determine whether the given cursor kind represents a simple |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2703 | * reference. |
| 2704 | * |
| 2705 | * Note that other kinds of cursors (such as expressions) can also refer to |
| 2706 | * other cursors. Use clang_getCursorReferenced() to determine whether a |
| 2707 | * particular cursor refers to another entity. |
| 2708 | */ |
| 2709 | CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind); |
| 2710 | |
| 2711 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2712 | * Determine whether the given cursor kind represents an expression. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2713 | */ |
| 2714 | CINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind); |
| 2715 | |
| 2716 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2717 | * Determine whether the given cursor kind represents a statement. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2718 | */ |
| 2719 | CINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind); |
| 2720 | |
| 2721 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2722 | * Determine whether the given cursor kind represents an attribute. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2723 | */ |
| 2724 | CINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind); |
| 2725 | |
| 2726 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2727 | * Determine whether the given cursor has any attributes. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2728 | */ |
| 2729 | CINDEX_LINKAGE unsigned clang_Cursor_hasAttrs(CXCursor C); |
| 2730 | |
| 2731 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2732 | * Determine whether the given cursor kind represents an invalid |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2733 | * cursor. |
| 2734 | */ |
| 2735 | CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind); |
| 2736 | |
| 2737 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2738 | * Determine whether the given cursor kind represents a translation |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2739 | * unit. |
| 2740 | */ |
| 2741 | CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind); |
| 2742 | |
| 2743 | /*** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2744 | * Determine whether the given cursor represents a preprocessing |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2745 | * element, such as a preprocessor directive or macro instantiation. |
| 2746 | */ |
| 2747 | CINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2748 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2749 | /*** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2750 | * Determine whether the given cursor represents a currently |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2751 | * unexposed piece of the AST (e.g., CXCursor_UnexposedStmt). |
| 2752 | */ |
| 2753 | CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind); |
| 2754 | |
| 2755 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2756 | * Describe the linkage of the entity referred to by a cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2757 | */ |
| 2758 | enum CXLinkageKind { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2759 | /** This value indicates that no linkage information is available |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2760 | * for a provided CXCursor. */ |
| 2761 | CXLinkage_Invalid, |
| 2762 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2763 | * This is the linkage for variables, parameters, and so on that |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2764 | * have automatic storage. This covers normal (non-extern) local variables. |
| 2765 | */ |
| 2766 | CXLinkage_NoLinkage, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2767 | /** This is the linkage for static variables and static functions. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2768 | CXLinkage_Internal, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2769 | /** This is the linkage for entities with external linkage that live |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2770 | * in C++ anonymous namespaces.*/ |
| 2771 | CXLinkage_UniqueExternal, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2772 | /** This is the linkage for entities with true, external linkage. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2773 | CXLinkage_External |
| 2774 | }; |
| 2775 | |
| 2776 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2777 | * Determine the linkage of the entity referred to by a given cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2778 | */ |
| 2779 | CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor); |
| 2780 | |
| 2781 | enum CXVisibilityKind { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2782 | /** This value indicates that no visibility information is available |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2783 | * for a provided CXCursor. */ |
| 2784 | CXVisibility_Invalid, |
| 2785 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2786 | /** Symbol not seen by the linker. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2787 | CXVisibility_Hidden, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2788 | /** Symbol seen by the linker but resolves to a symbol inside this object. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2789 | CXVisibility_Protected, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2790 | /** Symbol seen by the linker and acts like a normal symbol. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2791 | CXVisibility_Default |
| 2792 | }; |
| 2793 | |
| 2794 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2795 | * Describe the visibility of the entity referred to by a cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2796 | * |
| 2797 | * This returns the default visibility if not explicitly specified by |
| 2798 | * a visibility attribute. The default visibility may be changed by |
| 2799 | * commandline arguments. |
| 2800 | * |
| 2801 | * \param cursor The cursor to query. |
| 2802 | * |
| 2803 | * \returns The visibility of the cursor. |
| 2804 | */ |
| 2805 | CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor cursor); |
| 2806 | |
| 2807 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2808 | * Determine the availability of the entity that this cursor refers to, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2809 | * taking the current target platform into account. |
| 2810 | * |
| 2811 | * \param cursor The cursor to query. |
| 2812 | * |
| 2813 | * \returns The availability of the cursor. |
| 2814 | */ |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2815 | CINDEX_LINKAGE enum CXAvailabilityKind |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2816 | clang_getCursorAvailability(CXCursor cursor); |
| 2817 | |
| 2818 | /** |
| 2819 | * Describes the availability of a given entity on a particular platform, e.g., |
| 2820 | * a particular class might only be available on Mac OS 10.7 or newer. |
| 2821 | */ |
| 2822 | typedef struct CXPlatformAvailability { |
| 2823 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2824 | * A string that describes the platform for which this structure |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2825 | * provides availability information. |
| 2826 | * |
| 2827 | * Possible values are "ios" or "macos". |
| 2828 | */ |
| 2829 | CXString Platform; |
| 2830 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2831 | * The version number in which this entity was introduced. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2832 | */ |
| 2833 | CXVersion Introduced; |
| 2834 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2835 | * The version number in which this entity was deprecated (but is |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2836 | * still available). |
| 2837 | */ |
| 2838 | CXVersion Deprecated; |
| 2839 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2840 | * The version number in which this entity was obsoleted, and therefore |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2841 | * is no longer available. |
| 2842 | */ |
| 2843 | CXVersion Obsoleted; |
| 2844 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2845 | * Whether the entity is unconditionally unavailable on this platform. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2846 | */ |
| 2847 | int Unavailable; |
| 2848 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2849 | * An optional message to provide to a user of this API, e.g., to |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2850 | * suggest replacement APIs. |
| 2851 | */ |
| 2852 | CXString Message; |
| 2853 | } CXPlatformAvailability; |
| 2854 | |
| 2855 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2856 | * Determine the availability of the entity that this cursor refers to |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2857 | * on any platforms for which availability information is known. |
| 2858 | * |
| 2859 | * \param cursor The cursor to query. |
| 2860 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2861 | * \param always_deprecated If non-NULL, will be set to indicate whether the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2862 | * entity is deprecated on all platforms. |
| 2863 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2864 | * \param deprecated_message If non-NULL, will be set to the message text |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2865 | * provided along with the unconditional deprecation of this entity. The client |
| 2866 | * is responsible for deallocating this string. |
| 2867 | * |
| 2868 | * \param always_unavailable If non-NULL, will be set to indicate whether the |
| 2869 | * entity is unavailable on all platforms. |
| 2870 | * |
| 2871 | * \param unavailable_message If non-NULL, will be set to the message text |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2872 | * provided along with the unconditional unavailability of this entity. The |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2873 | * client is responsible for deallocating this string. |
| 2874 | * |
| 2875 | * \param availability If non-NULL, an array of CXPlatformAvailability instances |
| 2876 | * that will be populated with platform availability information, up to either |
| 2877 | * the number of platforms for which availability information is available (as |
| 2878 | * returned by this function) or \c availability_size, whichever is smaller. |
| 2879 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2880 | * \param availability_size The number of elements available in the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2881 | * \c availability array. |
| 2882 | * |
| 2883 | * \returns The number of platforms (N) for which availability information is |
| 2884 | * available (which is unrelated to \c availability_size). |
| 2885 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2886 | * Note that the client is responsible for calling |
| 2887 | * \c clang_disposeCXPlatformAvailability to free each of the |
| 2888 | * platform-availability structures returned. There are |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2889 | * \c min(N, availability_size) such structures. |
| 2890 | */ |
| 2891 | CINDEX_LINKAGE int |
| 2892 | clang_getCursorPlatformAvailability(CXCursor cursor, |
| 2893 | int *always_deprecated, |
| 2894 | CXString *deprecated_message, |
| 2895 | int *always_unavailable, |
| 2896 | CXString *unavailable_message, |
| 2897 | CXPlatformAvailability *availability, |
| 2898 | int availability_size); |
| 2899 | |
| 2900 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2901 | * Free the memory associated with a \c CXPlatformAvailability structure. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2902 | */ |
| 2903 | CINDEX_LINKAGE void |
| 2904 | clang_disposeCXPlatformAvailability(CXPlatformAvailability *availability); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2905 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2906 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2907 | * Describe the "language" of the entity referred to by a cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2908 | */ |
| 2909 | enum CXLanguageKind { |
| 2910 | CXLanguage_Invalid = 0, |
| 2911 | CXLanguage_C, |
| 2912 | CXLanguage_ObjC, |
| 2913 | CXLanguage_CPlusPlus |
| 2914 | }; |
| 2915 | |
| 2916 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2917 | * Determine the "language" of the entity referred to by a given cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2918 | */ |
| 2919 | CINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor); |
| 2920 | |
| 2921 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2922 | * Describe the "thread-local storage (TLS) kind" of the declaration |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2923 | * referred to by a cursor. |
| 2924 | */ |
| 2925 | enum CXTLSKind { |
| 2926 | CXTLS_None = 0, |
| 2927 | CXTLS_Dynamic, |
| 2928 | CXTLS_Static |
| 2929 | }; |
| 2930 | |
| 2931 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2932 | * Determine the "thread-local storage (TLS) kind" of the declaration |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2933 | * referred to by a cursor. |
| 2934 | */ |
| 2935 | CINDEX_LINKAGE enum CXTLSKind clang_getCursorTLSKind(CXCursor cursor); |
| 2936 | |
| 2937 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2938 | * Returns the translation unit that a cursor originated from. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2939 | */ |
| 2940 | CINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor); |
| 2941 | |
| 2942 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2943 | * A fast container representing a set of CXCursors. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2944 | */ |
| 2945 | typedef struct CXCursorSetImpl *CXCursorSet; |
| 2946 | |
| 2947 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2948 | * Creates an empty CXCursorSet. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2949 | */ |
| 2950 | CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void); |
| 2951 | |
| 2952 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2953 | * Disposes a CXCursorSet and releases its associated memory. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2954 | */ |
| 2955 | CINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset); |
| 2956 | |
| 2957 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2958 | * Queries a CXCursorSet to see if it contains a specific CXCursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2959 | * |
| 2960 | * \returns non-zero if the set contains the specified cursor. |
| 2961 | */ |
| 2962 | CINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset, |
| 2963 | CXCursor cursor); |
| 2964 | |
| 2965 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2966 | * Inserts a CXCursor into a CXCursorSet. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2967 | * |
| 2968 | * \returns zero if the CXCursor was already in the set, and non-zero otherwise. |
| 2969 | */ |
| 2970 | CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset, |
| 2971 | CXCursor cursor); |
| 2972 | |
| 2973 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2974 | * Determine the semantic parent of the given cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2975 | * |
| 2976 | * The semantic parent of a cursor is the cursor that semantically contains |
| 2977 | * the given \p cursor. For many declarations, the lexical and semantic parents |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 2978 | * are equivalent (the lexical parent is returned by |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 2979 | * \c clang_getCursorLexicalParent()). They diverge when declarations or |
| 2980 | * definitions are provided out-of-line. For example: |
| 2981 | * |
| 2982 | * \code |
| 2983 | * class C { |
| 2984 | * void f(); |
| 2985 | * }; |
| 2986 | * |
| 2987 | * void C::f() { } |
| 2988 | * \endcode |
| 2989 | * |
| 2990 | * In the out-of-line definition of \c C::f, the semantic parent is |
| 2991 | * the class \c C, of which this function is a member. The lexical parent is |
| 2992 | * the place where the declaration actually occurs in the source code; in this |
| 2993 | * case, the definition occurs in the translation unit. In general, the |
| 2994 | * lexical parent for a given entity can change without affecting the semantics |
| 2995 | * of the program, and the lexical parent of different declarations of the |
| 2996 | * same entity may be different. Changing the semantic parent of a declaration, |
| 2997 | * on the other hand, can have a major impact on semantics, and redeclarations |
| 2998 | * of a particular entity should all have the same semantic context. |
| 2999 | * |
| 3000 | * In the example above, both declarations of \c C::f have \c C as their |
| 3001 | * semantic context, while the lexical context of the first \c C::f is \c C |
| 3002 | * and the lexical context of the second \c C::f is the translation unit. |
| 3003 | * |
| 3004 | * For global declarations, the semantic parent is the translation unit. |
| 3005 | */ |
| 3006 | CINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor); |
| 3007 | |
| 3008 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3009 | * Determine the lexical parent of the given cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3010 | * |
| 3011 | * The lexical parent of a cursor is the cursor in which the given \p cursor |
| 3012 | * was actually written. For many declarations, the lexical and semantic parents |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3013 | * are equivalent (the semantic parent is returned by |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3014 | * \c clang_getCursorSemanticParent()). They diverge when declarations or |
| 3015 | * definitions are provided out-of-line. For example: |
| 3016 | * |
| 3017 | * \code |
| 3018 | * class C { |
| 3019 | * void f(); |
| 3020 | * }; |
| 3021 | * |
| 3022 | * void C::f() { } |
| 3023 | * \endcode |
| 3024 | * |
| 3025 | * In the out-of-line definition of \c C::f, the semantic parent is |
| 3026 | * the class \c C, of which this function is a member. The lexical parent is |
| 3027 | * the place where the declaration actually occurs in the source code; in this |
| 3028 | * case, the definition occurs in the translation unit. In general, the |
| 3029 | * lexical parent for a given entity can change without affecting the semantics |
| 3030 | * of the program, and the lexical parent of different declarations of the |
| 3031 | * same entity may be different. Changing the semantic parent of a declaration, |
| 3032 | * on the other hand, can have a major impact on semantics, and redeclarations |
| 3033 | * of a particular entity should all have the same semantic context. |
| 3034 | * |
| 3035 | * In the example above, both declarations of \c C::f have \c C as their |
| 3036 | * semantic context, while the lexical context of the first \c C::f is \c C |
| 3037 | * and the lexical context of the second \c C::f is the translation unit. |
| 3038 | * |
| 3039 | * For declarations written in the global scope, the lexical parent is |
| 3040 | * the translation unit. |
| 3041 | */ |
| 3042 | CINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor); |
| 3043 | |
| 3044 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3045 | * Determine the set of methods that are overridden by the given |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3046 | * method. |
| 3047 | * |
| 3048 | * In both Objective-C and C++, a method (aka virtual member function, |
| 3049 | * in C++) can override a virtual method in a base class. For |
| 3050 | * Objective-C, a method is said to override any method in the class's |
| 3051 | * base class, its protocols, or its categories' protocols, that has the same |
| 3052 | * selector and is of the same kind (class or instance). |
| 3053 | * If no such method exists, the search continues to the class's superclass, |
| 3054 | * its protocols, and its categories, and so on. A method from an Objective-C |
| 3055 | * implementation is considered to override the same methods as its |
| 3056 | * corresponding method in the interface. |
| 3057 | * |
| 3058 | * For C++, a virtual member function overrides any virtual member |
| 3059 | * function with the same signature that occurs in its base |
| 3060 | * classes. With multiple inheritance, a virtual member function can |
| 3061 | * override several virtual member functions coming from different |
| 3062 | * base classes. |
| 3063 | * |
| 3064 | * In all cases, this function determines the immediate overridden |
| 3065 | * method, rather than all of the overridden methods. For example, if |
| 3066 | * a method is originally declared in a class A, then overridden in B |
| 3067 | * (which in inherits from A) and also in C (which inherited from B), |
| 3068 | * then the only overridden method returned from this function when |
| 3069 | * invoked on C's method will be B's method. The client may then |
| 3070 | * invoke this function again, given the previously-found overridden |
| 3071 | * methods, to map out the complete method-override set. |
| 3072 | * |
| 3073 | * \param cursor A cursor representing an Objective-C or C++ |
| 3074 | * method. This routine will compute the set of methods that this |
| 3075 | * method overrides. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3076 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3077 | * \param overridden A pointer whose pointee will be replaced with a |
| 3078 | * pointer to an array of cursors, representing the set of overridden |
| 3079 | * methods. If there are no overridden methods, the pointee will be |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3080 | * set to NULL. The pointee must be freed via a call to |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3081 | * \c clang_disposeOverriddenCursors(). |
| 3082 | * |
| 3083 | * \param num_overridden A pointer to the number of overridden |
| 3084 | * functions, will be set to the number of overridden functions in the |
| 3085 | * array pointed to by \p overridden. |
| 3086 | */ |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3087 | CINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3088 | CXCursor **overridden, |
| 3089 | unsigned *num_overridden); |
| 3090 | |
| 3091 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3092 | * Free the set of overridden cursors returned by \c |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3093 | * clang_getOverriddenCursors(). |
| 3094 | */ |
| 3095 | CINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden); |
| 3096 | |
| 3097 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3098 | * Retrieve the file that is included by the given inclusion directive |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3099 | * cursor. |
| 3100 | */ |
| 3101 | CINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3102 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3103 | /** |
| 3104 | * @} |
| 3105 | */ |
| 3106 | |
| 3107 | /** |
| 3108 | * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code |
| 3109 | * |
| 3110 | * Cursors represent a location within the Abstract Syntax Tree (AST). These |
| 3111 | * routines help map between cursors and the physical locations where the |
| 3112 | * described entities occur in the source code. The mapping is provided in |
| 3113 | * both directions, so one can map from source code to the AST and back. |
| 3114 | * |
| 3115 | * @{ |
| 3116 | */ |
| 3117 | |
| 3118 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3119 | * Map a source location to the cursor that describes the entity at that |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3120 | * location in the source code. |
| 3121 | * |
| 3122 | * clang_getCursor() maps an arbitrary source location within a translation |
| 3123 | * unit down to the most specific cursor that describes the entity at that |
| 3124 | * location. For example, given an expression \c x + y, invoking |
| 3125 | * clang_getCursor() with a source location pointing to "x" will return the |
| 3126 | * cursor for "x"; similarly for "y". If the cursor points anywhere between |
| 3127 | * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor() |
| 3128 | * will return a cursor referring to the "+" expression. |
| 3129 | * |
| 3130 | * \returns a cursor representing the entity at the given source location, or |
| 3131 | * a NULL cursor if no such entity can be found. |
| 3132 | */ |
| 3133 | CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation); |
| 3134 | |
| 3135 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3136 | * Retrieve the physical location of the source constructor referenced |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3137 | * by the given cursor. |
| 3138 | * |
| 3139 | * The location of a declaration is typically the location of the name of that |
| 3140 | * declaration, where the name of that declaration would occur if it is |
| 3141 | * unnamed, or some keyword that introduces that particular declaration. |
| 3142 | * The location of a reference is where that reference occurs within the |
| 3143 | * source code. |
| 3144 | */ |
| 3145 | CINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor); |
| 3146 | |
| 3147 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3148 | * Retrieve the physical extent of the source construct referenced by |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3149 | * the given cursor. |
| 3150 | * |
| 3151 | * The extent of a cursor starts with the file/line/column pointing at the |
| 3152 | * first character within the source construct that the cursor refers to and |
| 3153 | * ends with the last character within that source construct. For a |
| 3154 | * declaration, the extent covers the declaration itself. For a reference, |
| 3155 | * the extent covers the location of the reference (e.g., where the referenced |
| 3156 | * entity was actually used). |
| 3157 | */ |
| 3158 | CINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor); |
| 3159 | |
| 3160 | /** |
| 3161 | * @} |
| 3162 | */ |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3163 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3164 | /** |
| 3165 | * \defgroup CINDEX_TYPES Type information for CXCursors |
| 3166 | * |
| 3167 | * @{ |
| 3168 | */ |
| 3169 | |
| 3170 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3171 | * Describes the kind of type |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3172 | */ |
| 3173 | enum CXTypeKind { |
| 3174 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3175 | * Represents an invalid type (e.g., where no type is available). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3176 | */ |
| 3177 | CXType_Invalid = 0, |
| 3178 | |
| 3179 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3180 | * A type whose specific kind is not exposed via this |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3181 | * interface. |
| 3182 | */ |
| 3183 | CXType_Unexposed = 1, |
| 3184 | |
| 3185 | /* Builtin types */ |
| 3186 | CXType_Void = 2, |
| 3187 | CXType_Bool = 3, |
| 3188 | CXType_Char_U = 4, |
| 3189 | CXType_UChar = 5, |
| 3190 | CXType_Char16 = 6, |
| 3191 | CXType_Char32 = 7, |
| 3192 | CXType_UShort = 8, |
| 3193 | CXType_UInt = 9, |
| 3194 | CXType_ULong = 10, |
| 3195 | CXType_ULongLong = 11, |
| 3196 | CXType_UInt128 = 12, |
| 3197 | CXType_Char_S = 13, |
| 3198 | CXType_SChar = 14, |
| 3199 | CXType_WChar = 15, |
| 3200 | CXType_Short = 16, |
| 3201 | CXType_Int = 17, |
| 3202 | CXType_Long = 18, |
| 3203 | CXType_LongLong = 19, |
| 3204 | CXType_Int128 = 20, |
| 3205 | CXType_Float = 21, |
| 3206 | CXType_Double = 22, |
| 3207 | CXType_LongDouble = 23, |
| 3208 | CXType_NullPtr = 24, |
| 3209 | CXType_Overload = 25, |
| 3210 | CXType_Dependent = 26, |
| 3211 | CXType_ObjCId = 27, |
| 3212 | CXType_ObjCClass = 28, |
| 3213 | CXType_ObjCSel = 29, |
| 3214 | CXType_Float128 = 30, |
| 3215 | CXType_Half = 31, |
| 3216 | CXType_Float16 = 32, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3217 | CXType_ShortAccum = 33, |
| 3218 | CXType_Accum = 34, |
| 3219 | CXType_LongAccum = 35, |
| 3220 | CXType_UShortAccum = 36, |
| 3221 | CXType_UAccum = 37, |
| 3222 | CXType_ULongAccum = 38, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3223 | CXType_FirstBuiltin = CXType_Void, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3224 | CXType_LastBuiltin = CXType_ULongAccum, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3225 | |
| 3226 | CXType_Complex = 100, |
| 3227 | CXType_Pointer = 101, |
| 3228 | CXType_BlockPointer = 102, |
| 3229 | CXType_LValueReference = 103, |
| 3230 | CXType_RValueReference = 104, |
| 3231 | CXType_Record = 105, |
| 3232 | CXType_Enum = 106, |
| 3233 | CXType_Typedef = 107, |
| 3234 | CXType_ObjCInterface = 108, |
| 3235 | CXType_ObjCObjectPointer = 109, |
| 3236 | CXType_FunctionNoProto = 110, |
| 3237 | CXType_FunctionProto = 111, |
| 3238 | CXType_ConstantArray = 112, |
| 3239 | CXType_Vector = 113, |
| 3240 | CXType_IncompleteArray = 114, |
| 3241 | CXType_VariableArray = 115, |
| 3242 | CXType_DependentSizedArray = 116, |
| 3243 | CXType_MemberPointer = 117, |
| 3244 | CXType_Auto = 118, |
| 3245 | |
| 3246 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3247 | * Represents a type that was referred to using an elaborated type keyword. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3248 | * |
| 3249 | * E.g., struct S, or via a qualified name, e.g., N::M::type, or both. |
| 3250 | */ |
| 3251 | CXType_Elaborated = 119, |
| 3252 | |
| 3253 | /* OpenCL PipeType. */ |
| 3254 | CXType_Pipe = 120, |
| 3255 | |
| 3256 | /* OpenCL builtin types. */ |
| 3257 | CXType_OCLImage1dRO = 121, |
| 3258 | CXType_OCLImage1dArrayRO = 122, |
| 3259 | CXType_OCLImage1dBufferRO = 123, |
| 3260 | CXType_OCLImage2dRO = 124, |
| 3261 | CXType_OCLImage2dArrayRO = 125, |
| 3262 | CXType_OCLImage2dDepthRO = 126, |
| 3263 | CXType_OCLImage2dArrayDepthRO = 127, |
| 3264 | CXType_OCLImage2dMSAARO = 128, |
| 3265 | CXType_OCLImage2dArrayMSAARO = 129, |
| 3266 | CXType_OCLImage2dMSAADepthRO = 130, |
| 3267 | CXType_OCLImage2dArrayMSAADepthRO = 131, |
| 3268 | CXType_OCLImage3dRO = 132, |
| 3269 | CXType_OCLImage1dWO = 133, |
| 3270 | CXType_OCLImage1dArrayWO = 134, |
| 3271 | CXType_OCLImage1dBufferWO = 135, |
| 3272 | CXType_OCLImage2dWO = 136, |
| 3273 | CXType_OCLImage2dArrayWO = 137, |
| 3274 | CXType_OCLImage2dDepthWO = 138, |
| 3275 | CXType_OCLImage2dArrayDepthWO = 139, |
| 3276 | CXType_OCLImage2dMSAAWO = 140, |
| 3277 | CXType_OCLImage2dArrayMSAAWO = 141, |
| 3278 | CXType_OCLImage2dMSAADepthWO = 142, |
| 3279 | CXType_OCLImage2dArrayMSAADepthWO = 143, |
| 3280 | CXType_OCLImage3dWO = 144, |
| 3281 | CXType_OCLImage1dRW = 145, |
| 3282 | CXType_OCLImage1dArrayRW = 146, |
| 3283 | CXType_OCLImage1dBufferRW = 147, |
| 3284 | CXType_OCLImage2dRW = 148, |
| 3285 | CXType_OCLImage2dArrayRW = 149, |
| 3286 | CXType_OCLImage2dDepthRW = 150, |
| 3287 | CXType_OCLImage2dArrayDepthRW = 151, |
| 3288 | CXType_OCLImage2dMSAARW = 152, |
| 3289 | CXType_OCLImage2dArrayMSAARW = 153, |
| 3290 | CXType_OCLImage2dMSAADepthRW = 154, |
| 3291 | CXType_OCLImage2dArrayMSAADepthRW = 155, |
| 3292 | CXType_OCLImage3dRW = 156, |
| 3293 | CXType_OCLSampler = 157, |
| 3294 | CXType_OCLEvent = 158, |
| 3295 | CXType_OCLQueue = 159, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3296 | CXType_OCLReserveID = 160, |
| 3297 | |
| 3298 | CXType_ObjCObject = 161, |
| 3299 | CXType_ObjCTypeParam = 162, |
| 3300 | CXType_Attributed = 163 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3301 | }; |
| 3302 | |
| 3303 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3304 | * Describes the calling convention of a function type |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3305 | */ |
| 3306 | enum CXCallingConv { |
| 3307 | CXCallingConv_Default = 0, |
| 3308 | CXCallingConv_C = 1, |
| 3309 | CXCallingConv_X86StdCall = 2, |
| 3310 | CXCallingConv_X86FastCall = 3, |
| 3311 | CXCallingConv_X86ThisCall = 4, |
| 3312 | CXCallingConv_X86Pascal = 5, |
| 3313 | CXCallingConv_AAPCS = 6, |
| 3314 | CXCallingConv_AAPCS_VFP = 7, |
| 3315 | CXCallingConv_X86RegCall = 8, |
| 3316 | CXCallingConv_IntelOclBicc = 9, |
| 3317 | CXCallingConv_Win64 = 10, |
| 3318 | /* Alias for compatibility with older versions of API. */ |
| 3319 | CXCallingConv_X86_64Win64 = CXCallingConv_Win64, |
| 3320 | CXCallingConv_X86_64SysV = 11, |
| 3321 | CXCallingConv_X86VectorCall = 12, |
| 3322 | CXCallingConv_Swift = 13, |
| 3323 | CXCallingConv_PreserveMost = 14, |
| 3324 | CXCallingConv_PreserveAll = 15, |
| 3325 | |
| 3326 | CXCallingConv_Invalid = 100, |
| 3327 | CXCallingConv_Unexposed = 200 |
| 3328 | }; |
| 3329 | |
| 3330 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3331 | * The type of an element in the abstract syntax tree. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3332 | * |
| 3333 | */ |
| 3334 | typedef struct { |
| 3335 | enum CXTypeKind kind; |
| 3336 | void *data[2]; |
| 3337 | } CXType; |
| 3338 | |
| 3339 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3340 | * Retrieve the type of a CXCursor (if any). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3341 | */ |
| 3342 | CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C); |
| 3343 | |
| 3344 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3345 | * Pretty-print the underlying type using the rules of the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3346 | * language of the translation unit from which it came. |
| 3347 | * |
| 3348 | * If the type is invalid, an empty string is returned. |
| 3349 | */ |
| 3350 | CINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT); |
| 3351 | |
| 3352 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3353 | * Retrieve the underlying type of a typedef declaration. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3354 | * |
| 3355 | * If the cursor does not reference a typedef declaration, an invalid type is |
| 3356 | * returned. |
| 3357 | */ |
| 3358 | CINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C); |
| 3359 | |
| 3360 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3361 | * Retrieve the integer type of an enum declaration. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3362 | * |
| 3363 | * If the cursor does not reference an enum declaration, an invalid type is |
| 3364 | * returned. |
| 3365 | */ |
| 3366 | CINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C); |
| 3367 | |
| 3368 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3369 | * Retrieve the integer value of an enum constant declaration as a signed |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3370 | * long long. |
| 3371 | * |
| 3372 | * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned. |
| 3373 | * Since this is also potentially a valid constant value, the kind of the cursor |
| 3374 | * must be verified before calling this function. |
| 3375 | */ |
| 3376 | CINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C); |
| 3377 | |
| 3378 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3379 | * Retrieve the integer value of an enum constant declaration as an unsigned |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3380 | * long long. |
| 3381 | * |
| 3382 | * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned. |
| 3383 | * Since this is also potentially a valid constant value, the kind of the cursor |
| 3384 | * must be verified before calling this function. |
| 3385 | */ |
| 3386 | CINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C); |
| 3387 | |
| 3388 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3389 | * Retrieve the bit width of a bit field declaration as an integer. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3390 | * |
| 3391 | * If a cursor that is not a bit field declaration is passed in, -1 is returned. |
| 3392 | */ |
| 3393 | CINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C); |
| 3394 | |
| 3395 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3396 | * Retrieve the number of non-variadic arguments associated with a given |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3397 | * cursor. |
| 3398 | * |
| 3399 | * The number of arguments can be determined for calls as well as for |
| 3400 | * declarations of functions or methods. For other cursors -1 is returned. |
| 3401 | */ |
| 3402 | CINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C); |
| 3403 | |
| 3404 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3405 | * Retrieve the argument cursor of a function or method. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3406 | * |
| 3407 | * The argument cursor can be determined for calls as well as for declarations |
| 3408 | * of functions or methods. For other cursors and for invalid indices, an |
| 3409 | * invalid cursor is returned. |
| 3410 | */ |
| 3411 | CINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i); |
| 3412 | |
| 3413 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3414 | * Describes the kind of a template argument. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3415 | * |
| 3416 | * See the definition of llvm::clang::TemplateArgument::ArgKind for full |
| 3417 | * element descriptions. |
| 3418 | */ |
| 3419 | enum CXTemplateArgumentKind { |
| 3420 | CXTemplateArgumentKind_Null, |
| 3421 | CXTemplateArgumentKind_Type, |
| 3422 | CXTemplateArgumentKind_Declaration, |
| 3423 | CXTemplateArgumentKind_NullPtr, |
| 3424 | CXTemplateArgumentKind_Integral, |
| 3425 | CXTemplateArgumentKind_Template, |
| 3426 | CXTemplateArgumentKind_TemplateExpansion, |
| 3427 | CXTemplateArgumentKind_Expression, |
| 3428 | CXTemplateArgumentKind_Pack, |
| 3429 | /* Indicates an error case, preventing the kind from being deduced. */ |
| 3430 | CXTemplateArgumentKind_Invalid |
| 3431 | }; |
| 3432 | |
| 3433 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3434 | *Returns the number of template args of a function decl representing a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3435 | * template specialization. |
| 3436 | * |
| 3437 | * If the argument cursor cannot be converted into a template function |
| 3438 | * declaration, -1 is returned. |
| 3439 | * |
| 3440 | * For example, for the following declaration and specialization: |
| 3441 | * template <typename T, int kInt, bool kBool> |
| 3442 | * void foo() { ... } |
| 3443 | * |
| 3444 | * template <> |
| 3445 | * void foo<float, -7, true>(); |
| 3446 | * |
| 3447 | * The value 3 would be returned from this call. |
| 3448 | */ |
| 3449 | CINDEX_LINKAGE int clang_Cursor_getNumTemplateArguments(CXCursor C); |
| 3450 | |
| 3451 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3452 | * Retrieve the kind of the I'th template argument of the CXCursor C. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3453 | * |
| 3454 | * If the argument CXCursor does not represent a FunctionDecl, an invalid |
| 3455 | * template argument kind is returned. |
| 3456 | * |
| 3457 | * For example, for the following declaration and specialization: |
| 3458 | * template <typename T, int kInt, bool kBool> |
| 3459 | * void foo() { ... } |
| 3460 | * |
| 3461 | * template <> |
| 3462 | * void foo<float, -7, true>(); |
| 3463 | * |
| 3464 | * For I = 0, 1, and 2, Type, Integral, and Integral will be returned, |
| 3465 | * respectively. |
| 3466 | */ |
| 3467 | CINDEX_LINKAGE enum CXTemplateArgumentKind clang_Cursor_getTemplateArgumentKind( |
| 3468 | CXCursor C, unsigned I); |
| 3469 | |
| 3470 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3471 | * Retrieve a CXType representing the type of a TemplateArgument of a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3472 | * function decl representing a template specialization. |
| 3473 | * |
| 3474 | * If the argument CXCursor does not represent a FunctionDecl whose I'th |
| 3475 | * template argument has a kind of CXTemplateArgKind_Integral, an invalid type |
| 3476 | * is returned. |
| 3477 | * |
| 3478 | * For example, for the following declaration and specialization: |
| 3479 | * template <typename T, int kInt, bool kBool> |
| 3480 | * void foo() { ... } |
| 3481 | * |
| 3482 | * template <> |
| 3483 | * void foo<float, -7, true>(); |
| 3484 | * |
| 3485 | * If called with I = 0, "float", will be returned. |
| 3486 | * Invalid types will be returned for I == 1 or 2. |
| 3487 | */ |
| 3488 | CINDEX_LINKAGE CXType clang_Cursor_getTemplateArgumentType(CXCursor C, |
| 3489 | unsigned I); |
| 3490 | |
| 3491 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3492 | * Retrieve the value of an Integral TemplateArgument (of a function |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3493 | * decl representing a template specialization) as a signed long long. |
| 3494 | * |
| 3495 | * It is undefined to call this function on a CXCursor that does not represent a |
| 3496 | * FunctionDecl or whose I'th template argument is not an integral value. |
| 3497 | * |
| 3498 | * For example, for the following declaration and specialization: |
| 3499 | * template <typename T, int kInt, bool kBool> |
| 3500 | * void foo() { ... } |
| 3501 | * |
| 3502 | * template <> |
| 3503 | * void foo<float, -7, true>(); |
| 3504 | * |
| 3505 | * If called with I = 1 or 2, -7 or true will be returned, respectively. |
| 3506 | * For I == 0, this function's behavior is undefined. |
| 3507 | */ |
| 3508 | CINDEX_LINKAGE long long clang_Cursor_getTemplateArgumentValue(CXCursor C, |
| 3509 | unsigned I); |
| 3510 | |
| 3511 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3512 | * Retrieve the value of an Integral TemplateArgument (of a function |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3513 | * decl representing a template specialization) as an unsigned long long. |
| 3514 | * |
| 3515 | * It is undefined to call this function on a CXCursor that does not represent a |
| 3516 | * FunctionDecl or whose I'th template argument is not an integral value. |
| 3517 | * |
| 3518 | * For example, for the following declaration and specialization: |
| 3519 | * template <typename T, int kInt, bool kBool> |
| 3520 | * void foo() { ... } |
| 3521 | * |
| 3522 | * template <> |
| 3523 | * void foo<float, 2147483649, true>(); |
| 3524 | * |
| 3525 | * If called with I = 1 or 2, 2147483649 or true will be returned, respectively. |
| 3526 | * For I == 0, this function's behavior is undefined. |
| 3527 | */ |
| 3528 | CINDEX_LINKAGE unsigned long long clang_Cursor_getTemplateArgumentUnsignedValue( |
| 3529 | CXCursor C, unsigned I); |
| 3530 | |
| 3531 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3532 | * Determine whether two CXTypes represent the same type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3533 | * |
| 3534 | * \returns non-zero if the CXTypes represent the same type and |
| 3535 | * zero otherwise. |
| 3536 | */ |
| 3537 | CINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B); |
| 3538 | |
| 3539 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3540 | * Return the canonical type for a CXType. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3541 | * |
| 3542 | * Clang's type system explicitly models typedefs and all the ways |
| 3543 | * a specific type can be represented. The canonical type is the underlying |
| 3544 | * type with all the "sugar" removed. For example, if 'T' is a typedef |
| 3545 | * for 'int', the canonical type for 'T' would be 'int'. |
| 3546 | */ |
| 3547 | CINDEX_LINKAGE CXType clang_getCanonicalType(CXType T); |
| 3548 | |
| 3549 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3550 | * Determine whether a CXType has the "const" qualifier set, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3551 | * without looking through typedefs that may have added "const" at a |
| 3552 | * different level. |
| 3553 | */ |
| 3554 | CINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T); |
| 3555 | |
| 3556 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3557 | * Determine whether a CXCursor that is a macro, is |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3558 | * function like. |
| 3559 | */ |
| 3560 | CINDEX_LINKAGE unsigned clang_Cursor_isMacroFunctionLike(CXCursor C); |
| 3561 | |
| 3562 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3563 | * Determine whether a CXCursor that is a macro, is a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3564 | * builtin one. |
| 3565 | */ |
| 3566 | CINDEX_LINKAGE unsigned clang_Cursor_isMacroBuiltin(CXCursor C); |
| 3567 | |
| 3568 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3569 | * Determine whether a CXCursor that is a function declaration, is an |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3570 | * inline declaration. |
| 3571 | */ |
| 3572 | CINDEX_LINKAGE unsigned clang_Cursor_isFunctionInlined(CXCursor C); |
| 3573 | |
| 3574 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3575 | * Determine whether a CXType has the "volatile" qualifier set, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3576 | * without looking through typedefs that may have added "volatile" at |
| 3577 | * a different level. |
| 3578 | */ |
| 3579 | CINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T); |
| 3580 | |
| 3581 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3582 | * Determine whether a CXType has the "restrict" qualifier set, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3583 | * without looking through typedefs that may have added "restrict" at a |
| 3584 | * different level. |
| 3585 | */ |
| 3586 | CINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T); |
| 3587 | |
| 3588 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3589 | * Returns the address space of the given type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3590 | */ |
| 3591 | CINDEX_LINKAGE unsigned clang_getAddressSpace(CXType T); |
| 3592 | |
| 3593 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3594 | * Returns the typedef name of the given type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3595 | */ |
| 3596 | CINDEX_LINKAGE CXString clang_getTypedefName(CXType CT); |
| 3597 | |
| 3598 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3599 | * For pointer types, returns the type of the pointee. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3600 | */ |
| 3601 | CINDEX_LINKAGE CXType clang_getPointeeType(CXType T); |
| 3602 | |
| 3603 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3604 | * Return the cursor for the declaration of the given type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3605 | */ |
| 3606 | CINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T); |
| 3607 | |
| 3608 | /** |
| 3609 | * Returns the Objective-C type encoding for the specified declaration. |
| 3610 | */ |
| 3611 | CINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C); |
| 3612 | |
| 3613 | /** |
| 3614 | * Returns the Objective-C type encoding for the specified CXType. |
| 3615 | */ |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3616 | CINDEX_LINKAGE CXString clang_Type_getObjCEncoding(CXType type); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3617 | |
| 3618 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3619 | * Retrieve the spelling of a given CXTypeKind. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3620 | */ |
| 3621 | CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K); |
| 3622 | |
| 3623 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3624 | * Retrieve the calling convention associated with a function type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3625 | * |
| 3626 | * If a non-function type is passed in, CXCallingConv_Invalid is returned. |
| 3627 | */ |
| 3628 | CINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T); |
| 3629 | |
| 3630 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3631 | * Retrieve the return type associated with a function type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3632 | * |
| 3633 | * If a non-function type is passed in, an invalid type is returned. |
| 3634 | */ |
| 3635 | CINDEX_LINKAGE CXType clang_getResultType(CXType T); |
| 3636 | |
| 3637 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3638 | * Retrieve the exception specification type associated with a function type. |
| 3639 | * This is a value of type CXCursor_ExceptionSpecificationKind. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3640 | * |
| 3641 | * If a non-function type is passed in, an error code of -1 is returned. |
| 3642 | */ |
| 3643 | CINDEX_LINKAGE int clang_getExceptionSpecificationType(CXType T); |
| 3644 | |
| 3645 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3646 | * Retrieve the number of non-variadic parameters associated with a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3647 | * function type. |
| 3648 | * |
| 3649 | * If a non-function type is passed in, -1 is returned. |
| 3650 | */ |
| 3651 | CINDEX_LINKAGE int clang_getNumArgTypes(CXType T); |
| 3652 | |
| 3653 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3654 | * Retrieve the type of a parameter of a function type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3655 | * |
| 3656 | * If a non-function type is passed in or the function does not have enough |
| 3657 | * parameters, an invalid type is returned. |
| 3658 | */ |
| 3659 | CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i); |
| 3660 | |
| 3661 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3662 | * Retrieves the base type of the ObjCObjectType. |
| 3663 | * |
| 3664 | * If the type is not an ObjC object, an invalid type is returned. |
| 3665 | */ |
| 3666 | CINDEX_LINKAGE CXType clang_Type_getObjCObjectBaseType(CXType T); |
| 3667 | |
| 3668 | /** |
| 3669 | * Retrieve the number of protocol references associated with an ObjC object/id. |
| 3670 | * |
| 3671 | * If the type is not an ObjC object, 0 is returned. |
| 3672 | */ |
| 3673 | CINDEX_LINKAGE unsigned clang_Type_getNumObjCProtocolRefs(CXType T); |
| 3674 | |
| 3675 | /** |
| 3676 | * Retrieve the decl for a protocol reference for an ObjC object/id. |
| 3677 | * |
| 3678 | * If the type is not an ObjC object or there are not enough protocol |
| 3679 | * references, an invalid cursor is returned. |
| 3680 | */ |
| 3681 | CINDEX_LINKAGE CXCursor clang_Type_getObjCProtocolDecl(CXType T, unsigned i); |
| 3682 | |
| 3683 | /** |
| 3684 | * Retreive the number of type arguments associated with an ObjC object. |
| 3685 | * |
| 3686 | * If the type is not an ObjC object, 0 is returned. |
| 3687 | */ |
| 3688 | CINDEX_LINKAGE unsigned clang_Type_getNumObjCTypeArgs(CXType T); |
| 3689 | |
| 3690 | /** |
| 3691 | * Retrieve a type argument associated with an ObjC object. |
| 3692 | * |
| 3693 | * If the type is not an ObjC or the index is not valid, |
| 3694 | * an invalid type is returned. |
| 3695 | */ |
| 3696 | CINDEX_LINKAGE CXType clang_Type_getObjCTypeArg(CXType T, unsigned i); |
| 3697 | |
| 3698 | /** |
| 3699 | * Return 1 if the CXType is a variadic function type, and 0 otherwise. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3700 | */ |
| 3701 | CINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T); |
| 3702 | |
| 3703 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3704 | * Retrieve the return type associated with a given cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3705 | * |
| 3706 | * This only returns a valid type if the cursor refers to a function or method. |
| 3707 | */ |
| 3708 | CINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C); |
| 3709 | |
| 3710 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3711 | * Retrieve the exception specification type associated with a given cursor. |
| 3712 | * This is a value of type CXCursor_ExceptionSpecificationKind. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3713 | * |
| 3714 | * This only returns a valid result if the cursor refers to a function or method. |
| 3715 | */ |
| 3716 | CINDEX_LINKAGE int clang_getCursorExceptionSpecificationType(CXCursor C); |
| 3717 | |
| 3718 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3719 | * Return 1 if the CXType is a POD (plain old data) type, and 0 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3720 | * otherwise. |
| 3721 | */ |
| 3722 | CINDEX_LINKAGE unsigned clang_isPODType(CXType T); |
| 3723 | |
| 3724 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3725 | * Return the element type of an array, complex, or vector type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3726 | * |
| 3727 | * If a type is passed in that is not an array, complex, or vector type, |
| 3728 | * an invalid type is returned. |
| 3729 | */ |
| 3730 | CINDEX_LINKAGE CXType clang_getElementType(CXType T); |
| 3731 | |
| 3732 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3733 | * Return the number of elements of an array or vector type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3734 | * |
| 3735 | * If a type is passed in that is not an array or vector type, |
| 3736 | * -1 is returned. |
| 3737 | */ |
| 3738 | CINDEX_LINKAGE long long clang_getNumElements(CXType T); |
| 3739 | |
| 3740 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3741 | * Return the element type of an array type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3742 | * |
| 3743 | * If a non-array type is passed in, an invalid type is returned. |
| 3744 | */ |
| 3745 | CINDEX_LINKAGE CXType clang_getArrayElementType(CXType T); |
| 3746 | |
| 3747 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3748 | * Return the array size of a constant array. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3749 | * |
| 3750 | * If a non-array type is passed in, -1 is returned. |
| 3751 | */ |
| 3752 | CINDEX_LINKAGE long long clang_getArraySize(CXType T); |
| 3753 | |
| 3754 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3755 | * Retrieve the type named by the qualified-id. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3756 | * |
| 3757 | * If a non-elaborated type is passed in, an invalid type is returned. |
| 3758 | */ |
| 3759 | CINDEX_LINKAGE CXType clang_Type_getNamedType(CXType T); |
| 3760 | |
| 3761 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3762 | * Determine if a typedef is 'transparent' tag. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3763 | * |
| 3764 | * A typedef is considered 'transparent' if it shares a name and spelling |
| 3765 | * location with its underlying tag type, as is the case with the NS_ENUM macro. |
| 3766 | * |
| 3767 | * \returns non-zero if transparent and zero otherwise. |
| 3768 | */ |
| 3769 | CINDEX_LINKAGE unsigned clang_Type_isTransparentTagTypedef(CXType T); |
| 3770 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3771 | enum CXTypeNullabilityKind { |
| 3772 | /** |
| 3773 | * Values of this type can never be null. |
| 3774 | */ |
| 3775 | CXTypeNullability_NonNull = 0, |
| 3776 | /** |
| 3777 | * Values of this type can be null. |
| 3778 | */ |
| 3779 | CXTypeNullability_Nullable = 1, |
| 3780 | /** |
| 3781 | * Whether values of this type can be null is (explicitly) |
| 3782 | * unspecified. This captures a (fairly rare) case where we |
| 3783 | * can't conclude anything about the nullability of the type even |
| 3784 | * though it has been considered. |
| 3785 | */ |
| 3786 | CXTypeNullability_Unspecified = 2, |
| 3787 | /** |
| 3788 | * Nullability is not applicable to this type. |
| 3789 | */ |
| 3790 | CXTypeNullability_Invalid = 3 |
| 3791 | }; |
| 3792 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3793 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3794 | * Retrieve the nullability kind of a pointer type. |
| 3795 | */ |
| 3796 | CINDEX_LINKAGE enum CXTypeNullabilityKind clang_Type_getNullability(CXType T); |
| 3797 | |
| 3798 | /** |
| 3799 | * List the possible error codes for \c clang_Type_getSizeOf, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3800 | * \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and |
| 3801 | * \c clang_Cursor_getOffsetOf. |
| 3802 | * |
| 3803 | * A value of this enumeration type can be returned if the target type is not |
| 3804 | * a valid argument to sizeof, alignof or offsetof. |
| 3805 | */ |
| 3806 | enum CXTypeLayoutError { |
| 3807 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3808 | * Type is of kind CXType_Invalid. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3809 | */ |
| 3810 | CXTypeLayoutError_Invalid = -1, |
| 3811 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3812 | * The type is an incomplete Type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3813 | */ |
| 3814 | CXTypeLayoutError_Incomplete = -2, |
| 3815 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3816 | * The type is a dependent Type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3817 | */ |
| 3818 | CXTypeLayoutError_Dependent = -3, |
| 3819 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3820 | * The type is not a constant size type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3821 | */ |
| 3822 | CXTypeLayoutError_NotConstantSize = -4, |
| 3823 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3824 | * The Field name is not valid for this record. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3825 | */ |
| 3826 | CXTypeLayoutError_InvalidFieldName = -5 |
| 3827 | }; |
| 3828 | |
| 3829 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3830 | * Return the alignment of a type in bytes as per C++[expr.alignof] |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3831 | * standard. |
| 3832 | * |
| 3833 | * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. |
| 3834 | * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete |
| 3835 | * is returned. |
| 3836 | * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is |
| 3837 | * returned. |
| 3838 | * If the type declaration is not a constant size type, |
| 3839 | * CXTypeLayoutError_NotConstantSize is returned. |
| 3840 | */ |
| 3841 | CINDEX_LINKAGE long long clang_Type_getAlignOf(CXType T); |
| 3842 | |
| 3843 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3844 | * Return the class type of an member pointer type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3845 | * |
| 3846 | * If a non-member-pointer type is passed in, an invalid type is returned. |
| 3847 | */ |
| 3848 | CINDEX_LINKAGE CXType clang_Type_getClassType(CXType T); |
| 3849 | |
| 3850 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3851 | * Return the size of a type in bytes as per C++[expr.sizeof] standard. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3852 | * |
| 3853 | * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. |
| 3854 | * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete |
| 3855 | * is returned. |
| 3856 | * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is |
| 3857 | * returned. |
| 3858 | */ |
| 3859 | CINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T); |
| 3860 | |
| 3861 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3862 | * Return the offset of a field named S in a record of type T in bits |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3863 | * as it would be returned by __offsetof__ as per C++11[18.2p4] |
| 3864 | * |
| 3865 | * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid |
| 3866 | * is returned. |
| 3867 | * If the field's type declaration is an incomplete type, |
| 3868 | * CXTypeLayoutError_Incomplete is returned. |
| 3869 | * If the field's type declaration is a dependent type, |
| 3870 | * CXTypeLayoutError_Dependent is returned. |
| 3871 | * If the field's name S is not found, |
| 3872 | * CXTypeLayoutError_InvalidFieldName is returned. |
| 3873 | */ |
| 3874 | CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S); |
| 3875 | |
| 3876 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3877 | * Return the type that was modified by this attributed type. |
| 3878 | * |
| 3879 | * If the type is not an attributed type, an invalid type is returned. |
| 3880 | */ |
| 3881 | CINDEX_LINKAGE CXType clang_Type_getModifiedType(CXType T); |
| 3882 | |
| 3883 | /** |
| 3884 | * Return the offset of the field represented by the Cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3885 | * |
| 3886 | * If the cursor is not a field declaration, -1 is returned. |
| 3887 | * If the cursor semantic parent is not a record field declaration, |
| 3888 | * CXTypeLayoutError_Invalid is returned. |
| 3889 | * If the field's type declaration is an incomplete type, |
| 3890 | * CXTypeLayoutError_Incomplete is returned. |
| 3891 | * If the field's type declaration is a dependent type, |
| 3892 | * CXTypeLayoutError_Dependent is returned. |
| 3893 | * If the field's name S is not found, |
| 3894 | * CXTypeLayoutError_InvalidFieldName is returned. |
| 3895 | */ |
| 3896 | CINDEX_LINKAGE long long clang_Cursor_getOffsetOfField(CXCursor C); |
| 3897 | |
| 3898 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3899 | * Determine whether the given cursor represents an anonymous record |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3900 | * declaration. |
| 3901 | */ |
| 3902 | CINDEX_LINKAGE unsigned clang_Cursor_isAnonymous(CXCursor C); |
| 3903 | |
| 3904 | enum CXRefQualifierKind { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3905 | /** No ref-qualifier was provided. */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3906 | CXRefQualifier_None = 0, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3907 | /** An lvalue ref-qualifier was provided (\c &). */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3908 | CXRefQualifier_LValue, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3909 | /** An rvalue ref-qualifier was provided (\c &&). */ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3910 | CXRefQualifier_RValue |
| 3911 | }; |
| 3912 | |
| 3913 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3914 | * Returns the number of template arguments for given template |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3915 | * specialization, or -1 if type \c T is not a template specialization. |
| 3916 | */ |
| 3917 | CINDEX_LINKAGE int clang_Type_getNumTemplateArguments(CXType T); |
| 3918 | |
| 3919 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3920 | * Returns the type template argument of a template class specialization |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3921 | * at given index. |
| 3922 | * |
| 3923 | * This function only returns template type arguments and does not handle |
| 3924 | * template template arguments or variadic packs. |
| 3925 | */ |
| 3926 | CINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T, unsigned i); |
| 3927 | |
| 3928 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3929 | * Retrieve the ref-qualifier kind of a function or method. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3930 | * |
| 3931 | * The ref-qualifier is returned for C++ functions or methods. For other types |
| 3932 | * or non-C++ declarations, CXRefQualifier_None is returned. |
| 3933 | */ |
| 3934 | CINDEX_LINKAGE enum CXRefQualifierKind clang_Type_getCXXRefQualifier(CXType T); |
| 3935 | |
| 3936 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3937 | * Returns non-zero if the cursor specifies a Record member that is a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3938 | * bitfield. |
| 3939 | */ |
| 3940 | CINDEX_LINKAGE unsigned clang_Cursor_isBitField(CXCursor C); |
| 3941 | |
| 3942 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3943 | * Returns 1 if the base class specified by the cursor with kind |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3944 | * CX_CXXBaseSpecifier is virtual. |
| 3945 | */ |
| 3946 | CINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3947 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3948 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3949 | * Represents the C++ access control level to a base class for a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3950 | * cursor with kind CX_CXXBaseSpecifier. |
| 3951 | */ |
| 3952 | enum CX_CXXAccessSpecifier { |
| 3953 | CX_CXXInvalidAccessSpecifier, |
| 3954 | CX_CXXPublic, |
| 3955 | CX_CXXProtected, |
| 3956 | CX_CXXPrivate |
| 3957 | }; |
| 3958 | |
| 3959 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3960 | * Returns the access control level for the referenced object. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3961 | * |
| 3962 | * If the cursor refers to a C++ declaration, its access control level within its |
| 3963 | * parent scope is returned. Otherwise, if the cursor refers to a base specifier or |
| 3964 | * access specifier, the specifier itself is returned. |
| 3965 | */ |
| 3966 | CINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor); |
| 3967 | |
| 3968 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3969 | * Represents the storage classes as declared in the source. CX_SC_Invalid |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3970 | * was added for the case that the passed cursor in not a declaration. |
| 3971 | */ |
| 3972 | enum CX_StorageClass { |
| 3973 | CX_SC_Invalid, |
| 3974 | CX_SC_None, |
| 3975 | CX_SC_Extern, |
| 3976 | CX_SC_Static, |
| 3977 | CX_SC_PrivateExtern, |
| 3978 | CX_SC_OpenCLWorkGroupLocal, |
| 3979 | CX_SC_Auto, |
| 3980 | CX_SC_Register |
| 3981 | }; |
| 3982 | |
| 3983 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3984 | * Returns the storage class for a function or variable declaration. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3985 | * |
| 3986 | * If the passed in Cursor is not a function or variable declaration, |
| 3987 | * CX_SC_Invalid is returned else the storage class. |
| 3988 | */ |
| 3989 | CINDEX_LINKAGE enum CX_StorageClass clang_Cursor_getStorageClass(CXCursor); |
| 3990 | |
| 3991 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 3992 | * Determine the number of overloaded declarations referenced by a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 3993 | * \c CXCursor_OverloadedDeclRef cursor. |
| 3994 | * |
| 3995 | * \param cursor The cursor whose overloaded declarations are being queried. |
| 3996 | * |
| 3997 | * \returns The number of overloaded declarations referenced by \c cursor. If it |
| 3998 | * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0. |
| 3999 | */ |
| 4000 | CINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor); |
| 4001 | |
| 4002 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4003 | * Retrieve a cursor for one of the overloaded declarations referenced |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4004 | * by a \c CXCursor_OverloadedDeclRef cursor. |
| 4005 | * |
| 4006 | * \param cursor The cursor whose overloaded declarations are being queried. |
| 4007 | * |
| 4008 | * \param index The zero-based index into the set of overloaded declarations in |
| 4009 | * the cursor. |
| 4010 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4011 | * \returns A cursor representing the declaration referenced by the given |
| 4012 | * \c cursor at the specified \c index. If the cursor does not have an |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4013 | * associated set of overloaded declarations, or if the index is out of bounds, |
| 4014 | * returns \c clang_getNullCursor(); |
| 4015 | */ |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4016 | CINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4017 | unsigned index); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4018 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4019 | /** |
| 4020 | * @} |
| 4021 | */ |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4022 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4023 | /** |
| 4024 | * \defgroup CINDEX_ATTRIBUTES Information for attributes |
| 4025 | * |
| 4026 | * @{ |
| 4027 | */ |
| 4028 | |
| 4029 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4030 | * For cursors representing an iboutletcollection attribute, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4031 | * this function returns the collection element type. |
| 4032 | * |
| 4033 | */ |
| 4034 | CINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor); |
| 4035 | |
| 4036 | /** |
| 4037 | * @} |
| 4038 | */ |
| 4039 | |
| 4040 | /** |
| 4041 | * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors |
| 4042 | * |
| 4043 | * These routines provide the ability to traverse the abstract syntax tree |
| 4044 | * using cursors. |
| 4045 | * |
| 4046 | * @{ |
| 4047 | */ |
| 4048 | |
| 4049 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4050 | * Describes how the traversal of the children of a particular |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4051 | * cursor should proceed after visiting a particular child cursor. |
| 4052 | * |
| 4053 | * A value of this enumeration type should be returned by each |
| 4054 | * \c CXCursorVisitor to indicate how clang_visitChildren() proceed. |
| 4055 | */ |
| 4056 | enum CXChildVisitResult { |
| 4057 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4058 | * Terminates the cursor traversal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4059 | */ |
| 4060 | CXChildVisit_Break, |
| 4061 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4062 | * Continues the cursor traversal with the next sibling of |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4063 | * the cursor just visited, without visiting its children. |
| 4064 | */ |
| 4065 | CXChildVisit_Continue, |
| 4066 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4067 | * Recursively traverse the children of this cursor, using |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4068 | * the same visitor and client data. |
| 4069 | */ |
| 4070 | CXChildVisit_Recurse |
| 4071 | }; |
| 4072 | |
| 4073 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4074 | * Visitor invoked for each cursor found by a traversal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4075 | * |
| 4076 | * This visitor function will be invoked for each cursor found by |
| 4077 | * clang_visitCursorChildren(). Its first argument is the cursor being |
| 4078 | * visited, its second argument is the parent visitor for that cursor, |
| 4079 | * and its third argument is the client data provided to |
| 4080 | * clang_visitCursorChildren(). |
| 4081 | * |
| 4082 | * The visitor should return one of the \c CXChildVisitResult values |
| 4083 | * to direct clang_visitCursorChildren(). |
| 4084 | */ |
| 4085 | typedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor, |
| 4086 | CXCursor parent, |
| 4087 | CXClientData client_data); |
| 4088 | |
| 4089 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4090 | * Visit the children of a particular cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4091 | * |
| 4092 | * This function visits all the direct children of the given cursor, |
| 4093 | * invoking the given \p visitor function with the cursors of each |
| 4094 | * visited child. The traversal may be recursive, if the visitor returns |
| 4095 | * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if |
| 4096 | * the visitor returns \c CXChildVisit_Break. |
| 4097 | * |
| 4098 | * \param parent the cursor whose child may be visited. All kinds of |
| 4099 | * cursors can be visited, including invalid cursors (which, by |
| 4100 | * definition, have no children). |
| 4101 | * |
| 4102 | * \param visitor the visitor function that will be invoked for each |
| 4103 | * child of \p parent. |
| 4104 | * |
| 4105 | * \param client_data pointer data supplied by the client, which will |
| 4106 | * be passed to the visitor each time it is invoked. |
| 4107 | * |
| 4108 | * \returns a non-zero value if the traversal was terminated |
| 4109 | * prematurely by the visitor returning \c CXChildVisit_Break. |
| 4110 | */ |
| 4111 | CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent, |
| 4112 | CXCursorVisitor visitor, |
| 4113 | CXClientData client_data); |
| 4114 | #ifdef __has_feature |
| 4115 | # if __has_feature(blocks) |
| 4116 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4117 | * Visitor invoked for each cursor found by a traversal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4118 | * |
| 4119 | * This visitor block will be invoked for each cursor found by |
| 4120 | * clang_visitChildrenWithBlock(). Its first argument is the cursor being |
| 4121 | * visited, its second argument is the parent visitor for that cursor. |
| 4122 | * |
| 4123 | * The visitor should return one of the \c CXChildVisitResult values |
| 4124 | * to direct clang_visitChildrenWithBlock(). |
| 4125 | */ |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4126 | typedef enum CXChildVisitResult |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4127 | (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent); |
| 4128 | |
| 4129 | /** |
| 4130 | * Visits the children of a cursor using the specified block. Behaves |
| 4131 | * identically to clang_visitChildren() in all other respects. |
| 4132 | */ |
| 4133 | CINDEX_LINKAGE unsigned clang_visitChildrenWithBlock(CXCursor parent, |
| 4134 | CXCursorVisitorBlock block); |
| 4135 | # endif |
| 4136 | #endif |
| 4137 | |
| 4138 | /** |
| 4139 | * @} |
| 4140 | */ |
| 4141 | |
| 4142 | /** |
| 4143 | * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST |
| 4144 | * |
| 4145 | * These routines provide the ability to determine references within and |
| 4146 | * across translation units, by providing the names of the entities referenced |
| 4147 | * by cursors, follow reference cursors to the declarations they reference, |
| 4148 | * and associate declarations with their definitions. |
| 4149 | * |
| 4150 | * @{ |
| 4151 | */ |
| 4152 | |
| 4153 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4154 | * Retrieve a Unified Symbol Resolution (USR) for the entity referenced |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4155 | * by the given cursor. |
| 4156 | * |
| 4157 | * A Unified Symbol Resolution (USR) is a string that identifies a particular |
| 4158 | * entity (function, class, variable, etc.) within a program. USRs can be |
| 4159 | * compared across translation units to determine, e.g., when references in |
| 4160 | * one translation refer to an entity defined in another translation unit. |
| 4161 | */ |
| 4162 | CINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor); |
| 4163 | |
| 4164 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4165 | * Construct a USR for a specified Objective-C class. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4166 | */ |
| 4167 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name); |
| 4168 | |
| 4169 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4170 | * Construct a USR for a specified Objective-C category. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4171 | */ |
| 4172 | CINDEX_LINKAGE CXString |
| 4173 | clang_constructUSR_ObjCCategory(const char *class_name, |
| 4174 | const char *category_name); |
| 4175 | |
| 4176 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4177 | * Construct a USR for a specified Objective-C protocol. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4178 | */ |
| 4179 | CINDEX_LINKAGE CXString |
| 4180 | clang_constructUSR_ObjCProtocol(const char *protocol_name); |
| 4181 | |
| 4182 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4183 | * Construct a USR for a specified Objective-C instance variable and |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4184 | * the USR for its containing class. |
| 4185 | */ |
| 4186 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name, |
| 4187 | CXString classUSR); |
| 4188 | |
| 4189 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4190 | * Construct a USR for a specified Objective-C method and |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4191 | * the USR for its containing class. |
| 4192 | */ |
| 4193 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name, |
| 4194 | unsigned isInstanceMethod, |
| 4195 | CXString classUSR); |
| 4196 | |
| 4197 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4198 | * Construct a USR for a specified Objective-C property and the USR |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4199 | * for its containing class. |
| 4200 | */ |
| 4201 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property, |
| 4202 | CXString classUSR); |
| 4203 | |
| 4204 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4205 | * Retrieve a name for the entity referenced by this cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4206 | */ |
| 4207 | CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor); |
| 4208 | |
| 4209 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4210 | * Retrieve a range for a piece that forms the cursors spelling name. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4211 | * Most of the times there is only one range for the complete spelling but for |
| 4212 | * Objective-C methods and Objective-C message expressions, there are multiple |
| 4213 | * pieces for each selector identifier. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4214 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4215 | * \param pieceIndex the index of the spelling name piece. If this is greater |
| 4216 | * than the actual number of pieces, it will return a NULL (invalid) range. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4217 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4218 | * \param options Reserved. |
| 4219 | */ |
| 4220 | CINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor, |
| 4221 | unsigned pieceIndex, |
| 4222 | unsigned options); |
| 4223 | |
| 4224 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4225 | * Opaque pointer representing a policy that controls pretty printing |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4226 | * for \c clang_getCursorPrettyPrinted. |
| 4227 | */ |
| 4228 | typedef void *CXPrintingPolicy; |
| 4229 | |
| 4230 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4231 | * Properties for the printing policy. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4232 | * |
| 4233 | * See \c clang::PrintingPolicy for more information. |
| 4234 | */ |
| 4235 | enum CXPrintingPolicyProperty { |
| 4236 | CXPrintingPolicy_Indentation, |
| 4237 | CXPrintingPolicy_SuppressSpecifiers, |
| 4238 | CXPrintingPolicy_SuppressTagKeyword, |
| 4239 | CXPrintingPolicy_IncludeTagDefinition, |
| 4240 | CXPrintingPolicy_SuppressScope, |
| 4241 | CXPrintingPolicy_SuppressUnwrittenScope, |
| 4242 | CXPrintingPolicy_SuppressInitializers, |
| 4243 | CXPrintingPolicy_ConstantArraySizeAsWritten, |
| 4244 | CXPrintingPolicy_AnonymousTagLocations, |
| 4245 | CXPrintingPolicy_SuppressStrongLifetime, |
| 4246 | CXPrintingPolicy_SuppressLifetimeQualifiers, |
| 4247 | CXPrintingPolicy_SuppressTemplateArgsInCXXConstructors, |
| 4248 | CXPrintingPolicy_Bool, |
| 4249 | CXPrintingPolicy_Restrict, |
| 4250 | CXPrintingPolicy_Alignof, |
| 4251 | CXPrintingPolicy_UnderscoreAlignof, |
| 4252 | CXPrintingPolicy_UseVoidForZeroParams, |
| 4253 | CXPrintingPolicy_TerseOutput, |
| 4254 | CXPrintingPolicy_PolishForDeclaration, |
| 4255 | CXPrintingPolicy_Half, |
| 4256 | CXPrintingPolicy_MSWChar, |
| 4257 | CXPrintingPolicy_IncludeNewlines, |
| 4258 | CXPrintingPolicy_MSVCFormatting, |
| 4259 | CXPrintingPolicy_ConstantsAsWritten, |
| 4260 | CXPrintingPolicy_SuppressImplicitBase, |
| 4261 | CXPrintingPolicy_FullyQualifiedName, |
| 4262 | |
| 4263 | CXPrintingPolicy_LastProperty = CXPrintingPolicy_FullyQualifiedName |
| 4264 | }; |
| 4265 | |
| 4266 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4267 | * Get a property value for the given printing policy. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4268 | */ |
| 4269 | CINDEX_LINKAGE unsigned |
| 4270 | clang_PrintingPolicy_getProperty(CXPrintingPolicy Policy, |
| 4271 | enum CXPrintingPolicyProperty Property); |
| 4272 | |
| 4273 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4274 | * Set a property value for the given printing policy. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4275 | */ |
| 4276 | CINDEX_LINKAGE void clang_PrintingPolicy_setProperty(CXPrintingPolicy Policy, |
| 4277 | enum CXPrintingPolicyProperty Property, |
| 4278 | unsigned Value); |
| 4279 | |
| 4280 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4281 | * Retrieve the default policy for the cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4282 | * |
| 4283 | * The policy should be released after use with \c |
| 4284 | * clang_PrintingPolicy_dispose. |
| 4285 | */ |
| 4286 | CINDEX_LINKAGE CXPrintingPolicy clang_getCursorPrintingPolicy(CXCursor); |
| 4287 | |
| 4288 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4289 | * Release a printing policy. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4290 | */ |
| 4291 | CINDEX_LINKAGE void clang_PrintingPolicy_dispose(CXPrintingPolicy Policy); |
| 4292 | |
| 4293 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4294 | * Pretty print declarations. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4295 | * |
| 4296 | * \param Cursor The cursor representing a declaration. |
| 4297 | * |
| 4298 | * \param Policy The policy to control the entities being printed. If |
| 4299 | * NULL, a default policy is used. |
| 4300 | * |
| 4301 | * \returns The pretty printed declaration or the empty string for |
| 4302 | * other cursors. |
| 4303 | */ |
| 4304 | CINDEX_LINKAGE CXString clang_getCursorPrettyPrinted(CXCursor Cursor, |
| 4305 | CXPrintingPolicy Policy); |
| 4306 | |
| 4307 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4308 | * Retrieve the display name for the entity referenced by this cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4309 | * |
| 4310 | * The display name contains extra information that helps identify the cursor, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4311 | * such as the parameters of a function or template or the arguments of a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4312 | * class template specialization. |
| 4313 | */ |
| 4314 | CINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4315 | |
| 4316 | /** For a cursor that is a reference, retrieve a cursor representing the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4317 | * entity that it references. |
| 4318 | * |
| 4319 | * Reference cursors refer to other entities in the AST. For example, an |
| 4320 | * Objective-C superclass reference cursor refers to an Objective-C class. |
| 4321 | * This function produces the cursor for the Objective-C class from the |
| 4322 | * cursor for the superclass reference. If the input cursor is a declaration or |
| 4323 | * definition, it returns that declaration or definition unchanged. |
| 4324 | * Otherwise, returns the NULL cursor. |
| 4325 | */ |
| 4326 | CINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor); |
| 4327 | |
| 4328 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4329 | * For a cursor that is either a reference to or a declaration |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4330 | * of some entity, retrieve a cursor that describes the definition of |
| 4331 | * that entity. |
| 4332 | * |
| 4333 | * Some entities can be declared multiple times within a translation |
| 4334 | * unit, but only one of those declarations can also be a |
| 4335 | * definition. For example, given: |
| 4336 | * |
| 4337 | * \code |
| 4338 | * int f(int, int); |
| 4339 | * int g(int x, int y) { return f(x, y); } |
| 4340 | * int f(int a, int b) { return a + b; } |
| 4341 | * int f(int, int); |
| 4342 | * \endcode |
| 4343 | * |
| 4344 | * there are three declarations of the function "f", but only the |
| 4345 | * second one is a definition. The clang_getCursorDefinition() |
| 4346 | * function will take any cursor pointing to a declaration of "f" |
| 4347 | * (the first or fourth lines of the example) or a cursor referenced |
| 4348 | * that uses "f" (the call to "f' inside "g") and will return a |
| 4349 | * declaration cursor pointing to the definition (the second "f" |
| 4350 | * declaration). |
| 4351 | * |
| 4352 | * If given a cursor for which there is no corresponding definition, |
| 4353 | * e.g., because there is no definition of that entity within this |
| 4354 | * translation unit, returns a NULL cursor. |
| 4355 | */ |
| 4356 | CINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor); |
| 4357 | |
| 4358 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4359 | * Determine whether the declaration pointed to by this cursor |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4360 | * is also a definition of that entity. |
| 4361 | */ |
| 4362 | CINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor); |
| 4363 | |
| 4364 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4365 | * Retrieve the canonical cursor corresponding to the given cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4366 | * |
| 4367 | * In the C family of languages, many kinds of entities can be declared several |
| 4368 | * times within a single translation unit. For example, a structure type can |
| 4369 | * be forward-declared (possibly multiple times) and later defined: |
| 4370 | * |
| 4371 | * \code |
| 4372 | * struct X; |
| 4373 | * struct X; |
| 4374 | * struct X { |
| 4375 | * int member; |
| 4376 | * }; |
| 4377 | * \endcode |
| 4378 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4379 | * The declarations and the definition of \c X are represented by three |
| 4380 | * different cursors, all of which are declarations of the same underlying |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4381 | * entity. One of these cursor is considered the "canonical" cursor, which |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4382 | * is effectively the representative for the underlying entity. One can |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4383 | * determine if two cursors are declarations of the same underlying entity by |
| 4384 | * comparing their canonical cursors. |
| 4385 | * |
| 4386 | * \returns The canonical cursor for the entity referred to by the given cursor. |
| 4387 | */ |
| 4388 | CINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor); |
| 4389 | |
| 4390 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4391 | * If the cursor points to a selector identifier in an Objective-C |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4392 | * method or message expression, this returns the selector index. |
| 4393 | * |
| 4394 | * After getting a cursor with #clang_getCursor, this can be called to |
| 4395 | * determine if the location points to a selector identifier. |
| 4396 | * |
| 4397 | * \returns The selector index if the cursor is an Objective-C method or message |
| 4398 | * expression and the cursor is pointing to a selector identifier, or -1 |
| 4399 | * otherwise. |
| 4400 | */ |
| 4401 | CINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor); |
| 4402 | |
| 4403 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4404 | * Given a cursor pointing to a C++ method call or an Objective-C |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4405 | * message, returns non-zero if the method/message is "dynamic", meaning: |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4406 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4407 | * For a C++ method: the call is virtual. |
| 4408 | * For an Objective-C message: the receiver is an object instance, not 'super' |
| 4409 | * or a specific class. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4410 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4411 | * If the method/message is "static" or the cursor does not point to a |
| 4412 | * method/message, it will return zero. |
| 4413 | */ |
| 4414 | CINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C); |
| 4415 | |
| 4416 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4417 | * Given a cursor pointing to an Objective-C message or property |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4418 | * reference, or C++ method call, returns the CXType of the receiver. |
| 4419 | */ |
| 4420 | CINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C); |
| 4421 | |
| 4422 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4423 | * Property attributes for a \c CXCursor_ObjCPropertyDecl. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4424 | */ |
| 4425 | typedef enum { |
| 4426 | CXObjCPropertyAttr_noattr = 0x00, |
| 4427 | CXObjCPropertyAttr_readonly = 0x01, |
| 4428 | CXObjCPropertyAttr_getter = 0x02, |
| 4429 | CXObjCPropertyAttr_assign = 0x04, |
| 4430 | CXObjCPropertyAttr_readwrite = 0x08, |
| 4431 | CXObjCPropertyAttr_retain = 0x10, |
| 4432 | CXObjCPropertyAttr_copy = 0x20, |
| 4433 | CXObjCPropertyAttr_nonatomic = 0x40, |
| 4434 | CXObjCPropertyAttr_setter = 0x80, |
| 4435 | CXObjCPropertyAttr_atomic = 0x100, |
| 4436 | CXObjCPropertyAttr_weak = 0x200, |
| 4437 | CXObjCPropertyAttr_strong = 0x400, |
| 4438 | CXObjCPropertyAttr_unsafe_unretained = 0x800, |
| 4439 | CXObjCPropertyAttr_class = 0x1000 |
| 4440 | } CXObjCPropertyAttrKind; |
| 4441 | |
| 4442 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4443 | * Given a cursor that represents a property declaration, return the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4444 | * associated property attributes. The bits are formed from |
| 4445 | * \c CXObjCPropertyAttrKind. |
| 4446 | * |
| 4447 | * \param reserved Reserved for future use, pass 0. |
| 4448 | */ |
| 4449 | CINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C, |
| 4450 | unsigned reserved); |
| 4451 | |
| 4452 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4453 | * Given a cursor that represents a property declaration, return the |
| 4454 | * name of the method that implements the getter. |
| 4455 | */ |
| 4456 | CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertyGetterName(CXCursor C); |
| 4457 | |
| 4458 | /** |
| 4459 | * Given a cursor that represents a property declaration, return the |
| 4460 | * name of the method that implements the setter, if any. |
| 4461 | */ |
| 4462 | CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertySetterName(CXCursor C); |
| 4463 | |
| 4464 | /** |
| 4465 | * 'Qualifiers' written next to the return and parameter types in |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4466 | * Objective-C method declarations. |
| 4467 | */ |
| 4468 | typedef enum { |
| 4469 | CXObjCDeclQualifier_None = 0x0, |
| 4470 | CXObjCDeclQualifier_In = 0x1, |
| 4471 | CXObjCDeclQualifier_Inout = 0x2, |
| 4472 | CXObjCDeclQualifier_Out = 0x4, |
| 4473 | CXObjCDeclQualifier_Bycopy = 0x8, |
| 4474 | CXObjCDeclQualifier_Byref = 0x10, |
| 4475 | CXObjCDeclQualifier_Oneway = 0x20 |
| 4476 | } CXObjCDeclQualifierKind; |
| 4477 | |
| 4478 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4479 | * Given a cursor that represents an Objective-C method or parameter |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4480 | * declaration, return the associated Objective-C qualifiers for the return |
| 4481 | * type or the parameter respectively. The bits are formed from |
| 4482 | * CXObjCDeclQualifierKind. |
| 4483 | */ |
| 4484 | CINDEX_LINKAGE unsigned clang_Cursor_getObjCDeclQualifiers(CXCursor C); |
| 4485 | |
| 4486 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4487 | * Given a cursor that represents an Objective-C method or property |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4488 | * declaration, return non-zero if the declaration was affected by "\@optional". |
| 4489 | * Returns zero if the cursor is not such a declaration or it is "\@required". |
| 4490 | */ |
| 4491 | CINDEX_LINKAGE unsigned clang_Cursor_isObjCOptional(CXCursor C); |
| 4492 | |
| 4493 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4494 | * Returns non-zero if the given cursor is a variadic function or method. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4495 | */ |
| 4496 | CINDEX_LINKAGE unsigned clang_Cursor_isVariadic(CXCursor C); |
| 4497 | |
| 4498 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4499 | * Returns non-zero if the given cursor points to a symbol marked with |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4500 | * external_source_symbol attribute. |
| 4501 | * |
| 4502 | * \param language If non-NULL, and the attribute is present, will be set to |
| 4503 | * the 'language' string from the attribute. |
| 4504 | * |
| 4505 | * \param definedIn If non-NULL, and the attribute is present, will be set to |
| 4506 | * the 'definedIn' string from the attribute. |
| 4507 | * |
| 4508 | * \param isGenerated If non-NULL, and the attribute is present, will be set to |
| 4509 | * non-zero if the 'generated_declaration' is set in the attribute. |
| 4510 | */ |
| 4511 | CINDEX_LINKAGE unsigned clang_Cursor_isExternalSymbol(CXCursor C, |
| 4512 | CXString *language, CXString *definedIn, |
| 4513 | unsigned *isGenerated); |
| 4514 | |
| 4515 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4516 | * Given a cursor that represents a declaration, return the associated |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4517 | * comment's source range. The range may include multiple consecutive comments |
| 4518 | * with whitespace in between. |
| 4519 | */ |
| 4520 | CINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange(CXCursor C); |
| 4521 | |
| 4522 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4523 | * Given a cursor that represents a declaration, return the associated |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4524 | * comment text, including comment markers. |
| 4525 | */ |
| 4526 | CINDEX_LINKAGE CXString clang_Cursor_getRawCommentText(CXCursor C); |
| 4527 | |
| 4528 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4529 | * Given a cursor that represents a documentable entity (e.g., |
| 4530 | * declaration), return the associated \paragraph; otherwise return the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4531 | * first paragraph. |
| 4532 | */ |
| 4533 | CINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText(CXCursor C); |
| 4534 | |
| 4535 | /** |
| 4536 | * @} |
| 4537 | */ |
| 4538 | |
| 4539 | /** \defgroup CINDEX_MANGLE Name Mangling API Functions |
| 4540 | * |
| 4541 | * @{ |
| 4542 | */ |
| 4543 | |
| 4544 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4545 | * Retrieve the CXString representing the mangled name of the cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4546 | */ |
| 4547 | CINDEX_LINKAGE CXString clang_Cursor_getMangling(CXCursor); |
| 4548 | |
| 4549 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4550 | * Retrieve the CXStrings representing the mangled symbols of the C++ |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4551 | * constructor or destructor at the cursor. |
| 4552 | */ |
| 4553 | CINDEX_LINKAGE CXStringSet *clang_Cursor_getCXXManglings(CXCursor); |
| 4554 | |
| 4555 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4556 | * Retrieve the CXStrings representing the mangled symbols of the ObjC |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4557 | * class interface or implementation at the cursor. |
| 4558 | */ |
| 4559 | CINDEX_LINKAGE CXStringSet *clang_Cursor_getObjCManglings(CXCursor); |
| 4560 | |
| 4561 | /** |
| 4562 | * @} |
| 4563 | */ |
| 4564 | |
| 4565 | /** |
| 4566 | * \defgroup CINDEX_MODULE Module introspection |
| 4567 | * |
| 4568 | * The functions in this group provide access to information about modules. |
| 4569 | * |
| 4570 | * @{ |
| 4571 | */ |
| 4572 | |
| 4573 | typedef void *CXModule; |
| 4574 | |
| 4575 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4576 | * Given a CXCursor_ModuleImportDecl cursor, return the associated module. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4577 | */ |
| 4578 | CINDEX_LINKAGE CXModule clang_Cursor_getModule(CXCursor C); |
| 4579 | |
| 4580 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4581 | * Given a CXFile header file, return the module that contains it, if one |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4582 | * exists. |
| 4583 | */ |
| 4584 | CINDEX_LINKAGE CXModule clang_getModuleForFile(CXTranslationUnit, CXFile); |
| 4585 | |
| 4586 | /** |
| 4587 | * \param Module a module object. |
| 4588 | * |
| 4589 | * \returns the module file where the provided module object came from. |
| 4590 | */ |
| 4591 | CINDEX_LINKAGE CXFile clang_Module_getASTFile(CXModule Module); |
| 4592 | |
| 4593 | /** |
| 4594 | * \param Module a module object. |
| 4595 | * |
| 4596 | * \returns the parent of a sub-module or NULL if the given module is top-level, |
| 4597 | * e.g. for 'std.vector' it will return the 'std' module. |
| 4598 | */ |
| 4599 | CINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module); |
| 4600 | |
| 4601 | /** |
| 4602 | * \param Module a module object. |
| 4603 | * |
| 4604 | * \returns the name of the module, e.g. for the 'std.vector' sub-module it |
| 4605 | * will return "vector". |
| 4606 | */ |
| 4607 | CINDEX_LINKAGE CXString clang_Module_getName(CXModule Module); |
| 4608 | |
| 4609 | /** |
| 4610 | * \param Module a module object. |
| 4611 | * |
| 4612 | * \returns the full name of the module, e.g. "std.vector". |
| 4613 | */ |
| 4614 | CINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module); |
| 4615 | |
| 4616 | /** |
| 4617 | * \param Module a module object. |
| 4618 | * |
| 4619 | * \returns non-zero if the module is a system one. |
| 4620 | */ |
| 4621 | CINDEX_LINKAGE int clang_Module_isSystem(CXModule Module); |
| 4622 | |
| 4623 | /** |
| 4624 | * \param Module a module object. |
| 4625 | * |
| 4626 | * \returns the number of top level headers associated with this module. |
| 4627 | */ |
| 4628 | CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit, |
| 4629 | CXModule Module); |
| 4630 | |
| 4631 | /** |
| 4632 | * \param Module a module object. |
| 4633 | * |
| 4634 | * \param Index top level header index (zero-based). |
| 4635 | * |
| 4636 | * \returns the specified top level header associated with the module. |
| 4637 | */ |
| 4638 | CINDEX_LINKAGE |
| 4639 | CXFile clang_Module_getTopLevelHeader(CXTranslationUnit, |
| 4640 | CXModule Module, unsigned Index); |
| 4641 | |
| 4642 | /** |
| 4643 | * @} |
| 4644 | */ |
| 4645 | |
| 4646 | /** |
| 4647 | * \defgroup CINDEX_CPP C++ AST introspection |
| 4648 | * |
| 4649 | * The routines in this group provide access information in the ASTs specific |
| 4650 | * to C++ language features. |
| 4651 | * |
| 4652 | * @{ |
| 4653 | */ |
| 4654 | |
| 4655 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4656 | * Determine if a C++ constructor is a converting constructor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4657 | */ |
| 4658 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isConvertingConstructor(CXCursor C); |
| 4659 | |
| 4660 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4661 | * Determine if a C++ constructor is a copy constructor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4662 | */ |
| 4663 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isCopyConstructor(CXCursor C); |
| 4664 | |
| 4665 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4666 | * Determine if a C++ constructor is the default constructor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4667 | */ |
| 4668 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isDefaultConstructor(CXCursor C); |
| 4669 | |
| 4670 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4671 | * Determine if a C++ constructor is a move constructor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4672 | */ |
| 4673 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isMoveConstructor(CXCursor C); |
| 4674 | |
| 4675 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4676 | * Determine if a C++ field is declared 'mutable'. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4677 | */ |
| 4678 | CINDEX_LINKAGE unsigned clang_CXXField_isMutable(CXCursor C); |
| 4679 | |
| 4680 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4681 | * Determine if a C++ method is declared '= default'. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4682 | */ |
| 4683 | CINDEX_LINKAGE unsigned clang_CXXMethod_isDefaulted(CXCursor C); |
| 4684 | |
| 4685 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4686 | * Determine if a C++ member function or member function template is |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4687 | * pure virtual. |
| 4688 | */ |
| 4689 | CINDEX_LINKAGE unsigned clang_CXXMethod_isPureVirtual(CXCursor C); |
| 4690 | |
| 4691 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4692 | * Determine if a C++ member function or member function template is |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4693 | * declared 'static'. |
| 4694 | */ |
| 4695 | CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C); |
| 4696 | |
| 4697 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4698 | * Determine if a C++ member function or member function template is |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4699 | * explicitly declared 'virtual' or if it overrides a virtual method from |
| 4700 | * one of the base classes. |
| 4701 | */ |
| 4702 | CINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C); |
| 4703 | |
| 4704 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4705 | * Determine if a C++ record is abstract, i.e. whether a class or struct |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4706 | * has a pure virtual member function. |
| 4707 | */ |
| 4708 | CINDEX_LINKAGE unsigned clang_CXXRecord_isAbstract(CXCursor C); |
| 4709 | |
| 4710 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4711 | * Determine if an enum declaration refers to a scoped enum. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4712 | */ |
| 4713 | CINDEX_LINKAGE unsigned clang_EnumDecl_isScoped(CXCursor C); |
| 4714 | |
| 4715 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4716 | * Determine if a C++ member function or member function template is |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4717 | * declared 'const'. |
| 4718 | */ |
| 4719 | CINDEX_LINKAGE unsigned clang_CXXMethod_isConst(CXCursor C); |
| 4720 | |
| 4721 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4722 | * Given a cursor that represents a template, determine |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4723 | * the cursor kind of the specializations would be generated by instantiating |
| 4724 | * the template. |
| 4725 | * |
| 4726 | * This routine can be used to determine what flavor of function template, |
| 4727 | * class template, or class template partial specialization is stored in the |
| 4728 | * cursor. For example, it can describe whether a class template cursor is |
| 4729 | * declared with "struct", "class" or "union". |
| 4730 | * |
| 4731 | * \param C The cursor to query. This cursor should represent a template |
| 4732 | * declaration. |
| 4733 | * |
| 4734 | * \returns The cursor kind of the specializations that would be generated |
| 4735 | * by instantiating the template \p C. If \p C is not a template, returns |
| 4736 | * \c CXCursor_NoDeclFound. |
| 4737 | */ |
| 4738 | CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4739 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4740 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4741 | * Given a cursor that may represent a specialization or instantiation |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4742 | * of a template, retrieve the cursor that represents the template that it |
| 4743 | * specializes or from which it was instantiated. |
| 4744 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4745 | * This routine determines the template involved both for explicit |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4746 | * specializations of templates and for implicit instantiations of the template, |
| 4747 | * both of which are referred to as "specializations". For a class template |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4748 | * specialization (e.g., \c std::vector<bool>), this routine will return |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4749 | * either the primary template (\c std::vector) or, if the specialization was |
| 4750 | * instantiated from a class template partial specialization, the class template |
| 4751 | * partial specialization. For a class template partial specialization and a |
| 4752 | * function template specialization (including instantiations), this |
| 4753 | * this routine will return the specialized template. |
| 4754 | * |
| 4755 | * For members of a class template (e.g., member functions, member classes, or |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4756 | * static data members), returns the specialized or instantiated member. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4757 | * Although not strictly "templates" in the C++ language, members of class |
| 4758 | * templates have the same notions of specializations and instantiations that |
| 4759 | * templates do, so this routine treats them similarly. |
| 4760 | * |
| 4761 | * \param C A cursor that may be a specialization of a template or a member |
| 4762 | * of a template. |
| 4763 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4764 | * \returns If the given cursor is a specialization or instantiation of a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4765 | * template or a member thereof, the template or member that it specializes or |
| 4766 | * from which it was instantiated. Otherwise, returns a NULL cursor. |
| 4767 | */ |
| 4768 | CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C); |
| 4769 | |
| 4770 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4771 | * Given a cursor that references something else, return the source range |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4772 | * covering that reference. |
| 4773 | * |
| 4774 | * \param C A cursor pointing to a member reference, a declaration reference, or |
| 4775 | * an operator call. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4776 | * \param NameFlags A bitset with three independent flags: |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4777 | * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and |
| 4778 | * CXNameRange_WantSinglePiece. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4779 | * \param PieceIndex For contiguous names or when passing the flag |
| 4780 | * CXNameRange_WantSinglePiece, only one piece with index 0 is |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4781 | * available. When the CXNameRange_WantSinglePiece flag is not passed for a |
| 4782 | * non-contiguous names, this index can be used to retrieve the individual |
| 4783 | * pieces of the name. See also CXNameRange_WantSinglePiece. |
| 4784 | * |
| 4785 | * \returns The piece of the name pointed to by the given cursor. If there is no |
| 4786 | * name, or if the PieceIndex is out-of-range, a null-cursor will be returned. |
| 4787 | */ |
| 4788 | CINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4789 | unsigned NameFlags, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4790 | unsigned PieceIndex); |
| 4791 | |
| 4792 | enum CXNameRefFlags { |
| 4793 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4794 | * Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4795 | * range. |
| 4796 | */ |
| 4797 | CXNameRange_WantQualifier = 0x1, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4798 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4799 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4800 | * Include the explicit template arguments, e.g. \<int> in x.f<int>, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4801 | * in the range. |
| 4802 | */ |
| 4803 | CXNameRange_WantTemplateArgs = 0x2, |
| 4804 | |
| 4805 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4806 | * If the name is non-contiguous, return the full spanning range. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4807 | * |
| 4808 | * Non-contiguous names occur in Objective-C when a selector with two or more |
| 4809 | * parameters is used, or in C++ when using an operator: |
| 4810 | * \code |
| 4811 | * [object doSomething:here withValue:there]; // Objective-C |
| 4812 | * return some_vector[1]; // C++ |
| 4813 | * \endcode |
| 4814 | */ |
| 4815 | CXNameRange_WantSinglePiece = 0x4 |
| 4816 | }; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4817 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4818 | /** |
| 4819 | * @} |
| 4820 | */ |
| 4821 | |
| 4822 | /** |
| 4823 | * \defgroup CINDEX_LEX Token extraction and manipulation |
| 4824 | * |
| 4825 | * The routines in this group provide access to the tokens within a |
| 4826 | * translation unit, along with a semantic mapping of those tokens to |
| 4827 | * their corresponding cursors. |
| 4828 | * |
| 4829 | * @{ |
| 4830 | */ |
| 4831 | |
| 4832 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4833 | * Describes a kind of token. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4834 | */ |
| 4835 | typedef enum CXTokenKind { |
| 4836 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4837 | * A token that contains some kind of punctuation. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4838 | */ |
| 4839 | CXToken_Punctuation, |
| 4840 | |
| 4841 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4842 | * A language keyword. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4843 | */ |
| 4844 | CXToken_Keyword, |
| 4845 | |
| 4846 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4847 | * An identifier (that is not a keyword). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4848 | */ |
| 4849 | CXToken_Identifier, |
| 4850 | |
| 4851 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4852 | * A numeric, string, or character literal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4853 | */ |
| 4854 | CXToken_Literal, |
| 4855 | |
| 4856 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4857 | * A comment. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4858 | */ |
| 4859 | CXToken_Comment |
| 4860 | } CXTokenKind; |
| 4861 | |
| 4862 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4863 | * Describes a single preprocessing token. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4864 | */ |
| 4865 | typedef struct { |
| 4866 | unsigned int_data[4]; |
| 4867 | void *ptr_data; |
| 4868 | } CXToken; |
| 4869 | |
| 4870 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4871 | * Get the raw lexical token starting with the given location. |
| 4872 | * |
| 4873 | * \param TU the translation unit whose text is being tokenized. |
| 4874 | * |
| 4875 | * \param Location the source location with which the token starts. |
| 4876 | * |
| 4877 | * \returns The token starting with the given location or NULL if no such token |
| 4878 | * exist. The returned pointer must be freed with clang_disposeTokens before the |
| 4879 | * translation unit is destroyed. |
| 4880 | */ |
| 4881 | CINDEX_LINKAGE CXToken *clang_getToken(CXTranslationUnit TU, |
| 4882 | CXSourceLocation Location); |
| 4883 | |
| 4884 | /** |
| 4885 | * Determine the kind of the given token. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4886 | */ |
| 4887 | CINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken); |
| 4888 | |
| 4889 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4890 | * Determine the spelling of the given token. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4891 | * |
| 4892 | * The spelling of a token is the textual representation of that token, e.g., |
| 4893 | * the text of an identifier or keyword. |
| 4894 | */ |
| 4895 | CINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken); |
| 4896 | |
| 4897 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4898 | * Retrieve the source location of the given token. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4899 | */ |
| 4900 | CINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit, |
| 4901 | CXToken); |
| 4902 | |
| 4903 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4904 | * Retrieve a source range that covers the given token. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4905 | */ |
| 4906 | CINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken); |
| 4907 | |
| 4908 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4909 | * Tokenize the source code described by the given range into raw |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4910 | * lexical tokens. |
| 4911 | * |
| 4912 | * \param TU the translation unit whose text is being tokenized. |
| 4913 | * |
| 4914 | * \param Range the source range in which text should be tokenized. All of the |
| 4915 | * tokens produced by tokenization will fall within this source range, |
| 4916 | * |
| 4917 | * \param Tokens this pointer will be set to point to the array of tokens |
| 4918 | * that occur within the given source range. The returned pointer must be |
| 4919 | * freed with clang_disposeTokens() before the translation unit is destroyed. |
| 4920 | * |
| 4921 | * \param NumTokens will be set to the number of tokens in the \c *Tokens |
| 4922 | * array. |
| 4923 | * |
| 4924 | */ |
| 4925 | CINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range, |
| 4926 | CXToken **Tokens, unsigned *NumTokens); |
| 4927 | |
| 4928 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4929 | * Annotate the given set of tokens by providing cursors for each token |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4930 | * that can be mapped to a specific entity within the abstract syntax tree. |
| 4931 | * |
| 4932 | * This token-annotation routine is equivalent to invoking |
| 4933 | * clang_getCursor() for the source locations of each of the |
| 4934 | * tokens. The cursors provided are filtered, so that only those |
| 4935 | * cursors that have a direct correspondence to the token are |
| 4936 | * accepted. For example, given a function call \c f(x), |
| 4937 | * clang_getCursor() would provide the following cursors: |
| 4938 | * |
| 4939 | * * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'. |
| 4940 | * * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'. |
| 4941 | * * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'. |
| 4942 | * |
| 4943 | * Only the first and last of these cursors will occur within the |
| 4944 | * annotate, since the tokens "f" and "x' directly refer to a function |
| 4945 | * and a variable, respectively, but the parentheses are just a small |
| 4946 | * part of the full syntax of the function call expression, which is |
| 4947 | * not provided as an annotation. |
| 4948 | * |
| 4949 | * \param TU the translation unit that owns the given tokens. |
| 4950 | * |
| 4951 | * \param Tokens the set of tokens to annotate. |
| 4952 | * |
| 4953 | * \param NumTokens the number of tokens in \p Tokens. |
| 4954 | * |
| 4955 | * \param Cursors an array of \p NumTokens cursors, whose contents will be |
| 4956 | * replaced with the cursors corresponding to each token. |
| 4957 | */ |
| 4958 | CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU, |
| 4959 | CXToken *Tokens, unsigned NumTokens, |
| 4960 | CXCursor *Cursors); |
| 4961 | |
| 4962 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 4963 | * Free the given set of tokens. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 4964 | */ |
| 4965 | CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU, |
| 4966 | CXToken *Tokens, unsigned NumTokens); |
| 4967 | |
| 4968 | /** |
| 4969 | * @} |
| 4970 | */ |
| 4971 | |
| 4972 | /** |
| 4973 | * \defgroup CINDEX_DEBUG Debugging facilities |
| 4974 | * |
| 4975 | * These routines are used for testing and debugging, only, and should not |
| 4976 | * be relied upon. |
| 4977 | * |
| 4978 | * @{ |
| 4979 | */ |
| 4980 | |
| 4981 | /* for debug/testing */ |
| 4982 | CINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind); |
| 4983 | CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor, |
| 4984 | const char **startBuf, |
| 4985 | const char **endBuf, |
| 4986 | unsigned *startLine, |
| 4987 | unsigned *startColumn, |
| 4988 | unsigned *endLine, |
| 4989 | unsigned *endColumn); |
| 4990 | CINDEX_LINKAGE void clang_enableStackTraces(void); |
| 4991 | CINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data, |
| 4992 | unsigned stack_size); |
| 4993 | |
| 4994 | /** |
| 4995 | * @} |
| 4996 | */ |
| 4997 | |
| 4998 | /** |
| 4999 | * \defgroup CINDEX_CODE_COMPLET Code completion |
| 5000 | * |
| 5001 | * Code completion involves taking an (incomplete) source file, along with |
| 5002 | * knowledge of where the user is actively editing that file, and suggesting |
| 5003 | * syntactically- and semantically-valid constructs that the user might want to |
| 5004 | * use at that particular point in the source code. These data structures and |
| 5005 | * routines provide support for code completion. |
| 5006 | * |
| 5007 | * @{ |
| 5008 | */ |
| 5009 | |
| 5010 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5011 | * A semantic string that describes a code-completion result. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5012 | * |
| 5013 | * A semantic string that describes the formatting of a code-completion |
| 5014 | * result as a single "template" of text that should be inserted into the |
| 5015 | * source buffer when a particular code-completion result is selected. |
| 5016 | * Each semantic string is made up of some number of "chunks", each of which |
| 5017 | * contains some text along with a description of what that text means, e.g., |
| 5018 | * the name of the entity being referenced, whether the text chunk is part of |
| 5019 | * the template, or whether it is a "placeholder" that the user should replace |
| 5020 | * with actual code,of a specific kind. See \c CXCompletionChunkKind for a |
| 5021 | * description of the different kinds of chunks. |
| 5022 | */ |
| 5023 | typedef void *CXCompletionString; |
| 5024 | |
| 5025 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5026 | * A single result of code completion. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5027 | */ |
| 5028 | typedef struct { |
| 5029 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5030 | * The kind of entity that this completion refers to. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5031 | * |
| 5032 | * The cursor kind will be a macro, keyword, or a declaration (one of the |
| 5033 | * *Decl cursor kinds), describing the entity that the completion is |
| 5034 | * referring to. |
| 5035 | * |
| 5036 | * \todo In the future, we would like to provide a full cursor, to allow |
| 5037 | * the client to extract additional information from declaration. |
| 5038 | */ |
| 5039 | enum CXCursorKind CursorKind; |
| 5040 | |
| 5041 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5042 | * The code-completion string that describes how to insert this |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5043 | * code-completion result into the editing buffer. |
| 5044 | */ |
| 5045 | CXCompletionString CompletionString; |
| 5046 | } CXCompletionResult; |
| 5047 | |
| 5048 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5049 | * Describes a single piece of text within a code-completion string. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5050 | * |
| 5051 | * Each "chunk" within a code-completion string (\c CXCompletionString) is |
| 5052 | * either a piece of text with a specific "kind" that describes how that text |
| 5053 | * should be interpreted by the client or is another completion string. |
| 5054 | */ |
| 5055 | enum CXCompletionChunkKind { |
| 5056 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5057 | * A code-completion string that describes "optional" text that |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5058 | * could be a part of the template (but is not required). |
| 5059 | * |
| 5060 | * The Optional chunk is the only kind of chunk that has a code-completion |
| 5061 | * string for its representation, which is accessible via |
| 5062 | * \c clang_getCompletionChunkCompletionString(). The code-completion string |
| 5063 | * describes an additional part of the template that is completely optional. |
| 5064 | * For example, optional chunks can be used to describe the placeholders for |
| 5065 | * arguments that match up with defaulted function parameters, e.g. given: |
| 5066 | * |
| 5067 | * \code |
| 5068 | * void f(int x, float y = 3.14, double z = 2.71828); |
| 5069 | * \endcode |
| 5070 | * |
| 5071 | * The code-completion string for this function would contain: |
| 5072 | * - a TypedText chunk for "f". |
| 5073 | * - a LeftParen chunk for "(". |
| 5074 | * - a Placeholder chunk for "int x" |
| 5075 | * - an Optional chunk containing the remaining defaulted arguments, e.g., |
| 5076 | * - a Comma chunk for "," |
| 5077 | * - a Placeholder chunk for "float y" |
| 5078 | * - an Optional chunk containing the last defaulted argument: |
| 5079 | * - a Comma chunk for "," |
| 5080 | * - a Placeholder chunk for "double z" |
| 5081 | * - a RightParen chunk for ")" |
| 5082 | * |
| 5083 | * There are many ways to handle Optional chunks. Two simple approaches are: |
| 5084 | * - Completely ignore optional chunks, in which case the template for the |
| 5085 | * function "f" would only include the first parameter ("int x"). |
| 5086 | * - Fully expand all optional chunks, in which case the template for the |
| 5087 | * function "f" would have all of the parameters. |
| 5088 | */ |
| 5089 | CXCompletionChunk_Optional, |
| 5090 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5091 | * Text that a user would be expected to type to get this |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5092 | * code-completion result. |
| 5093 | * |
| 5094 | * There will be exactly one "typed text" chunk in a semantic string, which |
| 5095 | * will typically provide the spelling of a keyword or the name of a |
| 5096 | * declaration that could be used at the current code point. Clients are |
| 5097 | * expected to filter the code-completion results based on the text in this |
| 5098 | * chunk. |
| 5099 | */ |
| 5100 | CXCompletionChunk_TypedText, |
| 5101 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5102 | * Text that should be inserted as part of a code-completion result. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5103 | * |
| 5104 | * A "text" chunk represents text that is part of the template to be |
| 5105 | * inserted into user code should this particular code-completion result |
| 5106 | * be selected. |
| 5107 | */ |
| 5108 | CXCompletionChunk_Text, |
| 5109 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5110 | * Placeholder text that should be replaced by the user. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5111 | * |
| 5112 | * A "placeholder" chunk marks a place where the user should insert text |
| 5113 | * into the code-completion template. For example, placeholders might mark |
| 5114 | * the function parameters for a function declaration, to indicate that the |
| 5115 | * user should provide arguments for each of those parameters. The actual |
| 5116 | * text in a placeholder is a suggestion for the text to display before |
| 5117 | * the user replaces the placeholder with real code. |
| 5118 | */ |
| 5119 | CXCompletionChunk_Placeholder, |
| 5120 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5121 | * Informative text that should be displayed but never inserted as |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5122 | * part of the template. |
| 5123 | * |
| 5124 | * An "informative" chunk contains annotations that can be displayed to |
| 5125 | * help the user decide whether a particular code-completion result is the |
| 5126 | * right option, but which is not part of the actual template to be inserted |
| 5127 | * by code completion. |
| 5128 | */ |
| 5129 | CXCompletionChunk_Informative, |
| 5130 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5131 | * Text that describes the current parameter when code-completion is |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5132 | * referring to function call, message send, or template specialization. |
| 5133 | * |
| 5134 | * A "current parameter" chunk occurs when code-completion is providing |
| 5135 | * information about a parameter corresponding to the argument at the |
| 5136 | * code-completion point. For example, given a function |
| 5137 | * |
| 5138 | * \code |
| 5139 | * int add(int x, int y); |
| 5140 | * \endcode |
| 5141 | * |
| 5142 | * and the source code \c add(, where the code-completion point is after the |
| 5143 | * "(", the code-completion string will contain a "current parameter" chunk |
| 5144 | * for "int x", indicating that the current argument will initialize that |
| 5145 | * parameter. After typing further, to \c add(17, (where the code-completion |
| 5146 | * point is after the ","), the code-completion string will contain a |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5147 | * "current parameter" chunk to "int y". |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5148 | */ |
| 5149 | CXCompletionChunk_CurrentParameter, |
| 5150 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5151 | * A left parenthesis ('('), used to initiate a function call or |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5152 | * signal the beginning of a function parameter list. |
| 5153 | */ |
| 5154 | CXCompletionChunk_LeftParen, |
| 5155 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5156 | * A right parenthesis (')'), used to finish a function call or |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5157 | * signal the end of a function parameter list. |
| 5158 | */ |
| 5159 | CXCompletionChunk_RightParen, |
| 5160 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5161 | * A left bracket ('['). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5162 | */ |
| 5163 | CXCompletionChunk_LeftBracket, |
| 5164 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5165 | * A right bracket (']'). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5166 | */ |
| 5167 | CXCompletionChunk_RightBracket, |
| 5168 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5169 | * A left brace ('{'). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5170 | */ |
| 5171 | CXCompletionChunk_LeftBrace, |
| 5172 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5173 | * A right brace ('}'). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5174 | */ |
| 5175 | CXCompletionChunk_RightBrace, |
| 5176 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5177 | * A left angle bracket ('<'). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5178 | */ |
| 5179 | CXCompletionChunk_LeftAngle, |
| 5180 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5181 | * A right angle bracket ('>'). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5182 | */ |
| 5183 | CXCompletionChunk_RightAngle, |
| 5184 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5185 | * A comma separator (','). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5186 | */ |
| 5187 | CXCompletionChunk_Comma, |
| 5188 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5189 | * Text that specifies the result type of a given result. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5190 | * |
| 5191 | * This special kind of informative chunk is not meant to be inserted into |
| 5192 | * the text buffer. Rather, it is meant to illustrate the type that an |
| 5193 | * expression using the given completion string would have. |
| 5194 | */ |
| 5195 | CXCompletionChunk_ResultType, |
| 5196 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5197 | * A colon (':'). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5198 | */ |
| 5199 | CXCompletionChunk_Colon, |
| 5200 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5201 | * A semicolon (';'). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5202 | */ |
| 5203 | CXCompletionChunk_SemiColon, |
| 5204 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5205 | * An '=' sign. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5206 | */ |
| 5207 | CXCompletionChunk_Equal, |
| 5208 | /** |
| 5209 | * Horizontal space (' '). |
| 5210 | */ |
| 5211 | CXCompletionChunk_HorizontalSpace, |
| 5212 | /** |
| 5213 | * Vertical space ('\\n'), after which it is generally a good idea to |
| 5214 | * perform indentation. |
| 5215 | */ |
| 5216 | CXCompletionChunk_VerticalSpace |
| 5217 | }; |
| 5218 | |
| 5219 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5220 | * Determine the kind of a particular chunk within a completion string. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5221 | * |
| 5222 | * \param completion_string the completion string to query. |
| 5223 | * |
| 5224 | * \param chunk_number the 0-based index of the chunk in the completion string. |
| 5225 | * |
| 5226 | * \returns the kind of the chunk at the index \c chunk_number. |
| 5227 | */ |
| 5228 | CINDEX_LINKAGE enum CXCompletionChunkKind |
| 5229 | clang_getCompletionChunkKind(CXCompletionString completion_string, |
| 5230 | unsigned chunk_number); |
| 5231 | |
| 5232 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5233 | * Retrieve the text associated with a particular chunk within a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5234 | * completion string. |
| 5235 | * |
| 5236 | * \param completion_string the completion string to query. |
| 5237 | * |
| 5238 | * \param chunk_number the 0-based index of the chunk in the completion string. |
| 5239 | * |
| 5240 | * \returns the text associated with the chunk at index \c chunk_number. |
| 5241 | */ |
| 5242 | CINDEX_LINKAGE CXString |
| 5243 | clang_getCompletionChunkText(CXCompletionString completion_string, |
| 5244 | unsigned chunk_number); |
| 5245 | |
| 5246 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5247 | * Retrieve the completion string associated with a particular chunk |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5248 | * within a completion string. |
| 5249 | * |
| 5250 | * \param completion_string the completion string to query. |
| 5251 | * |
| 5252 | * \param chunk_number the 0-based index of the chunk in the completion string. |
| 5253 | * |
| 5254 | * \returns the completion string associated with the chunk at index |
| 5255 | * \c chunk_number. |
| 5256 | */ |
| 5257 | CINDEX_LINKAGE CXCompletionString |
| 5258 | clang_getCompletionChunkCompletionString(CXCompletionString completion_string, |
| 5259 | unsigned chunk_number); |
| 5260 | |
| 5261 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5262 | * Retrieve the number of chunks in the given code-completion string. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5263 | */ |
| 5264 | CINDEX_LINKAGE unsigned |
| 5265 | clang_getNumCompletionChunks(CXCompletionString completion_string); |
| 5266 | |
| 5267 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5268 | * Determine the priority of this code completion. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5269 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5270 | * The priority of a code completion indicates how likely it is that this |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5271 | * particular completion is the completion that the user will select. The |
| 5272 | * priority is selected by various internal heuristics. |
| 5273 | * |
| 5274 | * \param completion_string The completion string to query. |
| 5275 | * |
| 5276 | * \returns The priority of this completion string. Smaller values indicate |
| 5277 | * higher-priority (more likely) completions. |
| 5278 | */ |
| 5279 | CINDEX_LINKAGE unsigned |
| 5280 | clang_getCompletionPriority(CXCompletionString completion_string); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5281 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5282 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5283 | * Determine the availability of the entity that this code-completion |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5284 | * string refers to. |
| 5285 | * |
| 5286 | * \param completion_string The completion string to query. |
| 5287 | * |
| 5288 | * \returns The availability of the completion string. |
| 5289 | */ |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5290 | CINDEX_LINKAGE enum CXAvailabilityKind |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5291 | clang_getCompletionAvailability(CXCompletionString completion_string); |
| 5292 | |
| 5293 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5294 | * Retrieve the number of annotations associated with the given |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5295 | * completion string. |
| 5296 | * |
| 5297 | * \param completion_string the completion string to query. |
| 5298 | * |
| 5299 | * \returns the number of annotations associated with the given completion |
| 5300 | * string. |
| 5301 | */ |
| 5302 | CINDEX_LINKAGE unsigned |
| 5303 | clang_getCompletionNumAnnotations(CXCompletionString completion_string); |
| 5304 | |
| 5305 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5306 | * Retrieve the annotation associated with the given completion string. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5307 | * |
| 5308 | * \param completion_string the completion string to query. |
| 5309 | * |
| 5310 | * \param annotation_number the 0-based index of the annotation of the |
| 5311 | * completion string. |
| 5312 | * |
| 5313 | * \returns annotation string associated with the completion at index |
| 5314 | * \c annotation_number, or a NULL string if that annotation is not available. |
| 5315 | */ |
| 5316 | CINDEX_LINKAGE CXString |
| 5317 | clang_getCompletionAnnotation(CXCompletionString completion_string, |
| 5318 | unsigned annotation_number); |
| 5319 | |
| 5320 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5321 | * Retrieve the parent context of the given completion string. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5322 | * |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5323 | * The parent context of a completion string is the semantic parent of |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5324 | * the declaration (if any) that the code completion represents. For example, |
| 5325 | * a code completion for an Objective-C method would have the method's class |
| 5326 | * or protocol as its context. |
| 5327 | * |
| 5328 | * \param completion_string The code completion string whose parent is |
| 5329 | * being queried. |
| 5330 | * |
| 5331 | * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL. |
| 5332 | * |
| 5333 | * \returns The name of the completion parent, e.g., "NSObject" if |
| 5334 | * the completion string represents a method in the NSObject class. |
| 5335 | */ |
| 5336 | CINDEX_LINKAGE CXString |
| 5337 | clang_getCompletionParent(CXCompletionString completion_string, |
| 5338 | enum CXCursorKind *kind); |
| 5339 | |
| 5340 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5341 | * Retrieve the brief documentation comment attached to the declaration |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5342 | * that corresponds to the given completion string. |
| 5343 | */ |
| 5344 | CINDEX_LINKAGE CXString |
| 5345 | clang_getCompletionBriefComment(CXCompletionString completion_string); |
| 5346 | |
| 5347 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5348 | * Retrieve a completion string for an arbitrary declaration or macro |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5349 | * definition cursor. |
| 5350 | * |
| 5351 | * \param cursor The cursor to query. |
| 5352 | * |
| 5353 | * \returns A non-context-sensitive completion string for declaration and macro |
| 5354 | * definition cursors, or NULL for other kinds of cursors. |
| 5355 | */ |
| 5356 | CINDEX_LINKAGE CXCompletionString |
| 5357 | clang_getCursorCompletionString(CXCursor cursor); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5358 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5359 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5360 | * Contains the results of code-completion. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5361 | * |
| 5362 | * This data structure contains the results of code completion, as |
| 5363 | * produced by \c clang_codeCompleteAt(). Its contents must be freed by |
| 5364 | * \c clang_disposeCodeCompleteResults. |
| 5365 | */ |
| 5366 | typedef struct { |
| 5367 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5368 | * The code-completion results. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5369 | */ |
| 5370 | CXCompletionResult *Results; |
| 5371 | |
| 5372 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5373 | * The number of code-completion results stored in the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5374 | * \c Results array. |
| 5375 | */ |
| 5376 | unsigned NumResults; |
| 5377 | } CXCodeCompleteResults; |
| 5378 | |
| 5379 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5380 | * Retrieve the number of fix-its for the given completion index. |
| 5381 | * |
| 5382 | * Calling this makes sense only if CXCodeComplete_IncludeCompletionsWithFixIts |
| 5383 | * option was set. |
| 5384 | * |
| 5385 | * \param results The structure keeping all completion results |
| 5386 | * |
| 5387 | * \param completion_index The index of the completion |
| 5388 | * |
| 5389 | * \return The number of fix-its which must be applied before the completion at |
| 5390 | * completion_index can be applied |
| 5391 | */ |
| 5392 | CINDEX_LINKAGE unsigned |
| 5393 | clang_getCompletionNumFixIts(CXCodeCompleteResults *results, |
| 5394 | unsigned completion_index); |
| 5395 | |
| 5396 | /** |
| 5397 | * Fix-its that *must* be applied before inserting the text for the |
| 5398 | * corresponding completion. |
| 5399 | * |
| 5400 | * By default, clang_codeCompleteAt() only returns completions with empty |
| 5401 | * fix-its. Extra completions with non-empty fix-its should be explicitly |
| 5402 | * requested by setting CXCodeComplete_IncludeCompletionsWithFixIts. |
| 5403 | * |
| 5404 | * For the clients to be able to compute position of the cursor after applying |
| 5405 | * fix-its, the following conditions are guaranteed to hold for |
| 5406 | * replacement_range of the stored fix-its: |
| 5407 | * - Ranges in the fix-its are guaranteed to never contain the completion |
| 5408 | * point (or identifier under completion point, if any) inside them, except |
| 5409 | * at the start or at the end of the range. |
| 5410 | * - If a fix-it range starts or ends with completion point (or starts or |
| 5411 | * ends after the identifier under completion point), it will contain at |
| 5412 | * least one character. It allows to unambiguously recompute completion |
| 5413 | * point after applying the fix-it. |
| 5414 | * |
| 5415 | * The intuition is that provided fix-its change code around the identifier we |
| 5416 | * complete, but are not allowed to touch the identifier itself or the |
| 5417 | * completion point. One example of completions with corrections are the ones |
| 5418 | * replacing '.' with '->' and vice versa: |
| 5419 | * |
| 5420 | * std::unique_ptr<std::vector<int>> vec_ptr; |
| 5421 | * In 'vec_ptr.^', one of the completions is 'push_back', it requires |
| 5422 | * replacing '.' with '->'. |
| 5423 | * In 'vec_ptr->^', one of the completions is 'release', it requires |
| 5424 | * replacing '->' with '.'. |
| 5425 | * |
| 5426 | * \param results The structure keeping all completion results |
| 5427 | * |
| 5428 | * \param completion_index The index of the completion |
| 5429 | * |
| 5430 | * \param fixit_index The index of the fix-it for the completion at |
| 5431 | * completion_index |
| 5432 | * |
| 5433 | * \param replacement_range The fix-it range that must be replaced before the |
| 5434 | * completion at completion_index can be applied |
| 5435 | * |
| 5436 | * \returns The fix-it string that must replace the code at replacement_range |
| 5437 | * before the completion at completion_index can be applied |
| 5438 | */ |
| 5439 | CINDEX_LINKAGE CXString clang_getCompletionFixIt( |
| 5440 | CXCodeCompleteResults *results, unsigned completion_index, |
| 5441 | unsigned fixit_index, CXSourceRange *replacement_range); |
| 5442 | |
| 5443 | /** |
| 5444 | * Flags that can be passed to \c clang_codeCompleteAt() to |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5445 | * modify its behavior. |
| 5446 | * |
| 5447 | * The enumerators in this enumeration can be bitwise-OR'd together to |
| 5448 | * provide multiple options to \c clang_codeCompleteAt(). |
| 5449 | */ |
| 5450 | enum CXCodeComplete_Flags { |
| 5451 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5452 | * Whether to include macros within the set of code |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5453 | * completions returned. |
| 5454 | */ |
| 5455 | CXCodeComplete_IncludeMacros = 0x01, |
| 5456 | |
| 5457 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5458 | * Whether to include code patterns for language constructs |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5459 | * within the set of code completions, e.g., for loops. |
| 5460 | */ |
| 5461 | CXCodeComplete_IncludeCodePatterns = 0x02, |
| 5462 | |
| 5463 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5464 | * Whether to include brief documentation within the set of code |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5465 | * completions returned. |
| 5466 | */ |
| 5467 | CXCodeComplete_IncludeBriefComments = 0x04, |
| 5468 | |
| 5469 | /** |
| 5470 | * Whether to speed up completion by omitting top- or namespace-level entities |
| 5471 | * defined in the preamble. There's no guarantee any particular entity is |
| 5472 | * omitted. This may be useful if the headers are indexed externally. |
| 5473 | */ |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5474 | CXCodeComplete_SkipPreamble = 0x08, |
| 5475 | |
| 5476 | /** |
| 5477 | * Whether to include completions with small |
| 5478 | * fix-its, e.g. change '.' to '->' on member access, etc. |
| 5479 | */ |
| 5480 | CXCodeComplete_IncludeCompletionsWithFixIts = 0x10 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5481 | }; |
| 5482 | |
| 5483 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5484 | * Bits that represent the context under which completion is occurring. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5485 | * |
| 5486 | * The enumerators in this enumeration may be bitwise-OR'd together if multiple |
| 5487 | * contexts are occurring simultaneously. |
| 5488 | */ |
| 5489 | enum CXCompletionContext { |
| 5490 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5491 | * The context for completions is unexposed, as only Clang results |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5492 | * should be included. (This is equivalent to having no context bits set.) |
| 5493 | */ |
| 5494 | CXCompletionContext_Unexposed = 0, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5495 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5496 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5497 | * Completions for any possible type should be included in the results. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5498 | */ |
| 5499 | CXCompletionContext_AnyType = 1 << 0, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5500 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5501 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5502 | * Completions for any possible value (variables, function calls, etc.) |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5503 | * should be included in the results. |
| 5504 | */ |
| 5505 | CXCompletionContext_AnyValue = 1 << 1, |
| 5506 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5507 | * Completions for values that resolve to an Objective-C object should |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5508 | * be included in the results. |
| 5509 | */ |
| 5510 | CXCompletionContext_ObjCObjectValue = 1 << 2, |
| 5511 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5512 | * Completions for values that resolve to an Objective-C selector |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5513 | * should be included in the results. |
| 5514 | */ |
| 5515 | CXCompletionContext_ObjCSelectorValue = 1 << 3, |
| 5516 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5517 | * Completions for values that resolve to a C++ class type should be |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5518 | * included in the results. |
| 5519 | */ |
| 5520 | CXCompletionContext_CXXClassTypeValue = 1 << 4, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5521 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5522 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5523 | * Completions for fields of the member being accessed using the dot |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5524 | * operator should be included in the results. |
| 5525 | */ |
| 5526 | CXCompletionContext_DotMemberAccess = 1 << 5, |
| 5527 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5528 | * Completions for fields of the member being accessed using the arrow |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5529 | * operator should be included in the results. |
| 5530 | */ |
| 5531 | CXCompletionContext_ArrowMemberAccess = 1 << 6, |
| 5532 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5533 | * Completions for properties of the Objective-C object being accessed |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5534 | * using the dot operator should be included in the results. |
| 5535 | */ |
| 5536 | CXCompletionContext_ObjCPropertyAccess = 1 << 7, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5537 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5538 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5539 | * Completions for enum tags should be included in the results. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5540 | */ |
| 5541 | CXCompletionContext_EnumTag = 1 << 8, |
| 5542 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5543 | * Completions for union tags should be included in the results. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5544 | */ |
| 5545 | CXCompletionContext_UnionTag = 1 << 9, |
| 5546 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5547 | * Completions for struct tags should be included in the results. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5548 | */ |
| 5549 | CXCompletionContext_StructTag = 1 << 10, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5550 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5551 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5552 | * Completions for C++ class names should be included in the results. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5553 | */ |
| 5554 | CXCompletionContext_ClassTag = 1 << 11, |
| 5555 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5556 | * Completions for C++ namespaces and namespace aliases should be |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5557 | * included in the results. |
| 5558 | */ |
| 5559 | CXCompletionContext_Namespace = 1 << 12, |
| 5560 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5561 | * Completions for C++ nested name specifiers should be included in |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5562 | * the results. |
| 5563 | */ |
| 5564 | CXCompletionContext_NestedNameSpecifier = 1 << 13, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5565 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5566 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5567 | * Completions for Objective-C interfaces (classes) should be included |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5568 | * in the results. |
| 5569 | */ |
| 5570 | CXCompletionContext_ObjCInterface = 1 << 14, |
| 5571 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5572 | * Completions for Objective-C protocols should be included in |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5573 | * the results. |
| 5574 | */ |
| 5575 | CXCompletionContext_ObjCProtocol = 1 << 15, |
| 5576 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5577 | * Completions for Objective-C categories should be included in |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5578 | * the results. |
| 5579 | */ |
| 5580 | CXCompletionContext_ObjCCategory = 1 << 16, |
| 5581 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5582 | * Completions for Objective-C instance messages should be included |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5583 | * in the results. |
| 5584 | */ |
| 5585 | CXCompletionContext_ObjCInstanceMessage = 1 << 17, |
| 5586 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5587 | * Completions for Objective-C class messages should be included in |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5588 | * the results. |
| 5589 | */ |
| 5590 | CXCompletionContext_ObjCClassMessage = 1 << 18, |
| 5591 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5592 | * Completions for Objective-C selector names should be included in |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5593 | * the results. |
| 5594 | */ |
| 5595 | CXCompletionContext_ObjCSelectorName = 1 << 19, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5596 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5597 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5598 | * Completions for preprocessor macro names should be included in |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5599 | * the results. |
| 5600 | */ |
| 5601 | CXCompletionContext_MacroName = 1 << 20, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5602 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5603 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5604 | * Natural language completions should be included in the results. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5605 | */ |
| 5606 | CXCompletionContext_NaturalLanguage = 1 << 21, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5607 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5608 | /** |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame^] | 5609 | * #include file completions should be included in the results. |
| 5610 | */ |
| 5611 | CXCompletionContext_IncludedFile = 1 << 22, |
| 5612 | |
| 5613 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5614 | * The current context is unknown, so set all contexts. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5615 | */ |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame^] | 5616 | CXCompletionContext_Unknown = ((1 << 23) - 1) |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5617 | }; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5618 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5619 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5620 | * Returns a default set of code-completion options that can be |
| 5621 | * passed to\c clang_codeCompleteAt(). |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5622 | */ |
| 5623 | CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void); |
| 5624 | |
| 5625 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5626 | * Perform code completion at a given location in a translation unit. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5627 | * |
| 5628 | * This function performs code completion at a particular file, line, and |
| 5629 | * column within source code, providing results that suggest potential |
| 5630 | * code snippets based on the context of the completion. The basic model |
| 5631 | * for code completion is that Clang will parse a complete source file, |
| 5632 | * performing syntax checking up to the location where code-completion has |
| 5633 | * been requested. At that point, a special code-completion token is passed |
| 5634 | * to the parser, which recognizes this token and determines, based on the |
| 5635 | * current location in the C/Objective-C/C++ grammar and the state of |
| 5636 | * semantic analysis, what completions to provide. These completions are |
| 5637 | * returned via a new \c CXCodeCompleteResults structure. |
| 5638 | * |
| 5639 | * Code completion itself is meant to be triggered by the client when the |
| 5640 | * user types punctuation characters or whitespace, at which point the |
| 5641 | * code-completion location will coincide with the cursor. For example, if \c p |
| 5642 | * is a pointer, code-completion might be triggered after the "-" and then |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5643 | * after the ">" in \c p->. When the code-completion location is after the ">", |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5644 | * the completion results will provide, e.g., the members of the struct that |
| 5645 | * "p" points to. The client is responsible for placing the cursor at the |
| 5646 | * beginning of the token currently being typed, then filtering the results |
| 5647 | * based on the contents of the token. For example, when code-completing for |
| 5648 | * the expression \c p->get, the client should provide the location just after |
| 5649 | * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the |
| 5650 | * client can filter the results based on the current token text ("get"), only |
| 5651 | * showing those results that start with "get". The intent of this interface |
| 5652 | * is to separate the relatively high-latency acquisition of code-completion |
| 5653 | * results from the filtering of results on a per-character basis, which must |
| 5654 | * have a lower latency. |
| 5655 | * |
| 5656 | * \param TU The translation unit in which code-completion should |
| 5657 | * occur. The source files for this translation unit need not be |
| 5658 | * completely up-to-date (and the contents of those source files may |
| 5659 | * be overridden via \p unsaved_files). Cursors referring into the |
| 5660 | * translation unit may be invalidated by this invocation. |
| 5661 | * |
| 5662 | * \param complete_filename The name of the source file where code |
| 5663 | * completion should be performed. This filename may be any file |
| 5664 | * included in the translation unit. |
| 5665 | * |
| 5666 | * \param complete_line The line at which code-completion should occur. |
| 5667 | * |
| 5668 | * \param complete_column The column at which code-completion should occur. |
| 5669 | * Note that the column should point just after the syntactic construct that |
| 5670 | * initiated code completion, and not in the middle of a lexical token. |
| 5671 | * |
| 5672 | * \param unsaved_files the Files that have not yet been saved to disk |
| 5673 | * but may be required for parsing or code completion, including the |
| 5674 | * contents of those files. The contents and name of these files (as |
| 5675 | * specified by CXUnsavedFile) are copied when necessary, so the |
| 5676 | * client only needs to guarantee their validity until the call to |
| 5677 | * this function returns. |
| 5678 | * |
| 5679 | * \param num_unsaved_files The number of unsaved file entries in \p |
| 5680 | * unsaved_files. |
| 5681 | * |
| 5682 | * \param options Extra options that control the behavior of code |
| 5683 | * completion, expressed as a bitwise OR of the enumerators of the |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5684 | * CXCodeComplete_Flags enumeration. The |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5685 | * \c clang_defaultCodeCompleteOptions() function returns a default set |
| 5686 | * of code-completion options. |
| 5687 | * |
| 5688 | * \returns If successful, a new \c CXCodeCompleteResults structure |
| 5689 | * containing code-completion results, which should eventually be |
| 5690 | * freed with \c clang_disposeCodeCompleteResults(). If code |
| 5691 | * completion fails, returns NULL. |
| 5692 | */ |
| 5693 | CINDEX_LINKAGE |
| 5694 | CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU, |
| 5695 | const char *complete_filename, |
| 5696 | unsigned complete_line, |
| 5697 | unsigned complete_column, |
| 5698 | struct CXUnsavedFile *unsaved_files, |
| 5699 | unsigned num_unsaved_files, |
| 5700 | unsigned options); |
| 5701 | |
| 5702 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5703 | * Sort the code-completion results in case-insensitive alphabetical |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5704 | * order. |
| 5705 | * |
| 5706 | * \param Results The set of results to sort. |
| 5707 | * \param NumResults The number of results in \p Results. |
| 5708 | */ |
| 5709 | CINDEX_LINKAGE |
| 5710 | void clang_sortCodeCompletionResults(CXCompletionResult *Results, |
| 5711 | unsigned NumResults); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5712 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5713 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5714 | * Free the given set of code-completion results. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5715 | */ |
| 5716 | CINDEX_LINKAGE |
| 5717 | void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5718 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5719 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5720 | * Determine the number of diagnostics produced prior to the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5721 | * location where code completion was performed. |
| 5722 | */ |
| 5723 | CINDEX_LINKAGE |
| 5724 | unsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results); |
| 5725 | |
| 5726 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5727 | * Retrieve a diagnostic associated with the given code completion. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5728 | * |
| 5729 | * \param Results the code completion results to query. |
| 5730 | * \param Index the zero-based diagnostic number to retrieve. |
| 5731 | * |
| 5732 | * \returns the requested diagnostic. This diagnostic must be freed |
| 5733 | * via a call to \c clang_disposeDiagnostic(). |
| 5734 | */ |
| 5735 | CINDEX_LINKAGE |
| 5736 | CXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results, |
| 5737 | unsigned Index); |
| 5738 | |
| 5739 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5740 | * Determines what completions are appropriate for the context |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5741 | * the given code completion. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5742 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5743 | * \param Results the code completion results to query |
| 5744 | * |
| 5745 | * \returns the kinds of completions that are appropriate for use |
| 5746 | * along with the given code completion results. |
| 5747 | */ |
| 5748 | CINDEX_LINKAGE |
| 5749 | unsigned long long clang_codeCompleteGetContexts( |
| 5750 | CXCodeCompleteResults *Results); |
| 5751 | |
| 5752 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5753 | * Returns the cursor kind for the container for the current code |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5754 | * completion context. The container is only guaranteed to be set for |
| 5755 | * contexts where a container exists (i.e. member accesses or Objective-C |
| 5756 | * message sends); if there is not a container, this function will return |
| 5757 | * CXCursor_InvalidCode. |
| 5758 | * |
| 5759 | * \param Results the code completion results to query |
| 5760 | * |
| 5761 | * \param IsIncomplete on return, this value will be false if Clang has complete |
| 5762 | * information about the container. If Clang does not have complete |
| 5763 | * information, this value will be true. |
| 5764 | * |
| 5765 | * \returns the container kind, or CXCursor_InvalidCode if there is not a |
| 5766 | * container |
| 5767 | */ |
| 5768 | CINDEX_LINKAGE |
| 5769 | enum CXCursorKind clang_codeCompleteGetContainerKind( |
| 5770 | CXCodeCompleteResults *Results, |
| 5771 | unsigned *IsIncomplete); |
| 5772 | |
| 5773 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5774 | * Returns the USR for the container for the current code completion |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5775 | * context. If there is not a container for the current context, this |
| 5776 | * function will return the empty string. |
| 5777 | * |
| 5778 | * \param Results the code completion results to query |
| 5779 | * |
| 5780 | * \returns the USR for the container |
| 5781 | */ |
| 5782 | CINDEX_LINKAGE |
| 5783 | CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results); |
| 5784 | |
| 5785 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5786 | * Returns the currently-entered selector for an Objective-C message |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5787 | * send, formatted like "initWithFoo:bar:". Only guaranteed to return a |
| 5788 | * non-empty string for CXCompletionContext_ObjCInstanceMessage and |
| 5789 | * CXCompletionContext_ObjCClassMessage. |
| 5790 | * |
| 5791 | * \param Results the code completion results to query |
| 5792 | * |
| 5793 | * \returns the selector (or partial selector) that has been entered thus far |
| 5794 | * for an Objective-C message send. |
| 5795 | */ |
| 5796 | CINDEX_LINKAGE |
| 5797 | CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5798 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5799 | /** |
| 5800 | * @} |
| 5801 | */ |
| 5802 | |
| 5803 | /** |
| 5804 | * \defgroup CINDEX_MISC Miscellaneous utility functions |
| 5805 | * |
| 5806 | * @{ |
| 5807 | */ |
| 5808 | |
| 5809 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5810 | * Return a version string, suitable for showing to a user, but not |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5811 | * intended to be parsed (the format is not guaranteed to be stable). |
| 5812 | */ |
| 5813 | CINDEX_LINKAGE CXString clang_getClangVersion(void); |
| 5814 | |
| 5815 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5816 | * Enable/disable crash recovery. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5817 | * |
| 5818 | * \param isEnabled Flag to indicate if crash recovery is enabled. A non-zero |
| 5819 | * value enables crash recovery, while 0 disables it. |
| 5820 | */ |
| 5821 | CINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5822 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5823 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5824 | * Visitor invoked for each file in a translation unit |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5825 | * (used with clang_getInclusions()). |
| 5826 | * |
| 5827 | * This visitor function will be invoked by clang_getInclusions() for each |
| 5828 | * file included (either at the top-level or by \#include directives) within |
| 5829 | * a translation unit. The first argument is the file being included, and |
| 5830 | * the second and third arguments provide the inclusion stack. The |
| 5831 | * array is sorted in order of immediate inclusion. For example, |
| 5832 | * the first element refers to the location that included 'included_file'. |
| 5833 | */ |
| 5834 | typedef void (*CXInclusionVisitor)(CXFile included_file, |
| 5835 | CXSourceLocation* inclusion_stack, |
| 5836 | unsigned include_len, |
| 5837 | CXClientData client_data); |
| 5838 | |
| 5839 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5840 | * Visit the set of preprocessor inclusions in a translation unit. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5841 | * The visitor function is called with the provided data for every included |
| 5842 | * file. This does not include headers included by the PCH file (unless one |
| 5843 | * is inspecting the inclusions in the PCH file itself). |
| 5844 | */ |
| 5845 | CINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu, |
| 5846 | CXInclusionVisitor visitor, |
| 5847 | CXClientData client_data); |
| 5848 | |
| 5849 | typedef enum { |
| 5850 | CXEval_Int = 1 , |
| 5851 | CXEval_Float = 2, |
| 5852 | CXEval_ObjCStrLiteral = 3, |
| 5853 | CXEval_StrLiteral = 4, |
| 5854 | CXEval_CFStr = 5, |
| 5855 | CXEval_Other = 6, |
| 5856 | |
| 5857 | CXEval_UnExposed = 0 |
| 5858 | |
| 5859 | } CXEvalResultKind ; |
| 5860 | |
| 5861 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5862 | * Evaluation result of a cursor |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5863 | */ |
| 5864 | typedef void * CXEvalResult; |
| 5865 | |
| 5866 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5867 | * If cursor is a statement declaration tries to evaluate the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5868 | * statement and if its variable, tries to evaluate its initializer, |
| 5869 | * into its corresponding type. |
| 5870 | */ |
| 5871 | CINDEX_LINKAGE CXEvalResult clang_Cursor_Evaluate(CXCursor C); |
| 5872 | |
| 5873 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5874 | * Returns the kind of the evaluated result. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5875 | */ |
| 5876 | CINDEX_LINKAGE CXEvalResultKind clang_EvalResult_getKind(CXEvalResult E); |
| 5877 | |
| 5878 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5879 | * Returns the evaluation result as integer if the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5880 | * kind is Int. |
| 5881 | */ |
| 5882 | CINDEX_LINKAGE int clang_EvalResult_getAsInt(CXEvalResult E); |
| 5883 | |
| 5884 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5885 | * Returns the evaluation result as a long long integer if the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5886 | * kind is Int. This prevents overflows that may happen if the result is |
| 5887 | * returned with clang_EvalResult_getAsInt. |
| 5888 | */ |
| 5889 | CINDEX_LINKAGE long long clang_EvalResult_getAsLongLong(CXEvalResult E); |
| 5890 | |
| 5891 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5892 | * Returns a non-zero value if the kind is Int and the evaluation |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5893 | * result resulted in an unsigned integer. |
| 5894 | */ |
| 5895 | CINDEX_LINKAGE unsigned clang_EvalResult_isUnsignedInt(CXEvalResult E); |
| 5896 | |
| 5897 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5898 | * Returns the evaluation result as an unsigned integer if |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5899 | * the kind is Int and clang_EvalResult_isUnsignedInt is non-zero. |
| 5900 | */ |
| 5901 | CINDEX_LINKAGE unsigned long long clang_EvalResult_getAsUnsigned(CXEvalResult E); |
| 5902 | |
| 5903 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5904 | * Returns the evaluation result as double if the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5905 | * kind is double. |
| 5906 | */ |
| 5907 | CINDEX_LINKAGE double clang_EvalResult_getAsDouble(CXEvalResult E); |
| 5908 | |
| 5909 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5910 | * Returns the evaluation result as a constant string if the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5911 | * kind is other than Int or float. User must not free this pointer, |
| 5912 | * instead call clang_EvalResult_dispose on the CXEvalResult returned |
| 5913 | * by clang_Cursor_Evaluate. |
| 5914 | */ |
| 5915 | CINDEX_LINKAGE const char* clang_EvalResult_getAsStr(CXEvalResult E); |
| 5916 | |
| 5917 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5918 | * Disposes the created Eval memory. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5919 | */ |
| 5920 | CINDEX_LINKAGE void clang_EvalResult_dispose(CXEvalResult E); |
| 5921 | /** |
| 5922 | * @} |
| 5923 | */ |
| 5924 | |
| 5925 | /** \defgroup CINDEX_REMAPPING Remapping functions |
| 5926 | * |
| 5927 | * @{ |
| 5928 | */ |
| 5929 | |
| 5930 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5931 | * A remapping of original source files and their translated files. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5932 | */ |
| 5933 | typedef void *CXRemapping; |
| 5934 | |
| 5935 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5936 | * Retrieve a remapping. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5937 | * |
| 5938 | * \param path the path that contains metadata about remappings. |
| 5939 | * |
| 5940 | * \returns the requested remapping. This remapping must be freed |
| 5941 | * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. |
| 5942 | */ |
| 5943 | CINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path); |
| 5944 | |
| 5945 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5946 | * Retrieve a remapping. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5947 | * |
| 5948 | * \param filePaths pointer to an array of file paths containing remapping info. |
| 5949 | * |
| 5950 | * \param numFiles number of file paths. |
| 5951 | * |
| 5952 | * \returns the requested remapping. This remapping must be freed |
| 5953 | * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. |
| 5954 | */ |
| 5955 | CINDEX_LINKAGE |
| 5956 | CXRemapping clang_getRemappingsFromFileList(const char **filePaths, |
| 5957 | unsigned numFiles); |
| 5958 | |
| 5959 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5960 | * Determine the number of remappings. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5961 | */ |
| 5962 | CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping); |
| 5963 | |
| 5964 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5965 | * Get the original and the associated filename from the remapping. |
| 5966 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5967 | * \param original If non-NULL, will be set to the original filename. |
| 5968 | * |
| 5969 | * \param transformed If non-NULL, will be set to the filename that the original |
| 5970 | * is associated with. |
| 5971 | */ |
| 5972 | CINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index, |
| 5973 | CXString *original, CXString *transformed); |
| 5974 | |
| 5975 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 5976 | * Dispose the remapping. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 5977 | */ |
| 5978 | CINDEX_LINKAGE void clang_remap_dispose(CXRemapping); |
| 5979 | |
| 5980 | /** |
| 5981 | * @} |
| 5982 | */ |
| 5983 | |
| 5984 | /** \defgroup CINDEX_HIGH Higher level API functions |
| 5985 | * |
| 5986 | * @{ |
| 5987 | */ |
| 5988 | |
| 5989 | enum CXVisitorResult { |
| 5990 | CXVisit_Break, |
| 5991 | CXVisit_Continue |
| 5992 | }; |
| 5993 | |
| 5994 | typedef struct CXCursorAndRangeVisitor { |
| 5995 | void *context; |
| 5996 | enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange); |
| 5997 | } CXCursorAndRangeVisitor; |
| 5998 | |
| 5999 | typedef enum { |
| 6000 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6001 | * Function returned successfully. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6002 | */ |
| 6003 | CXResult_Success = 0, |
| 6004 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6005 | * One of the parameters was invalid for the function. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6006 | */ |
| 6007 | CXResult_Invalid = 1, |
| 6008 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6009 | * The function was terminated by a callback (e.g. it returned |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6010 | * CXVisit_Break) |
| 6011 | */ |
| 6012 | CXResult_VisitBreak = 2 |
| 6013 | |
| 6014 | } CXResult; |
| 6015 | |
| 6016 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6017 | * Find references of a declaration in a specific file. |
| 6018 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6019 | * \param cursor pointing to a declaration or a reference of one. |
| 6020 | * |
| 6021 | * \param file to search for references. |
| 6022 | * |
| 6023 | * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for |
| 6024 | * each reference found. |
| 6025 | * The CXSourceRange will point inside the file; if the reference is inside |
| 6026 | * a macro (and not a macro argument) the CXSourceRange will be invalid. |
| 6027 | * |
| 6028 | * \returns one of the CXResult enumerators. |
| 6029 | */ |
| 6030 | CINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file, |
| 6031 | CXCursorAndRangeVisitor visitor); |
| 6032 | |
| 6033 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6034 | * Find #import/#include directives in a specific file. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6035 | * |
| 6036 | * \param TU translation unit containing the file to query. |
| 6037 | * |
| 6038 | * \param file to search for #import/#include directives. |
| 6039 | * |
| 6040 | * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for |
| 6041 | * each directive found. |
| 6042 | * |
| 6043 | * \returns one of the CXResult enumerators. |
| 6044 | */ |
| 6045 | CINDEX_LINKAGE CXResult clang_findIncludesInFile(CXTranslationUnit TU, |
| 6046 | CXFile file, |
| 6047 | CXCursorAndRangeVisitor visitor); |
| 6048 | |
| 6049 | #ifdef __has_feature |
| 6050 | # if __has_feature(blocks) |
| 6051 | |
| 6052 | typedef enum CXVisitorResult |
| 6053 | (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange); |
| 6054 | |
| 6055 | CINDEX_LINKAGE |
| 6056 | CXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile, |
| 6057 | CXCursorAndRangeVisitorBlock); |
| 6058 | |
| 6059 | CINDEX_LINKAGE |
| 6060 | CXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile, |
| 6061 | CXCursorAndRangeVisitorBlock); |
| 6062 | |
| 6063 | # endif |
| 6064 | #endif |
| 6065 | |
| 6066 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6067 | * The client's data object that is associated with a CXFile. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6068 | */ |
| 6069 | typedef void *CXIdxClientFile; |
| 6070 | |
| 6071 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6072 | * The client's data object that is associated with a semantic entity. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6073 | */ |
| 6074 | typedef void *CXIdxClientEntity; |
| 6075 | |
| 6076 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6077 | * The client's data object that is associated with a semantic container |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6078 | * of entities. |
| 6079 | */ |
| 6080 | typedef void *CXIdxClientContainer; |
| 6081 | |
| 6082 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6083 | * The client's data object that is associated with an AST file (PCH |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6084 | * or module). |
| 6085 | */ |
| 6086 | typedef void *CXIdxClientASTFile; |
| 6087 | |
| 6088 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6089 | * Source location passed to index callbacks. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6090 | */ |
| 6091 | typedef struct { |
| 6092 | void *ptr_data[2]; |
| 6093 | unsigned int_data; |
| 6094 | } CXIdxLoc; |
| 6095 | |
| 6096 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6097 | * Data for ppIncludedFile callback. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6098 | */ |
| 6099 | typedef struct { |
| 6100 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6101 | * Location of '#' in the \#include/\#import directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6102 | */ |
| 6103 | CXIdxLoc hashLoc; |
| 6104 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6105 | * Filename as written in the \#include/\#import directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6106 | */ |
| 6107 | const char *filename; |
| 6108 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6109 | * The actual file that the \#include/\#import directive resolved to. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6110 | */ |
| 6111 | CXFile file; |
| 6112 | int isImport; |
| 6113 | int isAngled; |
| 6114 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6115 | * Non-zero if the directive was automatically turned into a module |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6116 | * import. |
| 6117 | */ |
| 6118 | int isModuleImport; |
| 6119 | } CXIdxIncludedFileInfo; |
| 6120 | |
| 6121 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6122 | * Data for IndexerCallbacks#importedASTFile. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6123 | */ |
| 6124 | typedef struct { |
| 6125 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6126 | * Top level AST file containing the imported PCH, module or submodule. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6127 | */ |
| 6128 | CXFile file; |
| 6129 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6130 | * The imported module or NULL if the AST file is a PCH. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6131 | */ |
| 6132 | CXModule module; |
| 6133 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6134 | * Location where the file is imported. Applicable only for modules. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6135 | */ |
| 6136 | CXIdxLoc loc; |
| 6137 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6138 | * Non-zero if an inclusion directive was automatically turned into |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6139 | * a module import. Applicable only for modules. |
| 6140 | */ |
| 6141 | int isImplicit; |
| 6142 | |
| 6143 | } CXIdxImportedASTFileInfo; |
| 6144 | |
| 6145 | typedef enum { |
| 6146 | CXIdxEntity_Unexposed = 0, |
| 6147 | CXIdxEntity_Typedef = 1, |
| 6148 | CXIdxEntity_Function = 2, |
| 6149 | CXIdxEntity_Variable = 3, |
| 6150 | CXIdxEntity_Field = 4, |
| 6151 | CXIdxEntity_EnumConstant = 5, |
| 6152 | |
| 6153 | CXIdxEntity_ObjCClass = 6, |
| 6154 | CXIdxEntity_ObjCProtocol = 7, |
| 6155 | CXIdxEntity_ObjCCategory = 8, |
| 6156 | |
| 6157 | CXIdxEntity_ObjCInstanceMethod = 9, |
| 6158 | CXIdxEntity_ObjCClassMethod = 10, |
| 6159 | CXIdxEntity_ObjCProperty = 11, |
| 6160 | CXIdxEntity_ObjCIvar = 12, |
| 6161 | |
| 6162 | CXIdxEntity_Enum = 13, |
| 6163 | CXIdxEntity_Struct = 14, |
| 6164 | CXIdxEntity_Union = 15, |
| 6165 | |
| 6166 | CXIdxEntity_CXXClass = 16, |
| 6167 | CXIdxEntity_CXXNamespace = 17, |
| 6168 | CXIdxEntity_CXXNamespaceAlias = 18, |
| 6169 | CXIdxEntity_CXXStaticVariable = 19, |
| 6170 | CXIdxEntity_CXXStaticMethod = 20, |
| 6171 | CXIdxEntity_CXXInstanceMethod = 21, |
| 6172 | CXIdxEntity_CXXConstructor = 22, |
| 6173 | CXIdxEntity_CXXDestructor = 23, |
| 6174 | CXIdxEntity_CXXConversionFunction = 24, |
| 6175 | CXIdxEntity_CXXTypeAlias = 25, |
| 6176 | CXIdxEntity_CXXInterface = 26 |
| 6177 | |
| 6178 | } CXIdxEntityKind; |
| 6179 | |
| 6180 | typedef enum { |
| 6181 | CXIdxEntityLang_None = 0, |
| 6182 | CXIdxEntityLang_C = 1, |
| 6183 | CXIdxEntityLang_ObjC = 2, |
| 6184 | CXIdxEntityLang_CXX = 3, |
| 6185 | CXIdxEntityLang_Swift = 4 |
| 6186 | } CXIdxEntityLanguage; |
| 6187 | |
| 6188 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6189 | * Extra C++ template information for an entity. This can apply to: |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6190 | * CXIdxEntity_Function |
| 6191 | * CXIdxEntity_CXXClass |
| 6192 | * CXIdxEntity_CXXStaticMethod |
| 6193 | * CXIdxEntity_CXXInstanceMethod |
| 6194 | * CXIdxEntity_CXXConstructor |
| 6195 | * CXIdxEntity_CXXConversionFunction |
| 6196 | * CXIdxEntity_CXXTypeAlias |
| 6197 | */ |
| 6198 | typedef enum { |
| 6199 | CXIdxEntity_NonTemplate = 0, |
| 6200 | CXIdxEntity_Template = 1, |
| 6201 | CXIdxEntity_TemplatePartialSpecialization = 2, |
| 6202 | CXIdxEntity_TemplateSpecialization = 3 |
| 6203 | } CXIdxEntityCXXTemplateKind; |
| 6204 | |
| 6205 | typedef enum { |
| 6206 | CXIdxAttr_Unexposed = 0, |
| 6207 | CXIdxAttr_IBAction = 1, |
| 6208 | CXIdxAttr_IBOutlet = 2, |
| 6209 | CXIdxAttr_IBOutletCollection = 3 |
| 6210 | } CXIdxAttrKind; |
| 6211 | |
| 6212 | typedef struct { |
| 6213 | CXIdxAttrKind kind; |
| 6214 | CXCursor cursor; |
| 6215 | CXIdxLoc loc; |
| 6216 | } CXIdxAttrInfo; |
| 6217 | |
| 6218 | typedef struct { |
| 6219 | CXIdxEntityKind kind; |
| 6220 | CXIdxEntityCXXTemplateKind templateKind; |
| 6221 | CXIdxEntityLanguage lang; |
| 6222 | const char *name; |
| 6223 | const char *USR; |
| 6224 | CXCursor cursor; |
| 6225 | const CXIdxAttrInfo *const *attributes; |
| 6226 | unsigned numAttributes; |
| 6227 | } CXIdxEntityInfo; |
| 6228 | |
| 6229 | typedef struct { |
| 6230 | CXCursor cursor; |
| 6231 | } CXIdxContainerInfo; |
| 6232 | |
| 6233 | typedef struct { |
| 6234 | const CXIdxAttrInfo *attrInfo; |
| 6235 | const CXIdxEntityInfo *objcClass; |
| 6236 | CXCursor classCursor; |
| 6237 | CXIdxLoc classLoc; |
| 6238 | } CXIdxIBOutletCollectionAttrInfo; |
| 6239 | |
| 6240 | typedef enum { |
| 6241 | CXIdxDeclFlag_Skipped = 0x1 |
| 6242 | } CXIdxDeclInfoFlags; |
| 6243 | |
| 6244 | typedef struct { |
| 6245 | const CXIdxEntityInfo *entityInfo; |
| 6246 | CXCursor cursor; |
| 6247 | CXIdxLoc loc; |
| 6248 | const CXIdxContainerInfo *semanticContainer; |
| 6249 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6250 | * Generally same as #semanticContainer but can be different in |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6251 | * cases like out-of-line C++ member functions. |
| 6252 | */ |
| 6253 | const CXIdxContainerInfo *lexicalContainer; |
| 6254 | int isRedeclaration; |
| 6255 | int isDefinition; |
| 6256 | int isContainer; |
| 6257 | const CXIdxContainerInfo *declAsContainer; |
| 6258 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6259 | * Whether the declaration exists in code or was created implicitly |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6260 | * by the compiler, e.g. implicit Objective-C methods for properties. |
| 6261 | */ |
| 6262 | int isImplicit; |
| 6263 | const CXIdxAttrInfo *const *attributes; |
| 6264 | unsigned numAttributes; |
| 6265 | |
| 6266 | unsigned flags; |
| 6267 | |
| 6268 | } CXIdxDeclInfo; |
| 6269 | |
| 6270 | typedef enum { |
| 6271 | CXIdxObjCContainer_ForwardRef = 0, |
| 6272 | CXIdxObjCContainer_Interface = 1, |
| 6273 | CXIdxObjCContainer_Implementation = 2 |
| 6274 | } CXIdxObjCContainerKind; |
| 6275 | |
| 6276 | typedef struct { |
| 6277 | const CXIdxDeclInfo *declInfo; |
| 6278 | CXIdxObjCContainerKind kind; |
| 6279 | } CXIdxObjCContainerDeclInfo; |
| 6280 | |
| 6281 | typedef struct { |
| 6282 | const CXIdxEntityInfo *base; |
| 6283 | CXCursor cursor; |
| 6284 | CXIdxLoc loc; |
| 6285 | } CXIdxBaseClassInfo; |
| 6286 | |
| 6287 | typedef struct { |
| 6288 | const CXIdxEntityInfo *protocol; |
| 6289 | CXCursor cursor; |
| 6290 | CXIdxLoc loc; |
| 6291 | } CXIdxObjCProtocolRefInfo; |
| 6292 | |
| 6293 | typedef struct { |
| 6294 | const CXIdxObjCProtocolRefInfo *const *protocols; |
| 6295 | unsigned numProtocols; |
| 6296 | } CXIdxObjCProtocolRefListInfo; |
| 6297 | |
| 6298 | typedef struct { |
| 6299 | const CXIdxObjCContainerDeclInfo *containerInfo; |
| 6300 | const CXIdxBaseClassInfo *superInfo; |
| 6301 | const CXIdxObjCProtocolRefListInfo *protocols; |
| 6302 | } CXIdxObjCInterfaceDeclInfo; |
| 6303 | |
| 6304 | typedef struct { |
| 6305 | const CXIdxObjCContainerDeclInfo *containerInfo; |
| 6306 | const CXIdxEntityInfo *objcClass; |
| 6307 | CXCursor classCursor; |
| 6308 | CXIdxLoc classLoc; |
| 6309 | const CXIdxObjCProtocolRefListInfo *protocols; |
| 6310 | } CXIdxObjCCategoryDeclInfo; |
| 6311 | |
| 6312 | typedef struct { |
| 6313 | const CXIdxDeclInfo *declInfo; |
| 6314 | const CXIdxEntityInfo *getter; |
| 6315 | const CXIdxEntityInfo *setter; |
| 6316 | } CXIdxObjCPropertyDeclInfo; |
| 6317 | |
| 6318 | typedef struct { |
| 6319 | const CXIdxDeclInfo *declInfo; |
| 6320 | const CXIdxBaseClassInfo *const *bases; |
| 6321 | unsigned numBases; |
| 6322 | } CXIdxCXXClassDeclInfo; |
| 6323 | |
| 6324 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6325 | * Data for IndexerCallbacks#indexEntityReference. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6326 | * |
| 6327 | * This may be deprecated in a future version as this duplicates |
| 6328 | * the \c CXSymbolRole_Implicit bit in \c CXSymbolRole. |
| 6329 | */ |
| 6330 | typedef enum { |
| 6331 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6332 | * The entity is referenced directly in user's code. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6333 | */ |
| 6334 | CXIdxEntityRef_Direct = 1, |
| 6335 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6336 | * An implicit reference, e.g. a reference of an Objective-C method |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6337 | * via the dot syntax. |
| 6338 | */ |
| 6339 | CXIdxEntityRef_Implicit = 2 |
| 6340 | } CXIdxEntityRefKind; |
| 6341 | |
| 6342 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6343 | * Roles that are attributed to symbol occurrences. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6344 | * |
| 6345 | * Internal: this currently mirrors low 9 bits of clang::index::SymbolRole with |
| 6346 | * higher bits zeroed. These high bits may be exposed in the future. |
| 6347 | */ |
| 6348 | typedef enum { |
| 6349 | CXSymbolRole_None = 0, |
| 6350 | CXSymbolRole_Declaration = 1 << 0, |
| 6351 | CXSymbolRole_Definition = 1 << 1, |
| 6352 | CXSymbolRole_Reference = 1 << 2, |
| 6353 | CXSymbolRole_Read = 1 << 3, |
| 6354 | CXSymbolRole_Write = 1 << 4, |
| 6355 | CXSymbolRole_Call = 1 << 5, |
| 6356 | CXSymbolRole_Dynamic = 1 << 6, |
| 6357 | CXSymbolRole_AddressOf = 1 << 7, |
| 6358 | CXSymbolRole_Implicit = 1 << 8 |
| 6359 | } CXSymbolRole; |
| 6360 | |
| 6361 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6362 | * Data for IndexerCallbacks#indexEntityReference. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6363 | */ |
| 6364 | typedef struct { |
| 6365 | CXIdxEntityRefKind kind; |
| 6366 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6367 | * Reference cursor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6368 | */ |
| 6369 | CXCursor cursor; |
| 6370 | CXIdxLoc loc; |
| 6371 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6372 | * The entity that gets referenced. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6373 | */ |
| 6374 | const CXIdxEntityInfo *referencedEntity; |
| 6375 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6376 | * Immediate "parent" of the reference. For example: |
| 6377 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6378 | * \code |
| 6379 | * Foo *var; |
| 6380 | * \endcode |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6381 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6382 | * The parent of reference of type 'Foo' is the variable 'var'. |
| 6383 | * For references inside statement bodies of functions/methods, |
| 6384 | * the parentEntity will be the function/method. |
| 6385 | */ |
| 6386 | const CXIdxEntityInfo *parentEntity; |
| 6387 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6388 | * Lexical container context of the reference. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6389 | */ |
| 6390 | const CXIdxContainerInfo *container; |
| 6391 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6392 | * Sets of symbol roles of the reference. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6393 | */ |
| 6394 | CXSymbolRole role; |
| 6395 | } CXIdxEntityRefInfo; |
| 6396 | |
| 6397 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6398 | * A group of callbacks used by #clang_indexSourceFile and |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6399 | * #clang_indexTranslationUnit. |
| 6400 | */ |
| 6401 | typedef struct { |
| 6402 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6403 | * Called periodically to check whether indexing should be aborted. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6404 | * Should return 0 to continue, and non-zero to abort. |
| 6405 | */ |
| 6406 | int (*abortQuery)(CXClientData client_data, void *reserved); |
| 6407 | |
| 6408 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6409 | * Called at the end of indexing; passes the complete diagnostic set. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6410 | */ |
| 6411 | void (*diagnostic)(CXClientData client_data, |
| 6412 | CXDiagnosticSet, void *reserved); |
| 6413 | |
| 6414 | CXIdxClientFile (*enteredMainFile)(CXClientData client_data, |
| 6415 | CXFile mainFile, void *reserved); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6416 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6417 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6418 | * Called when a file gets \#included/\#imported. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6419 | */ |
| 6420 | CXIdxClientFile (*ppIncludedFile)(CXClientData client_data, |
| 6421 | const CXIdxIncludedFileInfo *); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6422 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6423 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6424 | * Called when a AST file (PCH or module) gets imported. |
| 6425 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6426 | * AST files will not get indexed (there will not be callbacks to index all |
| 6427 | * the entities in an AST file). The recommended action is that, if the AST |
| 6428 | * file is not already indexed, to initiate a new indexing job specific to |
| 6429 | * the AST file. |
| 6430 | */ |
| 6431 | CXIdxClientASTFile (*importedASTFile)(CXClientData client_data, |
| 6432 | const CXIdxImportedASTFileInfo *); |
| 6433 | |
| 6434 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6435 | * Called at the beginning of indexing a translation unit. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6436 | */ |
| 6437 | CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data, |
| 6438 | void *reserved); |
| 6439 | |
| 6440 | void (*indexDeclaration)(CXClientData client_data, |
| 6441 | const CXIdxDeclInfo *); |
| 6442 | |
| 6443 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6444 | * Called to index a reference of an entity. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6445 | */ |
| 6446 | void (*indexEntityReference)(CXClientData client_data, |
| 6447 | const CXIdxEntityRefInfo *); |
| 6448 | |
| 6449 | } IndexerCallbacks; |
| 6450 | |
| 6451 | CINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind); |
| 6452 | CINDEX_LINKAGE const CXIdxObjCContainerDeclInfo * |
| 6453 | clang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *); |
| 6454 | |
| 6455 | CINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo * |
| 6456 | clang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *); |
| 6457 | |
| 6458 | CINDEX_LINKAGE |
| 6459 | const CXIdxObjCCategoryDeclInfo * |
| 6460 | clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *); |
| 6461 | |
| 6462 | CINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo * |
| 6463 | clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *); |
| 6464 | |
| 6465 | CINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo * |
| 6466 | clang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *); |
| 6467 | |
| 6468 | CINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo * |
| 6469 | clang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *); |
| 6470 | |
| 6471 | CINDEX_LINKAGE const CXIdxCXXClassDeclInfo * |
| 6472 | clang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *); |
| 6473 | |
| 6474 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6475 | * For retrieving a custom CXIdxClientContainer attached to a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6476 | * container. |
| 6477 | */ |
| 6478 | CINDEX_LINKAGE CXIdxClientContainer |
| 6479 | clang_index_getClientContainer(const CXIdxContainerInfo *); |
| 6480 | |
| 6481 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6482 | * For setting a custom CXIdxClientContainer attached to a |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6483 | * container. |
| 6484 | */ |
| 6485 | CINDEX_LINKAGE void |
| 6486 | clang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer); |
| 6487 | |
| 6488 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6489 | * For retrieving a custom CXIdxClientEntity attached to an entity. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6490 | */ |
| 6491 | CINDEX_LINKAGE CXIdxClientEntity |
| 6492 | clang_index_getClientEntity(const CXIdxEntityInfo *); |
| 6493 | |
| 6494 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6495 | * For setting a custom CXIdxClientEntity attached to an entity. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6496 | */ |
| 6497 | CINDEX_LINKAGE void |
| 6498 | clang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity); |
| 6499 | |
| 6500 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6501 | * An indexing action/session, to be applied to one or multiple |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6502 | * translation units. |
| 6503 | */ |
| 6504 | typedef void *CXIndexAction; |
| 6505 | |
| 6506 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6507 | * An indexing action/session, to be applied to one or multiple |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6508 | * translation units. |
| 6509 | * |
| 6510 | * \param CIdx The index object with which the index action will be associated. |
| 6511 | */ |
| 6512 | CINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx); |
| 6513 | |
| 6514 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6515 | * Destroy the given index action. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6516 | * |
| 6517 | * The index action must not be destroyed until all of the translation units |
| 6518 | * created within that index action have been destroyed. |
| 6519 | */ |
| 6520 | CINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction); |
| 6521 | |
| 6522 | typedef enum { |
| 6523 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6524 | * Used to indicate that no special indexing options are needed. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6525 | */ |
| 6526 | CXIndexOpt_None = 0x0, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6527 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6528 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6529 | * Used to indicate that IndexerCallbacks#indexEntityReference should |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6530 | * be invoked for only one reference of an entity per source file that does |
| 6531 | * not also include a declaration/definition of the entity. |
| 6532 | */ |
| 6533 | CXIndexOpt_SuppressRedundantRefs = 0x1, |
| 6534 | |
| 6535 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6536 | * Function-local symbols should be indexed. If this is not set |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6537 | * function-local symbols will be ignored. |
| 6538 | */ |
| 6539 | CXIndexOpt_IndexFunctionLocalSymbols = 0x2, |
| 6540 | |
| 6541 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6542 | * Implicit function/class template instantiations should be indexed. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6543 | * If this is not set, implicit instantiations will be ignored. |
| 6544 | */ |
| 6545 | CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4, |
| 6546 | |
| 6547 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6548 | * Suppress all compiler warnings when parsing for indexing. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6549 | */ |
| 6550 | CXIndexOpt_SuppressWarnings = 0x8, |
| 6551 | |
| 6552 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6553 | * Skip a function/method body that was already parsed during an |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6554 | * indexing session associated with a \c CXIndexAction object. |
| 6555 | * Bodies in system headers are always skipped. |
| 6556 | */ |
| 6557 | CXIndexOpt_SkipParsedBodiesInSession = 0x10 |
| 6558 | |
| 6559 | } CXIndexOptFlags; |
| 6560 | |
| 6561 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6562 | * Index the given source file and the translation unit corresponding |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6563 | * to that file via callbacks implemented through #IndexerCallbacks. |
| 6564 | * |
| 6565 | * \param client_data pointer data supplied by the client, which will |
| 6566 | * be passed to the invoked callbacks. |
| 6567 | * |
| 6568 | * \param index_callbacks Pointer to indexing callbacks that the client |
| 6569 | * implements. |
| 6570 | * |
| 6571 | * \param index_callbacks_size Size of #IndexerCallbacks structure that gets |
| 6572 | * passed in index_callbacks. |
| 6573 | * |
| 6574 | * \param index_options A bitmask of options that affects how indexing is |
| 6575 | * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags. |
| 6576 | * |
| 6577 | * \param[out] out_TU pointer to store a \c CXTranslationUnit that can be |
| 6578 | * reused after indexing is finished. Set to \c NULL if you do not require it. |
| 6579 | * |
| 6580 | * \returns 0 on success or if there were errors from which the compiler could |
| 6581 | * recover. If there is a failure from which there is no recovery, returns |
| 6582 | * a non-zero \c CXErrorCode. |
| 6583 | * |
| 6584 | * The rest of the parameters are the same as #clang_parseTranslationUnit. |
| 6585 | */ |
| 6586 | CINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction, |
| 6587 | CXClientData client_data, |
| 6588 | IndexerCallbacks *index_callbacks, |
| 6589 | unsigned index_callbacks_size, |
| 6590 | unsigned index_options, |
| 6591 | const char *source_filename, |
| 6592 | const char * const *command_line_args, |
| 6593 | int num_command_line_args, |
| 6594 | struct CXUnsavedFile *unsaved_files, |
| 6595 | unsigned num_unsaved_files, |
| 6596 | CXTranslationUnit *out_TU, |
| 6597 | unsigned TU_options); |
| 6598 | |
| 6599 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6600 | * Same as clang_indexSourceFile but requires a full command line |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6601 | * for \c command_line_args including argv[0]. This is useful if the standard |
| 6602 | * library paths are relative to the binary. |
| 6603 | */ |
| 6604 | CINDEX_LINKAGE int clang_indexSourceFileFullArgv( |
| 6605 | CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks, |
| 6606 | unsigned index_callbacks_size, unsigned index_options, |
| 6607 | const char *source_filename, const char *const *command_line_args, |
| 6608 | int num_command_line_args, struct CXUnsavedFile *unsaved_files, |
| 6609 | unsigned num_unsaved_files, CXTranslationUnit *out_TU, unsigned TU_options); |
| 6610 | |
| 6611 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6612 | * Index the given translation unit via callbacks implemented through |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6613 | * #IndexerCallbacks. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6614 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6615 | * The order of callback invocations is not guaranteed to be the same as |
| 6616 | * when indexing a source file. The high level order will be: |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6617 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6618 | * -Preprocessor callbacks invocations |
| 6619 | * -Declaration/reference callbacks invocations |
| 6620 | * -Diagnostic callback invocations |
| 6621 | * |
| 6622 | * The parameters are the same as #clang_indexSourceFile. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6623 | * |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6624 | * \returns If there is a failure from which there is no recovery, returns |
| 6625 | * non-zero, otherwise returns 0. |
| 6626 | */ |
| 6627 | CINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction, |
| 6628 | CXClientData client_data, |
| 6629 | IndexerCallbacks *index_callbacks, |
| 6630 | unsigned index_callbacks_size, |
| 6631 | unsigned index_options, |
| 6632 | CXTranslationUnit); |
| 6633 | |
| 6634 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6635 | * Retrieve the CXIdxFile, file, line, column, and offset represented by |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6636 | * the given CXIdxLoc. |
| 6637 | * |
| 6638 | * If the location refers into a macro expansion, retrieves the |
| 6639 | * location of the macro expansion and if it refers into a macro argument |
| 6640 | * retrieves the location of the argument. |
| 6641 | */ |
| 6642 | CINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc, |
| 6643 | CXIdxClientFile *indexFile, |
| 6644 | CXFile *file, |
| 6645 | unsigned *line, |
| 6646 | unsigned *column, |
| 6647 | unsigned *offset); |
| 6648 | |
| 6649 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6650 | * Retrieve the CXSourceLocation represented by the given CXIdxLoc. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6651 | */ |
| 6652 | CINDEX_LINKAGE |
| 6653 | CXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc); |
| 6654 | |
| 6655 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6656 | * Visitor invoked for each field found by a traversal. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6657 | * |
| 6658 | * This visitor function will be invoked for each field found by |
| 6659 | * \c clang_Type_visitFields. Its first argument is the cursor being |
| 6660 | * visited, its second argument is the client data provided to |
| 6661 | * \c clang_Type_visitFields. |
| 6662 | * |
| 6663 | * The visitor should return one of the \c CXVisitorResult values |
| 6664 | * to direct \c clang_Type_visitFields. |
| 6665 | */ |
| 6666 | typedef enum CXVisitorResult (*CXFieldVisitor)(CXCursor C, |
| 6667 | CXClientData client_data); |
| 6668 | |
| 6669 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 6670 | * Visit the fields of a particular type. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6671 | * |
| 6672 | * This function visits all the direct fields of the given cursor, |
| 6673 | * invoking the given \p visitor function with the cursors of each |
| 6674 | * visited field. The traversal may be ended prematurely, if |
| 6675 | * the visitor returns \c CXFieldVisit_Break. |
| 6676 | * |
| 6677 | * \param T the record type whose field may be visited. |
| 6678 | * |
| 6679 | * \param visitor the visitor function that will be invoked for each |
| 6680 | * field of \p T. |
| 6681 | * |
| 6682 | * \param client_data pointer data supplied by the client, which will |
| 6683 | * be passed to the visitor each time it is invoked. |
| 6684 | * |
| 6685 | * \returns a non-zero value if the traversal was terminated |
| 6686 | * prematurely by the visitor returning \c CXFieldVisit_Break. |
| 6687 | */ |
| 6688 | CINDEX_LINKAGE unsigned clang_Type_visitFields(CXType T, |
| 6689 | CXFieldVisitor visitor, |
| 6690 | CXClientData client_data); |
| 6691 | |
| 6692 | /** |
| 6693 | * @} |
| 6694 | */ |
| 6695 | |
| 6696 | /** |
| 6697 | * @} |
| 6698 | */ |
| 6699 | |
| 6700 | #ifdef __cplusplus |
| 6701 | } |
| 6702 | #endif |
| 6703 | #endif |