1 module clang.c.index; 2 3 import clang.c.util: EnumC; 4 5 public import clang.c.CXErrorCode; 6 public import clang.c.CXString; 7 public import clang.c.documentation; 8 9 import core.stdc.config; 10 import core.stdc.time; 11 12 extern (D) string CINDEX_VERSION_STRINGIZE_(T0, T1)(auto ref T0 major, auto ref T1 minor) 13 { 14 import std.conv : to; 15 16 return to!string(major) ~ "." ~ to!string(minor); 17 } 18 19 alias CINDEX_VERSION_STRINGIZE = CINDEX_VERSION_STRINGIZE_; 20 21 22 23 /** 24 * Visitor invoked for each cursor found by a traversal. 25 * 26 * This visitor function will be invoked for each cursor found by 27 * clang_visitCursorChildren(). Its first argument is the cursor being 28 * visited, its second argument is the parent visitor for that cursor, 29 * and its third argument is the client data provided to 30 * clang_visitCursorChildren(). 31 * 32 * The visitor should return one of the \c CXChildVisitResult values 33 * to direct clang_visitCursorChildren(). 34 */ 35 alias CXCursorVisitor = extern(C) CXChildVisitResult function ( 36 CXCursor cursor, 37 CXCursor parent, 38 CXClientData client_data); 39 40 /** 41 * Visit the children of a particular cursor. 42 * 43 * This function visits all the direct children of the given cursor, 44 * invoking the given \p visitor function with the cursors of each 45 * visited child. The traversal may be recursive, if the visitor returns 46 * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if 47 * the visitor returns \c CXChildVisit_Break. 48 * 49 * \param parent the cursor whose child may be visited. All kinds of 50 * cursors can be visited, including invalid cursors (which, by 51 * definition, have no children). 52 * 53 * \param visitor the visitor function that will be invoked for each 54 * child of \p parent. 55 * 56 * \param client_data pointer data supplied by the client, which will 57 * be passed to the visitor each time it is invoked. 58 * 59 * \returns a non-zero value if the traversal was terminated 60 * prematurely by the visitor returning \c CXChildVisit_Break. 61 */ 62 extern(C) uint clang_visitChildren ( 63 const CXCursor parent, 64 CXCursorVisitor visitor, 65 CXClientData client_data) @trusted; 66 67 extern (C) @nogc @trusted nothrow pure: 68 69 /** 70 * The version constants for the libclang API. 71 * CINDEX_VERSION_MINOR should increase when there are API additions. 72 * CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes. 73 * 74 * The policy about the libclang API was always to keep it source and ABI 75 * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. 76 */ 77 enum CINDEX_VERSION_MAJOR = 0; 78 enum CINDEX_VERSION_MINOR = 62; 79 80 extern (D) auto CINDEX_VERSION_ENCODE(T0, T1)(auto ref T0 major, auto ref T1 minor) 81 { 82 return (major * 10000) + (minor * 1); 83 } 84 85 enum CINDEX_VERSION = CINDEX_VERSION_ENCODE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR); 86 87 88 enum CINDEX_VERSION_STRING = CINDEX_VERSION_STRINGIZE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR); 89 90 /** \defgroup CINDEX libclang: C Interface to Clang 91 * 92 * The C Interface to Clang provides a relatively small API that exposes 93 * facilities for parsing source code into an abstract syntax tree (AST), 94 * loading already-parsed ASTs, traversing the AST, associating 95 * physical source locations with elements within the AST, and other 96 * facilities that support Clang-based development tools. 97 * 98 * This C interface to Clang will never provide all of the information 99 * representation stored in Clang's C++ AST, nor should it: the intent is to 100 * maintain an API that is relatively stable from one release to the next, 101 * providing only the basic functionality needed to support development tools. 102 * 103 * To avoid namespace pollution, data types are prefixed with "CX" and 104 * functions are prefixed with "clang_". 105 * 106 * @{ 107 */ 108 109 /** 110 * An "index" that consists of a set of translation units that would 111 * typically be linked together into an executable or library. 112 */ 113 alias CXIndex = void*; 114 115 /** 116 * An opaque type representing target information for a given translation 117 * unit. 118 */ 119 struct CXTargetInfoImpl; 120 alias CXTargetInfo = CXTargetInfoImpl*; 121 122 /** 123 * A single translation unit, which resides in an index. 124 */ 125 struct CXTranslationUnitImpl; 126 alias CXTranslationUnit = CXTranslationUnitImpl*; 127 128 /** 129 * Opaque pointer representing client data that will be passed through 130 * to various callbacks and visitors. 131 */ 132 alias CXClientData = void*; 133 134 /** 135 * Provides the contents of a file that has not yet been saved to disk. 136 * 137 * Each CXUnsavedFile instance provides the name of a file on the 138 * system along with the current contents of that file that have not 139 * yet been saved to disk. 140 */ 141 struct CXUnsavedFile 142 { 143 /** 144 * The file whose contents have not yet been saved. 145 * 146 * This file must already exist in the file system. 147 */ 148 const(char)* Filename; 149 150 /** 151 * A buffer containing the unsaved contents of this file. 152 */ 153 const(char)* Contents; 154 155 /** 156 * The length of the unsaved contents of this buffer. 157 */ 158 c_ulong Length; 159 } 160 161 /** 162 * Describes the availability of a particular entity, which indicates 163 * whether the use of this entity will result in a warning or error due to 164 * it being deprecated or unavailable. 165 */ 166 enum CXAvailabilityKind 167 { 168 /** 169 * The entity is available. 170 */ 171 CXAvailability_Available = 0, 172 /** 173 * The entity is available, but has been deprecated (and its use is 174 * not recommended). 175 */ 176 CXAvailability_Deprecated = 1, 177 /** 178 * The entity is not available; any use of it will be an error. 179 */ 180 CXAvailability_NotAvailable = 2, 181 /** 182 * The entity is available, but not accessible; any use of it will be 183 * an error. 184 */ 185 CXAvailability_NotAccessible = 3 186 } 187 188 alias CXAvailability_Available = CXAvailabilityKind.CXAvailability_Available; 189 alias CXAvailability_Deprecated = CXAvailabilityKind.CXAvailability_Deprecated; 190 alias CXAvailability_NotAvailable = CXAvailabilityKind.CXAvailability_NotAvailable; 191 alias CXAvailability_NotAccessible = CXAvailabilityKind.CXAvailability_NotAccessible; 192 193 /** 194 * Describes a version number of the form major.minor.subminor. 195 */ 196 struct CXVersion 197 { 198 /** 199 * The major version number, e.g., the '10' in '10.7.3'. A negative 200 * value indicates that there is no version number at all. 201 */ 202 int Major; 203 /** 204 * The minor version number, e.g., the '7' in '10.7.3'. This value 205 * will be negative if no minor version number was provided, e.g., for 206 * version '10'. 207 */ 208 int Minor; 209 /** 210 * The subminor version number, e.g., the '3' in '10.7.3'. This value 211 * will be negative if no minor or subminor version number was provided, 212 * e.g., in version '10' or '10.7'. 213 */ 214 int Subminor; 215 } 216 217 /** 218 * Describes the exception specification of a cursor. 219 * 220 * A negative value indicates that the cursor is not a function declaration. 221 */ 222 enum CXCursor_ExceptionSpecificationKind 223 { 224 /** 225 * The cursor has no exception specification. 226 */ 227 CXCursor_ExceptionSpecificationKind_None = 0, 228 229 /** 230 * The cursor has exception specification throw() 231 */ 232 CXCursor_ExceptionSpecificationKind_DynamicNone = 1, 233 234 /** 235 * The cursor has exception specification throw(T1, T2) 236 */ 237 CXCursor_ExceptionSpecificationKind_Dynamic = 2, 238 239 /** 240 * The cursor has exception specification throw(...). 241 */ 242 CXCursor_ExceptionSpecificationKind_MSAny = 3, 243 244 /** 245 * The cursor has exception specification basic noexcept. 246 */ 247 CXCursor_ExceptionSpecificationKind_BasicNoexcept = 4, 248 249 /** 250 * The cursor has exception specification computed noexcept. 251 */ 252 CXCursor_ExceptionSpecificationKind_ComputedNoexcept = 5, 253 254 /** 255 * The exception specification has not yet been evaluated. 256 */ 257 CXCursor_ExceptionSpecificationKind_Unevaluated = 6, 258 259 /** 260 * The exception specification has not yet been instantiated. 261 */ 262 CXCursor_ExceptionSpecificationKind_Uninstantiated = 7, 263 264 /** 265 * The exception specification has not been parsed yet. 266 */ 267 CXCursor_ExceptionSpecificationKind_Unparsed = 8, 268 269 /** 270 * The cursor has a __declspec(nothrow) exception specification. 271 */ 272 CXCursor_ExceptionSpecificationKind_NoThrow = 9 273 } 274 275 alias CXCursor_ExceptionSpecificationKind_None = CXCursor_ExceptionSpecificationKind.CXCursor_ExceptionSpecificationKind_None; 276 alias CXCursor_ExceptionSpecificationKind_DynamicNone = CXCursor_ExceptionSpecificationKind.CXCursor_ExceptionSpecificationKind_DynamicNone; 277 alias CXCursor_ExceptionSpecificationKind_Dynamic = CXCursor_ExceptionSpecificationKind.CXCursor_ExceptionSpecificationKind_Dynamic; 278 alias CXCursor_ExceptionSpecificationKind_MSAny = CXCursor_ExceptionSpecificationKind.CXCursor_ExceptionSpecificationKind_MSAny; 279 alias CXCursor_ExceptionSpecificationKind_BasicNoexcept = CXCursor_ExceptionSpecificationKind.CXCursor_ExceptionSpecificationKind_BasicNoexcept; 280 alias CXCursor_ExceptionSpecificationKind_ComputedNoexcept = CXCursor_ExceptionSpecificationKind.CXCursor_ExceptionSpecificationKind_ComputedNoexcept; 281 alias CXCursor_ExceptionSpecificationKind_Unevaluated = CXCursor_ExceptionSpecificationKind.CXCursor_ExceptionSpecificationKind_Unevaluated; 282 alias CXCursor_ExceptionSpecificationKind_Uninstantiated = CXCursor_ExceptionSpecificationKind.CXCursor_ExceptionSpecificationKind_Uninstantiated; 283 alias CXCursor_ExceptionSpecificationKind_Unparsed = CXCursor_ExceptionSpecificationKind.CXCursor_ExceptionSpecificationKind_Unparsed; 284 alias CXCursor_ExceptionSpecificationKind_NoThrow = CXCursor_ExceptionSpecificationKind.CXCursor_ExceptionSpecificationKind_NoThrow; 285 286 /** 287 * Provides a shared context for creating translation units. 288 * 289 * It provides two options: 290 * 291 * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local" 292 * declarations (when loading any new translation units). A "local" declaration 293 * is one that belongs in the translation unit itself and not in a precompiled 294 * header that was used by the translation unit. If zero, all declarations 295 * will be enumerated. 296 * 297 * Here is an example: 298 * 299 * \code 300 * // excludeDeclsFromPCH = 1, displayDiagnostics=1 301 * Idx = clang_createIndex(1, 1); 302 * 303 * // IndexTest.pch was produced with the following command: 304 * // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch" 305 * TU = clang_createTranslationUnit(Idx, "IndexTest.pch"); 306 * 307 * // This will load all the symbols from 'IndexTest.pch' 308 * clang_visitChildren(clang_getTranslationUnitCursor(TU), 309 * TranslationUnitVisitor, 0); 310 * clang_disposeTranslationUnit(TU); 311 * 312 * // This will load all the symbols from 'IndexTest.c', excluding symbols 313 * // from 'IndexTest.pch'. 314 * char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" }; 315 * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args, 316 * 0, 0); 317 * clang_visitChildren(clang_getTranslationUnitCursor(TU), 318 * TranslationUnitVisitor, 0); 319 * clang_disposeTranslationUnit(TU); 320 * \endcode 321 * 322 * This process of creating the 'pch', loading it separately, and using it (via 323 * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks 324 * (which gives the indexer the same performance benefit as the compiler). 325 */ 326 CXIndex clang_createIndex ( 327 int excludeDeclarationsFromPCH, 328 int displayDiagnostics); 329 330 /** 331 * Destroy the given index. 332 * 333 * The index must not be destroyed until all of the translation units created 334 * within that index have been destroyed. 335 */ 336 void clang_disposeIndex (CXIndex index); 337 338 enum CXGlobalOptFlags 339 { 340 /** 341 * Used to indicate that no special CXIndex options are needed. 342 */ 343 CXGlobalOpt_None = 0x0, 344 345 /** 346 * Used to indicate that threads that libclang creates for indexing 347 * purposes should use background priority. 348 * 349 * Affects #clang_indexSourceFile, #clang_indexTranslationUnit, 350 * #clang_parseTranslationUnit, #clang_saveTranslationUnit. 351 */ 352 CXGlobalOpt_ThreadBackgroundPriorityForIndexing = 0x1, 353 354 /** 355 * Used to indicate that threads that libclang creates for editing 356 * purposes should use background priority. 357 * 358 * Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt, 359 * #clang_annotateTokens 360 */ 361 CXGlobalOpt_ThreadBackgroundPriorityForEditing = 0x2, 362 363 /** 364 * Used to indicate that all threads that libclang creates should use 365 * background priority. 366 */ 367 CXGlobalOpt_ThreadBackgroundPriorityForAll = CXGlobalOpt_ThreadBackgroundPriorityForIndexing | CXGlobalOpt_ThreadBackgroundPriorityForEditing 368 } 369 370 alias CXGlobalOpt_None = CXGlobalOptFlags.CXGlobalOpt_None; 371 alias CXGlobalOpt_ThreadBackgroundPriorityForIndexing = CXGlobalOptFlags.CXGlobalOpt_ThreadBackgroundPriorityForIndexing; 372 alias CXGlobalOpt_ThreadBackgroundPriorityForEditing = CXGlobalOptFlags.CXGlobalOpt_ThreadBackgroundPriorityForEditing; 373 alias CXGlobalOpt_ThreadBackgroundPriorityForAll = CXGlobalOptFlags.CXGlobalOpt_ThreadBackgroundPriorityForAll; 374 375 /** 376 * Sets general options associated with a CXIndex. 377 * 378 * For example: 379 * \code 380 * CXIndex idx = ...; 381 * clang_CXIndex_setGlobalOptions(idx, 382 * clang_CXIndex_getGlobalOptions(idx) | 383 * CXGlobalOpt_ThreadBackgroundPriorityForIndexing); 384 * \endcode 385 * 386 * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags. 387 */ 388 void clang_CXIndex_setGlobalOptions (CXIndex, uint options); 389 390 /** 391 * Gets the general options associated with a CXIndex. 392 * 393 * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that 394 * are associated with the given CXIndex object. 395 */ 396 uint clang_CXIndex_getGlobalOptions (CXIndex); 397 398 /** 399 * Sets the invocation emission path option in a CXIndex. 400 * 401 * The invocation emission path specifies a path which will contain log 402 * files for certain libclang invocations. A null value (default) implies that 403 * libclang invocations are not logged.. 404 */ 405 void clang_CXIndex_setInvocationEmissionPathOption (CXIndex, const(char)* Path); 406 407 /** 408 * \defgroup CINDEX_FILES File manipulation routines 409 * 410 * @{ 411 */ 412 413 /** 414 * A particular source file that is part of a translation unit. 415 */ 416 alias CXFile = void*; 417 418 /** 419 * Retrieve the complete file and path name of the given file. 420 */ 421 CXString clang_getFileName (CXFile SFile) pure; 422 423 /** 424 * Retrieve the last modification time of the given file. 425 */ 426 time_t clang_getFileTime (CXFile SFile); 427 428 /** 429 * Uniquely identifies a CXFile, that refers to the same underlying file, 430 * across an indexing session. 431 */ 432 struct CXFileUniqueID 433 { 434 ulong[3] data; 435 } 436 437 /** 438 * Retrieve the unique ID for the given \c file. 439 * 440 * \param file the file to get the ID for. 441 * \param outID stores the returned CXFileUniqueID. 442 * \returns If there was a failure getting the unique ID, returns non-zero, 443 * otherwise returns 0. 444 */ 445 int clang_getFileUniqueID (CXFile file, CXFileUniqueID* outID); 446 447 /** 448 * Determine whether the given header is guarded against 449 * multiple inclusions, either with the conventional 450 * \#ifndef/\#define/\#endif macro guards or with \#pragma once. 451 */ 452 uint clang_isFileMultipleIncludeGuarded (CXTranslationUnit tu, CXFile file); 453 454 /** 455 * Retrieve a file handle within the given translation unit. 456 * 457 * \param tu the translation unit 458 * 459 * \param file_name the name of the file. 460 * 461 * \returns the file handle for the named file in the translation unit \p tu, 462 * or a NULL file handle if the file was not a part of this translation unit. 463 */ 464 CXFile clang_getFile (CXTranslationUnit tu, const(char)* file_name); 465 466 /** 467 * Retrieve the buffer associated with the given file. 468 * 469 * \param tu the translation unit 470 * 471 * \param file the file for which to retrieve the buffer. 472 * 473 * \param size [out] if non-NULL, will be set to the size of the buffer. 474 * 475 * \returns a pointer to the buffer in memory that holds the contents of 476 * \p file, or a NULL pointer when the file is not loaded. 477 */ 478 const(char)* clang_getFileContents ( 479 CXTranslationUnit tu, 480 CXFile file, 481 size_t* size); 482 483 /** 484 * Returns non-zero if the \c file1 and \c file2 point to the same file, 485 * or they are both NULL. 486 */ 487 int clang_File_isEqual (CXFile file1, CXFile file2); 488 489 /** 490 * Returns the real path name of \c file. 491 * 492 * An empty string may be returned. Use \c clang_getFileName() in that case. 493 */ 494 CXString clang_File_tryGetRealPathName (CXFile file); 495 496 /** 497 * @} 498 */ 499 500 /** 501 * \defgroup CINDEX_LOCATIONS Physical source locations 502 * 503 * Clang represents physical source locations in its abstract syntax tree in 504 * great detail, with file, line, and column information for the majority of 505 * the tokens parsed in the source code. These data types and functions are 506 * used to represent source location information, either for a particular 507 * point in the program or for a range of points in the program, and extract 508 * specific location information from those data types. 509 * 510 * @{ 511 */ 512 513 /** 514 * Identifies a specific source location within a translation 515 * unit. 516 * 517 * Use clang_getExpansionLocation() or clang_getSpellingLocation() 518 * to map a source location to a particular file, line, and column. 519 */ 520 struct CXSourceLocation 521 { 522 const(void)*[2] ptr_data; 523 uint int_data; 524 } 525 526 /** 527 * Identifies a half-open character range in the source code. 528 * 529 * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the 530 * starting and end locations from a source range, respectively. 531 */ 532 struct CXSourceRange 533 { 534 const(void)*[2] ptr_data; 535 uint begin_int_data; 536 uint end_int_data; 537 } 538 539 /** 540 * Retrieve a NULL (invalid) source location. 541 */ 542 CXSourceLocation clang_getNullLocation (); 543 544 /** 545 * Determine whether two source locations, which must refer into 546 * the same translation unit, refer to exactly the same point in the source 547 * code. 548 * 549 * \returns non-zero if the source locations refer to the same location, zero 550 * if they refer to different locations. 551 */ 552 uint clang_equalLocations (CXSourceLocation loc1, CXSourceLocation loc2); 553 554 /** 555 * Retrieves the source location associated with a given file/line/column 556 * in a particular translation unit. 557 */ 558 CXSourceLocation clang_getLocation ( 559 CXTranslationUnit tu, 560 CXFile file, 561 uint line, 562 uint column); 563 /** 564 * Retrieves the source location associated with a given character offset 565 * in a particular translation unit. 566 */ 567 CXSourceLocation clang_getLocationForOffset ( 568 CXTranslationUnit tu, 569 CXFile file, 570 uint offset); 571 572 /** 573 * Returns non-zero if the given source location is in a system header. 574 */ 575 int clang_Location_isInSystemHeader (CXSourceLocation location); 576 577 /** 578 * Returns non-zero if the given source location is in the main file of 579 * the corresponding translation unit. 580 */ 581 int clang_Location_isFromMainFile (CXSourceLocation location); 582 583 /** 584 * Retrieve a NULL (invalid) source range. 585 */ 586 CXSourceRange clang_getNullRange (); 587 588 /** 589 * Retrieve a source range given the beginning and ending source 590 * locations. 591 */ 592 CXSourceRange clang_getRange (CXSourceLocation begin, CXSourceLocation end); 593 594 /** 595 * Determine whether two ranges are equivalent. 596 * 597 * \returns non-zero if the ranges are the same, zero if they differ. 598 */ 599 uint clang_equalRanges (CXSourceRange range1, CXSourceRange range2); 600 601 /** 602 * Returns non-zero if \p range is null. 603 */ 604 int clang_Range_isNull (CXSourceRange range) pure; 605 606 /** 607 * Retrieve the file, line, column, and offset represented by 608 * the given source location. 609 * 610 * If the location refers into a macro expansion, retrieves the 611 * location of the macro expansion. 612 * 613 * \param location the location within a source file that will be decomposed 614 * into its parts. 615 * 616 * \param file [out] if non-NULL, will be set to the file to which the given 617 * source location points. 618 * 619 * \param line [out] if non-NULL, will be set to the line to which the given 620 * source location points. 621 * 622 * \param column [out] if non-NULL, will be set to the column to which the given 623 * source location points. 624 * 625 * \param offset [out] if non-NULL, will be set to the offset into the 626 * buffer to which the given source location points. 627 */ 628 void clang_getExpansionLocation ( 629 CXSourceLocation location, 630 CXFile* file, 631 uint* line, 632 uint* column, 633 uint* offset) pure; 634 635 /** 636 * Retrieve the file, line and column represented by the given source 637 * location, as specified in a # line directive. 638 * 639 * Example: given the following source code in a file somefile.c 640 * 641 * \code 642 * #123 "dummy.c" 1 643 * 644 * static int func(void) 645 * { 646 * return 0; 647 * } 648 * \endcode 649 * 650 * the location information returned by this function would be 651 * 652 * File: dummy.c Line: 124 Column: 12 653 * 654 * whereas clang_getExpansionLocation would have returned 655 * 656 * File: somefile.c Line: 3 Column: 12 657 * 658 * \param location the location within a source file that will be decomposed 659 * into its parts. 660 * 661 * \param filename [out] if non-NULL, will be set to the filename of the 662 * source location. Note that filenames returned will be for "virtual" files, 663 * which don't necessarily exist on the machine running clang - e.g. when 664 * parsing preprocessed output obtained from a different environment. If 665 * a non-NULL value is passed in, remember to dispose of the returned value 666 * using \c clang_disposeString() once you've finished with it. For an invalid 667 * source location, an empty string is returned. 668 * 669 * \param line [out] if non-NULL, will be set to the line number of the 670 * source location. For an invalid source location, zero is returned. 671 * 672 * \param column [out] if non-NULL, will be set to the column number of the 673 * source location. For an invalid source location, zero is returned. 674 */ 675 void clang_getPresumedLocation ( 676 CXSourceLocation location, 677 CXString* filename, 678 uint* line, 679 uint* column); 680 681 /** 682 * Legacy API to retrieve the file, line, column, and offset represented 683 * by the given source location. 684 * 685 * This interface has been replaced by the newer interface 686 * #clang_getExpansionLocation(). See that interface's documentation for 687 * details. 688 */ 689 void clang_getInstantiationLocation ( 690 CXSourceLocation location, 691 CXFile* file, 692 uint* line, 693 uint* column, 694 uint* offset); 695 696 /** 697 * Retrieve the file, line, column, and offset represented by 698 * the given source location. 699 * 700 * If the location refers into a macro instantiation, return where the 701 * location was originally spelled in the source file. 702 * 703 * \param location the location within a source file that will be decomposed 704 * into its parts. 705 * 706 * \param file [out] if non-NULL, will be set to the file to which the given 707 * source location points. 708 * 709 * \param line [out] if non-NULL, will be set to the line to which the given 710 * source location points. 711 * 712 * \param column [out] if non-NULL, will be set to the column to which the given 713 * source location points. 714 * 715 * \param offset [out] if non-NULL, will be set to the offset into the 716 * buffer to which the given source location points. 717 */ 718 void clang_getSpellingLocation ( 719 CXSourceLocation location, 720 CXFile* file, 721 uint* line, 722 uint* column, 723 uint* offset) pure; 724 725 /** 726 * Retrieve the file, line, column, and offset represented by 727 * the given source location. 728 * 729 * If the location refers into a macro expansion, return where the macro was 730 * expanded or where the macro argument was written, if the location points at 731 * a macro argument. 732 * 733 * \param location the location within a source file that will be decomposed 734 * into its parts. 735 * 736 * \param file [out] if non-NULL, will be set to the file to which the given 737 * source location points. 738 * 739 * \param line [out] if non-NULL, will be set to the line to which the given 740 * source location points. 741 * 742 * \param column [out] if non-NULL, will be set to the column to which the given 743 * source location points. 744 * 745 * \param offset [out] if non-NULL, will be set to the offset into the 746 * buffer to which the given source location points. 747 */ 748 void clang_getFileLocation ( 749 CXSourceLocation location, 750 CXFile* file, 751 uint* line, 752 uint* column, 753 uint* offset); 754 755 /** 756 * Retrieve a source location representing the first character within a 757 * source range. 758 */ 759 CXSourceLocation clang_getRangeStart (CXSourceRange range) pure; 760 761 /** 762 * Retrieve a source location representing the last character within a 763 * source range. 764 */ 765 CXSourceLocation clang_getRangeEnd (CXSourceRange range) pure; 766 767 /** 768 * Identifies an array of ranges. 769 */ 770 struct CXSourceRangeList 771 { 772 /** The number of ranges in the \c ranges array. */ 773 uint count; 774 /** 775 * An array of \c CXSourceRanges. 776 */ 777 CXSourceRange* ranges; 778 } 779 780 /** 781 * Retrieve all ranges that were skipped by the preprocessor. 782 * 783 * The preprocessor will skip lines when they are surrounded by an 784 * if/ifdef/ifndef directive whose condition does not evaluate to true. 785 */ 786 CXSourceRangeList* clang_getSkippedRanges (CXTranslationUnit tu, CXFile file); 787 788 /** 789 * Retrieve all ranges from all files that were skipped by the 790 * preprocessor. 791 * 792 * The preprocessor will skip lines when they are surrounded by an 793 * if/ifdef/ifndef directive whose condition does not evaluate to true. 794 */ 795 CXSourceRangeList* clang_getAllSkippedRanges (CXTranslationUnit tu); 796 797 /** 798 * Destroy the given \c CXSourceRangeList. 799 */ 800 void clang_disposeSourceRangeList (CXSourceRangeList* ranges); 801 802 /** 803 * @} 804 */ 805 806 /** 807 * \defgroup CINDEX_DIAG Diagnostic reporting 808 * 809 * @{ 810 */ 811 812 /** 813 * Describes the severity of a particular diagnostic. 814 */ 815 enum CXDiagnosticSeverity 816 { 817 /** 818 * A diagnostic that has been suppressed, e.g., by a command-line 819 * option. 820 */ 821 CXDiagnostic_Ignored = 0, 822 823 /** 824 * This diagnostic is a note that should be attached to the 825 * previous (non-note) diagnostic. 826 */ 827 CXDiagnostic_Note = 1, 828 829 /** 830 * This diagnostic indicates suspicious code that may not be 831 * wrong. 832 */ 833 CXDiagnostic_Warning = 2, 834 835 /** 836 * This diagnostic indicates that the code is ill-formed. 837 */ 838 CXDiagnostic_Error = 3, 839 840 /** 841 * This diagnostic indicates that the code is ill-formed such 842 * that future parser recovery is unlikely to produce useful 843 * results. 844 */ 845 CXDiagnostic_Fatal = 4 846 } 847 848 alias CXDiagnostic_Ignored = CXDiagnosticSeverity.CXDiagnostic_Ignored; 849 alias CXDiagnostic_Note = CXDiagnosticSeverity.CXDiagnostic_Note; 850 alias CXDiagnostic_Warning = CXDiagnosticSeverity.CXDiagnostic_Warning; 851 alias CXDiagnostic_Error = CXDiagnosticSeverity.CXDiagnostic_Error; 852 alias CXDiagnostic_Fatal = CXDiagnosticSeverity.CXDiagnostic_Fatal; 853 854 /** 855 * A single diagnostic, containing the diagnostic's severity, 856 * location, text, source ranges, and fix-it hints. 857 */ 858 alias CXDiagnostic = void*; 859 860 /** 861 * A group of CXDiagnostics. 862 */ 863 alias CXDiagnosticSet = void*; 864 865 /** 866 * Determine the number of diagnostics in a CXDiagnosticSet. 867 */ 868 uint clang_getNumDiagnosticsInSet (CXDiagnosticSet Diags); 869 870 /** 871 * Retrieve a diagnostic associated with the given CXDiagnosticSet. 872 * 873 * \param Diags the CXDiagnosticSet to query. 874 * \param Index the zero-based diagnostic number to retrieve. 875 * 876 * \returns the requested diagnostic. This diagnostic must be freed 877 * via a call to \c clang_disposeDiagnostic(). 878 */ 879 CXDiagnostic clang_getDiagnosticInSet (CXDiagnosticSet Diags, uint Index); 880 881 /** 882 * Describes the kind of error that occurred (if any) in a call to 883 * \c clang_loadDiagnostics. 884 */ 885 enum CXLoadDiag_Error 886 { 887 /** 888 * Indicates that no error occurred. 889 */ 890 CXLoadDiag_None = 0, 891 892 /** 893 * Indicates that an unknown error occurred while attempting to 894 * deserialize diagnostics. 895 */ 896 CXLoadDiag_Unknown = 1, 897 898 /** 899 * Indicates that the file containing the serialized diagnostics 900 * could not be opened. 901 */ 902 CXLoadDiag_CannotLoad = 2, 903 904 /** 905 * Indicates that the serialized diagnostics file is invalid or 906 * corrupt. 907 */ 908 CXLoadDiag_InvalidFile = 3 909 } 910 911 alias CXLoadDiag_None = CXLoadDiag_Error.CXLoadDiag_None; 912 alias CXLoadDiag_Unknown = CXLoadDiag_Error.CXLoadDiag_Unknown; 913 alias CXLoadDiag_CannotLoad = CXLoadDiag_Error.CXLoadDiag_CannotLoad; 914 alias CXLoadDiag_InvalidFile = CXLoadDiag_Error.CXLoadDiag_InvalidFile; 915 916 /** 917 * Deserialize a set of diagnostics from a Clang diagnostics bitcode 918 * file. 919 * 920 * \param file The name of the file to deserialize. 921 * \param error A pointer to a enum value recording if there was a problem 922 * deserializing the diagnostics. 923 * \param errorString A pointer to a CXString for recording the error string 924 * if the file was not successfully loaded. 925 * 926 * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise. These 927 * diagnostics should be released using clang_disposeDiagnosticSet(). 928 */ 929 CXDiagnosticSet clang_loadDiagnostics ( 930 const(char)* file, 931 CXLoadDiag_Error* error, 932 CXString* errorString); 933 934 /** 935 * Release a CXDiagnosticSet and all of its contained diagnostics. 936 */ 937 void clang_disposeDiagnosticSet (CXDiagnosticSet Diags); 938 939 /** 940 * Retrieve the child diagnostics of a CXDiagnostic. 941 * 942 * This CXDiagnosticSet does not need to be released by 943 * clang_disposeDiagnosticSet. 944 */ 945 CXDiagnosticSet clang_getChildDiagnostics (CXDiagnostic D); 946 947 /** 948 * Determine the number of diagnostics produced for the given 949 * translation unit. 950 */ 951 uint clang_getNumDiagnostics (CXTranslationUnit Unit); 952 953 /** 954 * Retrieve a diagnostic associated with the given translation unit. 955 * 956 * \param Unit the translation unit to query. 957 * \param Index the zero-based diagnostic number to retrieve. 958 * 959 * \returns the requested diagnostic. This diagnostic must be freed 960 * via a call to \c clang_disposeDiagnostic(). 961 */ 962 CXDiagnostic clang_getDiagnostic (CXTranslationUnit Unit, uint Index); 963 964 /** 965 * Retrieve the complete set of diagnostics associated with a 966 * translation unit. 967 * 968 * \param Unit the translation unit to query. 969 */ 970 CXDiagnosticSet clang_getDiagnosticSetFromTU (CXTranslationUnit Unit); 971 972 /** 973 * Destroy a diagnostic. 974 */ 975 void clang_disposeDiagnostic (CXDiagnostic Diagnostic); 976 977 /** 978 * Options to control the display of diagnostics. 979 * 980 * The values in this enum are meant to be combined to customize the 981 * behavior of \c clang_formatDiagnostic(). 982 */ 983 enum CXDiagnosticDisplayOptions 984 { 985 /** 986 * Display the source-location information where the 987 * diagnostic was located. 988 * 989 * When set, diagnostics will be prefixed by the file, line, and 990 * (optionally) column to which the diagnostic refers. For example, 991 * 992 * \code 993 * test.c:28: warning: extra tokens at end of #endif directive 994 * \endcode 995 * 996 * This option corresponds to the clang flag \c -fshow-source-location. 997 */ 998 CXDiagnostic_DisplaySourceLocation = 0x01, 999 1000 /** 1001 * If displaying the source-location information of the 1002 * diagnostic, also include the column number. 1003 * 1004 * This option corresponds to the clang flag \c -fshow-column. 1005 */ 1006 CXDiagnostic_DisplayColumn = 0x02, 1007 1008 /** 1009 * If displaying the source-location information of the 1010 * diagnostic, also include information about source ranges in a 1011 * machine-parsable format. 1012 * 1013 * This option corresponds to the clang flag 1014 * \c -fdiagnostics-print-source-range-info. 1015 */ 1016 CXDiagnostic_DisplaySourceRanges = 0x04, 1017 1018 /** 1019 * Display the option name associated with this diagnostic, if any. 1020 * 1021 * The option name displayed (e.g., -Wconversion) will be placed in brackets 1022 * after the diagnostic text. This option corresponds to the clang flag 1023 * \c -fdiagnostics-show-option. 1024 */ 1025 CXDiagnostic_DisplayOption = 0x08, 1026 1027 /** 1028 * Display the category number associated with this diagnostic, if any. 1029 * 1030 * The category number is displayed within brackets after the diagnostic text. 1031 * This option corresponds to the clang flag 1032 * \c -fdiagnostics-show-category=id. 1033 */ 1034 CXDiagnostic_DisplayCategoryId = 0x10, 1035 1036 /** 1037 * Display the category name associated with this diagnostic, if any. 1038 * 1039 * The category name is displayed within brackets after the diagnostic text. 1040 * This option corresponds to the clang flag 1041 * \c -fdiagnostics-show-category=name. 1042 */ 1043 CXDiagnostic_DisplayCategoryName = 0x20 1044 } 1045 1046 alias CXDiagnostic_DisplaySourceLocation = CXDiagnosticDisplayOptions.CXDiagnostic_DisplaySourceLocation; 1047 alias CXDiagnostic_DisplayColumn = CXDiagnosticDisplayOptions.CXDiagnostic_DisplayColumn; 1048 alias CXDiagnostic_DisplaySourceRanges = CXDiagnosticDisplayOptions.CXDiagnostic_DisplaySourceRanges; 1049 alias CXDiagnostic_DisplayOption = CXDiagnosticDisplayOptions.CXDiagnostic_DisplayOption; 1050 alias CXDiagnostic_DisplayCategoryId = CXDiagnosticDisplayOptions.CXDiagnostic_DisplayCategoryId; 1051 alias CXDiagnostic_DisplayCategoryName = CXDiagnosticDisplayOptions.CXDiagnostic_DisplayCategoryName; 1052 1053 /** 1054 * Format the given diagnostic in a manner that is suitable for display. 1055 * 1056 * This routine will format the given diagnostic to a string, rendering 1057 * the diagnostic according to the various options given. The 1058 * \c clang_defaultDiagnosticDisplayOptions() function returns the set of 1059 * options that most closely mimics the behavior of the clang compiler. 1060 * 1061 * \param Diagnostic The diagnostic to print. 1062 * 1063 * \param Options A set of options that control the diagnostic display, 1064 * created by combining \c CXDiagnosticDisplayOptions values. 1065 * 1066 * \returns A new string containing for formatted diagnostic. 1067 */ 1068 CXString clang_formatDiagnostic (CXDiagnostic Diagnostic, uint Options); 1069 1070 /** 1071 * Retrieve the set of display options most similar to the 1072 * default behavior of the clang compiler. 1073 * 1074 * \returns A set of display options suitable for use with \c 1075 * clang_formatDiagnostic(). 1076 */ 1077 uint clang_defaultDiagnosticDisplayOptions (); 1078 1079 /** 1080 * Determine the severity of the given diagnostic. 1081 */ 1082 CXDiagnosticSeverity clang_getDiagnosticSeverity (CXDiagnostic); 1083 1084 /** 1085 * Retrieve the source location of the given diagnostic. 1086 * 1087 * This location is where Clang would print the caret ('^') when 1088 * displaying the diagnostic on the command line. 1089 */ 1090 CXSourceLocation clang_getDiagnosticLocation (CXDiagnostic); 1091 1092 /** 1093 * Retrieve the text of the given diagnostic. 1094 */ 1095 CXString clang_getDiagnosticSpelling (CXDiagnostic); 1096 1097 /** 1098 * Retrieve the name of the command-line option that enabled this 1099 * diagnostic. 1100 * 1101 * \param Diag The diagnostic to be queried. 1102 * 1103 * \param Disable If non-NULL, will be set to the option that disables this 1104 * diagnostic (if any). 1105 * 1106 * \returns A string that contains the command-line option used to enable this 1107 * warning, such as "-Wconversion" or "-pedantic". 1108 */ 1109 CXString clang_getDiagnosticOption (CXDiagnostic Diag, CXString* Disable); 1110 1111 /** 1112 * Retrieve the category number for this diagnostic. 1113 * 1114 * Diagnostics can be categorized into groups along with other, related 1115 * diagnostics (e.g., diagnostics under the same warning flag). This routine 1116 * retrieves the category number for the given diagnostic. 1117 * 1118 * \returns The number of the category that contains this diagnostic, or zero 1119 * if this diagnostic is uncategorized. 1120 */ 1121 uint clang_getDiagnosticCategory (CXDiagnostic); 1122 1123 /** 1124 * Retrieve the name of a particular diagnostic category. This 1125 * is now deprecated. Use clang_getDiagnosticCategoryText() 1126 * instead. 1127 * 1128 * \param Category A diagnostic category number, as returned by 1129 * \c clang_getDiagnosticCategory(). 1130 * 1131 * \returns The name of the given diagnostic category. 1132 */ 1133 CXString clang_getDiagnosticCategoryName (uint Category); 1134 1135 /** 1136 * Retrieve the diagnostic category text for a given diagnostic. 1137 * 1138 * \returns The text of the given diagnostic category. 1139 */ 1140 CXString clang_getDiagnosticCategoryText (CXDiagnostic); 1141 1142 /** 1143 * Determine the number of source ranges associated with the given 1144 * diagnostic. 1145 */ 1146 uint clang_getDiagnosticNumRanges (CXDiagnostic); 1147 1148 /** 1149 * Retrieve a source range associated with the diagnostic. 1150 * 1151 * A diagnostic's source ranges highlight important elements in the source 1152 * code. On the command line, Clang displays source ranges by 1153 * underlining them with '~' characters. 1154 * 1155 * \param Diagnostic the diagnostic whose range is being extracted. 1156 * 1157 * \param Range the zero-based index specifying which range to 1158 * 1159 * \returns the requested source range. 1160 */ 1161 CXSourceRange clang_getDiagnosticRange (CXDiagnostic Diagnostic, uint Range); 1162 1163 /** 1164 * Determine the number of fix-it hints associated with the 1165 * given diagnostic. 1166 */ 1167 uint clang_getDiagnosticNumFixIts (CXDiagnostic Diagnostic); 1168 1169 /** 1170 * Retrieve the replacement information for a given fix-it. 1171 * 1172 * Fix-its are described in terms of a source range whose contents 1173 * should be replaced by a string. This approach generalizes over 1174 * three kinds of operations: removal of source code (the range covers 1175 * the code to be removed and the replacement string is empty), 1176 * replacement of source code (the range covers the code to be 1177 * replaced and the replacement string provides the new code), and 1178 * insertion (both the start and end of the range point at the 1179 * insertion location, and the replacement string provides the text to 1180 * insert). 1181 * 1182 * \param Diagnostic The diagnostic whose fix-its are being queried. 1183 * 1184 * \param FixIt The zero-based index of the fix-it. 1185 * 1186 * \param ReplacementRange The source range whose contents will be 1187 * replaced with the returned replacement string. Note that source 1188 * ranges are half-open ranges [a, b), so the source code should be 1189 * replaced from a and up to (but not including) b. 1190 * 1191 * \returns A string containing text that should be replace the source 1192 * code indicated by the \c ReplacementRange. 1193 */ 1194 CXString clang_getDiagnosticFixIt ( 1195 CXDiagnostic Diagnostic, 1196 uint FixIt, 1197 CXSourceRange* ReplacementRange); 1198 1199 /** 1200 * @} 1201 */ 1202 1203 /** 1204 * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation 1205 * 1206 * The routines in this group provide the ability to create and destroy 1207 * translation units from files, either by parsing the contents of the files or 1208 * by reading in a serialized representation of a translation unit. 1209 * 1210 * @{ 1211 */ 1212 1213 /** 1214 * Get the original translation unit source file name. 1215 */ 1216 CXString clang_getTranslationUnitSpelling (const CXTranslationUnit CTUnit) pure; 1217 1218 /** 1219 * Return the CXTranslationUnit for a given source file and the provided 1220 * command line arguments one would pass to the compiler. 1221 * 1222 * Note: The 'source_filename' argument is optional. If the caller provides a 1223 * NULL pointer, the name of the source file is expected to reside in the 1224 * specified command line arguments. 1225 * 1226 * Note: When encountered in 'clang_command_line_args', the following options 1227 * are ignored: 1228 * 1229 * '-c' 1230 * '-emit-ast' 1231 * '-fsyntax-only' 1232 * '-o \<output file>' (both '-o' and '\<output file>' are ignored) 1233 * 1234 * \param CIdx The index object with which the translation unit will be 1235 * associated. 1236 * 1237 * \param source_filename The name of the source file to load, or NULL if the 1238 * source file is included in \p clang_command_line_args. 1239 * 1240 * \param num_clang_command_line_args The number of command-line arguments in 1241 * \p clang_command_line_args. 1242 * 1243 * \param clang_command_line_args The command-line arguments that would be 1244 * passed to the \c clang executable if it were being invoked out-of-process. 1245 * These command-line options will be parsed and will affect how the translation 1246 * unit is parsed. Note that the following options are ignored: '-c', 1247 * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. 1248 * 1249 * \param num_unsaved_files the number of unsaved file entries in \p 1250 * unsaved_files. 1251 * 1252 * \param unsaved_files the files that have not yet been saved to disk 1253 * but may be required for code completion, including the contents of 1254 * those files. The contents and name of these files (as specified by 1255 * CXUnsavedFile) are copied when necessary, so the client only needs to 1256 * guarantee their validity until the call to this function returns. 1257 */ 1258 CXTranslationUnit clang_createTranslationUnitFromSourceFile ( 1259 CXIndex CIdx, 1260 const(char)* source_filename, 1261 int num_clang_command_line_args, 1262 const(char*)* clang_command_line_args, 1263 uint num_unsaved_files, 1264 CXUnsavedFile* unsaved_files); 1265 1266 /** 1267 * Same as \c clang_createTranslationUnit2, but returns 1268 * the \c CXTranslationUnit instead of an error code. In case of an error this 1269 * routine returns a \c NULL \c CXTranslationUnit, without further detailed 1270 * error codes. 1271 */ 1272 CXTranslationUnit clang_createTranslationUnit ( 1273 CXIndex CIdx, 1274 const(char)* ast_filename); 1275 1276 /** 1277 * Create a translation unit from an AST file (\c -emit-ast). 1278 * 1279 * \param[out] out_TU A non-NULL pointer to store the created 1280 * \c CXTranslationUnit. 1281 * 1282 * \returns Zero on success, otherwise returns an error code. 1283 */ 1284 CXErrorCode clang_createTranslationUnit2 ( 1285 CXIndex CIdx, 1286 const(char)* ast_filename, 1287 CXTranslationUnit* out_TU); 1288 1289 /** 1290 * Flags that control the creation of translation units. 1291 * 1292 * The enumerators in this enumeration type are meant to be bitwise 1293 * ORed together to specify which options should be used when 1294 * constructing the translation unit. 1295 */ 1296 enum CXTranslationUnit_Flags 1297 { 1298 /** 1299 * Used to indicate that no special translation-unit options are 1300 * needed. 1301 */ 1302 CXTranslationUnit_None = 0x0, 1303 1304 /** 1305 * Used to indicate that the parser should construct a "detailed" 1306 * preprocessing record, including all macro definitions and instantiations. 1307 * 1308 * Constructing a detailed preprocessing record requires more memory 1309 * and time to parse, since the information contained in the record 1310 * is usually not retained. However, it can be useful for 1311 * applications that require more detailed information about the 1312 * behavior of the preprocessor. 1313 */ 1314 CXTranslationUnit_DetailedPreprocessingRecord = 0x01, 1315 1316 /** 1317 * Used to indicate that the translation unit is incomplete. 1318 * 1319 * When a translation unit is considered "incomplete", semantic 1320 * analysis that is typically performed at the end of the 1321 * translation unit will be suppressed. For example, this suppresses 1322 * the completion of tentative declarations in C and of 1323 * instantiation of implicitly-instantiation function templates in 1324 * C++. This option is typically used when parsing a header with the 1325 * intent of producing a precompiled header. 1326 */ 1327 CXTranslationUnit_Incomplete = 0x02, 1328 1329 /** 1330 * Used to indicate that the translation unit should be built with an 1331 * implicit precompiled header for the preamble. 1332 * 1333 * An implicit precompiled header is used as an optimization when a 1334 * particular translation unit is likely to be reparsed many times 1335 * when the sources aren't changing that often. In this case, an 1336 * implicit precompiled header will be built containing all of the 1337 * initial includes at the top of the main file (what we refer to as 1338 * the "preamble" of the file). In subsequent parses, if the 1339 * preamble or the files in it have not changed, \c 1340 * clang_reparseTranslationUnit() will re-use the implicit 1341 * precompiled header to improve parsing performance. 1342 */ 1343 CXTranslationUnit_PrecompiledPreamble = 0x04, 1344 1345 /** 1346 * Used to indicate that the translation unit should cache some 1347 * code-completion results with each reparse of the source file. 1348 * 1349 * Caching of code-completion results is a performance optimization that 1350 * introduces some overhead to reparsing but improves the performance of 1351 * code-completion operations. 1352 */ 1353 CXTranslationUnit_CacheCompletionResults = 0x08, 1354 1355 /** 1356 * Used to indicate that the translation unit will be serialized with 1357 * \c clang_saveTranslationUnit. 1358 * 1359 * This option is typically used when parsing a header with the intent of 1360 * producing a precompiled header. 1361 */ 1362 CXTranslationUnit_ForSerialization = 0x10, 1363 1364 /** 1365 * DEPRECATED: Enabled chained precompiled preambles in C++. 1366 * 1367 * Note: this is a *temporary* option that is available only while 1368 * we are testing C++ precompiled preamble support. It is deprecated. 1369 */ 1370 CXTranslationUnit_CXXChainedPCH = 0x20, 1371 1372 /** 1373 * Used to indicate that function/method bodies should be skipped while 1374 * parsing. 1375 * 1376 * This option can be used to search for declarations/definitions while 1377 * ignoring the usages. 1378 */ 1379 CXTranslationUnit_SkipFunctionBodies = 0x40, 1380 1381 /** 1382 * Used to indicate that brief documentation comments should be 1383 * included into the set of code completions returned from this translation 1384 * unit. 1385 */ 1386 CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 0x80, 1387 1388 /** 1389 * Used to indicate that the precompiled preamble should be created on 1390 * the first parse. Otherwise it will be created on the first reparse. This 1391 * trades runtime on the first parse (serializing the preamble takes time) for 1392 * reduced runtime on the second parse (can now reuse the preamble). 1393 */ 1394 CXTranslationUnit_CreatePreambleOnFirstParse = 0x100, 1395 1396 /** 1397 * Do not stop processing when fatal errors are encountered. 1398 * 1399 * When fatal errors are encountered while parsing a translation unit, 1400 * semantic analysis is typically stopped early when compiling code. A common 1401 * source for fatal errors are unresolvable include files. For the 1402 * purposes of an IDE, this is undesirable behavior and as much information 1403 * as possible should be reported. Use this flag to enable this behavior. 1404 */ 1405 CXTranslationUnit_KeepGoing = 0x200, 1406 1407 /** 1408 * Sets the preprocessor in a mode for parsing a single file only. 1409 */ 1410 CXTranslationUnit_SingleFileParse = 0x400, 1411 1412 /** 1413 * Used in combination with CXTranslationUnit_SkipFunctionBodies to 1414 * constrain the skipping of function bodies to the preamble. 1415 * 1416 * The function bodies of the main file are not skipped. 1417 */ 1418 CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 0x800, 1419 1420 /** 1421 * Used to indicate that attributed types should be included in CXType. 1422 */ 1423 CXTranslationUnit_IncludeAttributedTypes = 0x1000, 1424 1425 /** 1426 * Used to indicate that implicit attributes should be visited. 1427 */ 1428 CXTranslationUnit_VisitImplicitAttributes = 0x2000, 1429 1430 /** 1431 * Used to indicate that non-errors from included files should be ignored. 1432 * 1433 * If set, clang_getDiagnosticSetFromTU() will not report e.g. warnings from 1434 * included files anymore. This speeds up clang_getDiagnosticSetFromTU() for 1435 * the case where these warnings are not of interest, as for an IDE for 1436 * example, which typically shows only the diagnostics in the main file. 1437 */ 1438 CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000, 1439 1440 /** 1441 * Tells the preprocessor not to skip excluded conditional blocks. 1442 */ 1443 CXTranslationUnit_RetainExcludedConditionalBlocks = 0x8000 1444 } 1445 1446 alias CXTranslationUnit_None = CXTranslationUnit_Flags.CXTranslationUnit_None; 1447 alias CXTranslationUnit_DetailedPreprocessingRecord = CXTranslationUnit_Flags.CXTranslationUnit_DetailedPreprocessingRecord; 1448 alias CXTranslationUnit_Incomplete = CXTranslationUnit_Flags.CXTranslationUnit_Incomplete; 1449 alias CXTranslationUnit_PrecompiledPreamble = CXTranslationUnit_Flags.CXTranslationUnit_PrecompiledPreamble; 1450 alias CXTranslationUnit_CacheCompletionResults = CXTranslationUnit_Flags.CXTranslationUnit_CacheCompletionResults; 1451 alias CXTranslationUnit_ForSerialization = CXTranslationUnit_Flags.CXTranslationUnit_ForSerialization; 1452 alias CXTranslationUnit_CXXChainedPCH = CXTranslationUnit_Flags.CXTranslationUnit_CXXChainedPCH; 1453 alias CXTranslationUnit_SkipFunctionBodies = CXTranslationUnit_Flags.CXTranslationUnit_SkipFunctionBodies; 1454 alias CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = CXTranslationUnit_Flags.CXTranslationUnit_IncludeBriefCommentsInCodeCompletion; 1455 alias CXTranslationUnit_CreatePreambleOnFirstParse = CXTranslationUnit_Flags.CXTranslationUnit_CreatePreambleOnFirstParse; 1456 alias CXTranslationUnit_KeepGoing = CXTranslationUnit_Flags.CXTranslationUnit_KeepGoing; 1457 alias CXTranslationUnit_SingleFileParse = CXTranslationUnit_Flags.CXTranslationUnit_SingleFileParse; 1458 alias CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = CXTranslationUnit_Flags.CXTranslationUnit_LimitSkipFunctionBodiesToPreamble; 1459 alias CXTranslationUnit_IncludeAttributedTypes = CXTranslationUnit_Flags.CXTranslationUnit_IncludeAttributedTypes; 1460 alias CXTranslationUnit_VisitImplicitAttributes = CXTranslationUnit_Flags.CXTranslationUnit_VisitImplicitAttributes; 1461 alias CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = CXTranslationUnit_Flags.CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles; 1462 alias CXTranslationUnit_RetainExcludedConditionalBlocks = CXTranslationUnit_Flags.CXTranslationUnit_RetainExcludedConditionalBlocks; 1463 1464 /** 1465 * Returns the set of flags that is suitable for parsing a translation 1466 * unit that is being edited. 1467 * 1468 * The set of flags returned provide options for \c clang_parseTranslationUnit() 1469 * to indicate that the translation unit is likely to be reparsed many times, 1470 * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly 1471 * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag 1472 * set contains an unspecified set of optimizations (e.g., the precompiled 1473 * preamble) geared toward improving the performance of these routines. The 1474 * set of optimizations enabled may change from one version to the next. 1475 */ 1476 uint clang_defaultEditingTranslationUnitOptions (); 1477 1478 /** 1479 * Same as \c clang_parseTranslationUnit2, but returns 1480 * the \c CXTranslationUnit instead of an error code. In case of an error this 1481 * routine returns a \c NULL \c CXTranslationUnit, without further detailed 1482 * error codes. 1483 */ 1484 CXTranslationUnit clang_parseTranslationUnit ( 1485 CXIndex CIdx, 1486 const(char)* source_filename, 1487 const(char*)* command_line_args, 1488 int num_command_line_args, 1489 CXUnsavedFile* unsaved_files, 1490 uint num_unsaved_files, 1491 uint options); 1492 1493 /** 1494 * Parse the given source file and the translation unit corresponding 1495 * to that file. 1496 * 1497 * This routine is the main entry point for the Clang C API, providing the 1498 * ability to parse a source file into a translation unit that can then be 1499 * queried by other functions in the API. This routine accepts a set of 1500 * command-line arguments so that the compilation can be configured in the same 1501 * way that the compiler is configured on the command line. 1502 * 1503 * \param CIdx The index object with which the translation unit will be 1504 * associated. 1505 * 1506 * \param source_filename The name of the source file to load, or NULL if the 1507 * source file is included in \c command_line_args. 1508 * 1509 * \param command_line_args The command-line arguments that would be 1510 * passed to the \c clang executable if it were being invoked out-of-process. 1511 * These command-line options will be parsed and will affect how the translation 1512 * unit is parsed. Note that the following options are ignored: '-c', 1513 * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. 1514 * 1515 * \param num_command_line_args The number of command-line arguments in 1516 * \c command_line_args. 1517 * 1518 * \param unsaved_files the files that have not yet been saved to disk 1519 * but may be required for parsing, including the contents of 1520 * those files. The contents and name of these files (as specified by 1521 * CXUnsavedFile) are copied when necessary, so the client only needs to 1522 * guarantee their validity until the call to this function returns. 1523 * 1524 * \param num_unsaved_files the number of unsaved file entries in \p 1525 * unsaved_files. 1526 * 1527 * \param options A bitmask of options that affects how the translation unit 1528 * is managed but not its compilation. This should be a bitwise OR of the 1529 * CXTranslationUnit_XXX flags. 1530 * 1531 * \param[out] out_TU A non-NULL pointer to store the created 1532 * \c CXTranslationUnit, describing the parsed code and containing any 1533 * diagnostics produced by the compiler. 1534 * 1535 * \returns Zero on success, otherwise returns an error code. 1536 */ 1537 CXErrorCode clang_parseTranslationUnit2 ( 1538 CXIndex CIdx, 1539 const(char)* source_filename, 1540 const(char*)* command_line_args, 1541 int num_command_line_args, 1542 CXUnsavedFile* unsaved_files, 1543 uint num_unsaved_files, 1544 uint options, 1545 CXTranslationUnit* out_TU); 1546 1547 /** 1548 * Same as clang_parseTranslationUnit2 but requires a full command line 1549 * for \c command_line_args including argv[0]. This is useful if the standard 1550 * library paths are relative to the binary. 1551 */ 1552 CXErrorCode clang_parseTranslationUnit2FullArgv ( 1553 CXIndex CIdx, 1554 const(char)* source_filename, 1555 const(char*)* command_line_args, 1556 int num_command_line_args, 1557 CXUnsavedFile* unsaved_files, 1558 uint num_unsaved_files, 1559 uint options, 1560 CXTranslationUnit* out_TU); 1561 1562 /** 1563 * Flags that control how translation units are saved. 1564 * 1565 * The enumerators in this enumeration type are meant to be bitwise 1566 * ORed together to specify which options should be used when 1567 * saving the translation unit. 1568 */ 1569 enum CXSaveTranslationUnit_Flags 1570 { 1571 /** 1572 * Used to indicate that no special saving options are needed. 1573 */ 1574 CXSaveTranslationUnit_None = 0x0 1575 } 1576 1577 alias CXSaveTranslationUnit_None = CXSaveTranslationUnit_Flags.CXSaveTranslationUnit_None; 1578 1579 /** 1580 * Returns the set of flags that is suitable for saving a translation 1581 * unit. 1582 * 1583 * The set of flags returned provide options for 1584 * \c clang_saveTranslationUnit() by default. The returned flag 1585 * set contains an unspecified set of options that save translation units with 1586 * the most commonly-requested data. 1587 */ 1588 uint clang_defaultSaveOptions (const CXTranslationUnit TU); 1589 1590 /** 1591 * Describes the kind of error that occurred (if any) in a call to 1592 * \c clang_saveTranslationUnit(). 1593 */ 1594 enum CXSaveError 1595 { 1596 /** 1597 * Indicates that no error occurred while saving a translation unit. 1598 */ 1599 CXSaveError_None = 0, 1600 1601 /** 1602 * Indicates that an unknown error occurred while attempting to save 1603 * the file. 1604 * 1605 * This error typically indicates that file I/O failed when attempting to 1606 * write the file. 1607 */ 1608 CXSaveError_Unknown = 1, 1609 1610 /** 1611 * Indicates that errors during translation prevented this attempt 1612 * to save the translation unit. 1613 * 1614 * Errors that prevent the translation unit from being saved can be 1615 * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic(). 1616 */ 1617 CXSaveError_TranslationErrors = 2, 1618 1619 /** 1620 * Indicates that the translation unit to be saved was somehow 1621 * invalid (e.g., NULL). 1622 */ 1623 CXSaveError_InvalidTU = 3 1624 } 1625 1626 alias CXSaveError_None = CXSaveError.CXSaveError_None; 1627 alias CXSaveError_Unknown = CXSaveError.CXSaveError_Unknown; 1628 alias CXSaveError_TranslationErrors = CXSaveError.CXSaveError_TranslationErrors; 1629 alias CXSaveError_InvalidTU = CXSaveError.CXSaveError_InvalidTU; 1630 1631 /** 1632 * Saves a translation unit into a serialized representation of 1633 * that translation unit on disk. 1634 * 1635 * Any translation unit that was parsed without error can be saved 1636 * into a file. The translation unit can then be deserialized into a 1637 * new \c CXTranslationUnit with \c clang_createTranslationUnit() or, 1638 * if it is an incomplete translation unit that corresponds to a 1639 * header, used as a precompiled header when parsing other translation 1640 * units. 1641 * 1642 * \param TU The translation unit to save. 1643 * 1644 * \param FileName The file to which the translation unit will be saved. 1645 * 1646 * \param options A bitmask of options that affects how the translation unit 1647 * is saved. This should be a bitwise OR of the 1648 * CXSaveTranslationUnit_XXX flags. 1649 * 1650 * \returns A value that will match one of the enumerators of the CXSaveError 1651 * enumeration. Zero (CXSaveError_None) indicates that the translation unit was 1652 * saved successfully, while a non-zero value indicates that a problem occurred. 1653 */ 1654 int clang_saveTranslationUnit ( 1655 CXTranslationUnit TU, 1656 const(char)* FileName, 1657 uint options); 1658 1659 /** 1660 * Suspend a translation unit in order to free memory associated with it. 1661 * 1662 * A suspended translation unit uses significantly less memory but on the other 1663 * side does not support any other calls than \c clang_reparseTranslationUnit 1664 * to resume it or \c clang_disposeTranslationUnit to dispose it completely. 1665 */ 1666 uint clang_suspendTranslationUnit (const CXTranslationUnit); 1667 1668 /** 1669 * Destroy the specified CXTranslationUnit object. 1670 */ 1671 void clang_disposeTranslationUnit (const CXTranslationUnit); 1672 1673 /** 1674 * Flags that control the reparsing of translation units. 1675 * 1676 * The enumerators in this enumeration type are meant to be bitwise 1677 * ORed together to specify which options should be used when 1678 * reparsing the translation unit. 1679 */ 1680 enum CXReparse_Flags 1681 { 1682 /** 1683 * Used to indicate that no special reparsing options are needed. 1684 */ 1685 CXReparse_None = 0x0 1686 } 1687 1688 alias CXReparse_None = CXReparse_Flags.CXReparse_None; 1689 1690 /** 1691 * Returns the set of flags that is suitable for reparsing a translation 1692 * unit. 1693 * 1694 * The set of flags returned provide options for 1695 * \c clang_reparseTranslationUnit() by default. The returned flag 1696 * set contains an unspecified set of optimizations geared toward common uses 1697 * of reparsing. The set of optimizations enabled may change from one version 1698 * to the next. 1699 */ 1700 uint clang_defaultReparseOptions (const CXTranslationUnit TU); 1701 1702 /** 1703 * Reparse the source files that produced this translation unit. 1704 * 1705 * This routine can be used to re-parse the source files that originally 1706 * created the given translation unit, for example because those source files 1707 * have changed (either on disk or as passed via \p unsaved_files). The 1708 * source code will be reparsed with the same command-line options as it 1709 * was originally parsed. 1710 * 1711 * Reparsing a translation unit invalidates all cursors and source locations 1712 * that refer into that translation unit. This makes reparsing a translation 1713 * unit semantically equivalent to destroying the translation unit and then 1714 * creating a new translation unit with the same command-line arguments. 1715 * However, it may be more efficient to reparse a translation 1716 * unit using this routine. 1717 * 1718 * \param TU The translation unit whose contents will be re-parsed. The 1719 * translation unit must originally have been built with 1720 * \c clang_createTranslationUnitFromSourceFile(). 1721 * 1722 * \param num_unsaved_files The number of unsaved file entries in \p 1723 * unsaved_files. 1724 * 1725 * \param unsaved_files The files that have not yet been saved to disk 1726 * but may be required for parsing, including the contents of 1727 * those files. The contents and name of these files (as specified by 1728 * CXUnsavedFile) are copied when necessary, so the client only needs to 1729 * guarantee their validity until the call to this function returns. 1730 * 1731 * \param options A bitset of options composed of the flags in CXReparse_Flags. 1732 * The function \c clang_defaultReparseOptions() produces a default set of 1733 * options recommended for most uses, based on the translation unit. 1734 * 1735 * \returns 0 if the sources could be reparsed. A non-zero error code will be 1736 * returned if reparsing was impossible, such that the translation unit is 1737 * invalid. In such cases, the only valid call for \c TU is 1738 * \c clang_disposeTranslationUnit(TU). The error codes returned by this 1739 * routine are described by the \c CXErrorCode enum. 1740 */ 1741 int clang_reparseTranslationUnit ( 1742 CXTranslationUnit TU, 1743 uint num_unsaved_files, 1744 CXUnsavedFile* unsaved_files, 1745 uint options); 1746 1747 /** 1748 * Categorizes how memory is being used by a translation unit. 1749 */ 1750 enum CXTUResourceUsageKind 1751 { 1752 CXTUResourceUsage_AST = 1, 1753 CXTUResourceUsage_Identifiers = 2, 1754 CXTUResourceUsage_Selectors = 3, 1755 CXTUResourceUsage_GlobalCompletionResults = 4, 1756 CXTUResourceUsage_SourceManagerContentCache = 5, 1757 CXTUResourceUsage_AST_SideTables = 6, 1758 CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7, 1759 CXTUResourceUsage_SourceManager_Membuffer_MMap = 8, 1760 CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9, 1761 CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10, 1762 CXTUResourceUsage_Preprocessor = 11, 1763 CXTUResourceUsage_PreprocessingRecord = 12, 1764 CXTUResourceUsage_SourceManager_DataStructures = 13, 1765 CXTUResourceUsage_Preprocessor_HeaderSearch = 14, 1766 CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST, 1767 CXTUResourceUsage_MEMORY_IN_BYTES_END = CXTUResourceUsage_Preprocessor_HeaderSearch, 1768 1769 CXTUResourceUsage_First = CXTUResourceUsage_AST, 1770 CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch 1771 } 1772 1773 alias CXTUResourceUsage_AST = CXTUResourceUsageKind.CXTUResourceUsage_AST; 1774 alias CXTUResourceUsage_Identifiers = CXTUResourceUsageKind.CXTUResourceUsage_Identifiers; 1775 alias CXTUResourceUsage_Selectors = CXTUResourceUsageKind.CXTUResourceUsage_Selectors; 1776 alias CXTUResourceUsage_GlobalCompletionResults = CXTUResourceUsageKind.CXTUResourceUsage_GlobalCompletionResults; 1777 alias CXTUResourceUsage_SourceManagerContentCache = CXTUResourceUsageKind.CXTUResourceUsage_SourceManagerContentCache; 1778 alias CXTUResourceUsage_AST_SideTables = CXTUResourceUsageKind.CXTUResourceUsage_AST_SideTables; 1779 alias CXTUResourceUsage_SourceManager_Membuffer_Malloc = CXTUResourceUsageKind.CXTUResourceUsage_SourceManager_Membuffer_Malloc; 1780 alias CXTUResourceUsage_SourceManager_Membuffer_MMap = CXTUResourceUsageKind.CXTUResourceUsage_SourceManager_Membuffer_MMap; 1781 alias CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = CXTUResourceUsageKind.CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc; 1782 alias CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = CXTUResourceUsageKind.CXTUResourceUsage_ExternalASTSource_Membuffer_MMap; 1783 alias CXTUResourceUsage_Preprocessor = CXTUResourceUsageKind.CXTUResourceUsage_Preprocessor; 1784 alias CXTUResourceUsage_PreprocessingRecord = CXTUResourceUsageKind.CXTUResourceUsage_PreprocessingRecord; 1785 alias CXTUResourceUsage_SourceManager_DataStructures = CXTUResourceUsageKind.CXTUResourceUsage_SourceManager_DataStructures; 1786 alias CXTUResourceUsage_Preprocessor_HeaderSearch = CXTUResourceUsageKind.CXTUResourceUsage_Preprocessor_HeaderSearch; 1787 alias CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsageKind.CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN; 1788 alias CXTUResourceUsage_MEMORY_IN_BYTES_END = CXTUResourceUsageKind.CXTUResourceUsage_MEMORY_IN_BYTES_END; 1789 alias CXTUResourceUsage_First = CXTUResourceUsageKind.CXTUResourceUsage_First; 1790 alias CXTUResourceUsage_Last = CXTUResourceUsageKind.CXTUResourceUsage_Last; 1791 1792 /** 1793 * Returns the human-readable null-terminated C string that represents 1794 * the name of the memory category. This string should never be freed. 1795 */ 1796 const(char)* clang_getTUResourceUsageName (const CXTUResourceUsageKind kind); 1797 1798 struct CXTUResourceUsageEntry 1799 { 1800 /* The memory usage category. */ 1801 CXTUResourceUsageKind kind; 1802 /* Amount of resources used. 1803 The units will depend on the resource kind. */ 1804 c_ulong amount; 1805 } 1806 1807 /** 1808 * The memory usage of a CXTranslationUnit, broken into categories. 1809 */ 1810 struct CXTUResourceUsage 1811 { 1812 /* Private data member, used for queries. */ 1813 void* data; 1814 1815 /* The number of entries in the 'entries' array. */ 1816 uint numEntries; 1817 1818 /* An array of key-value pairs, representing the breakdown of memory 1819 usage. */ 1820 CXTUResourceUsageEntry* entries; 1821 } 1822 1823 /** 1824 * Return the memory usage of a translation unit. This object 1825 * should be released with clang_disposeCXTUResourceUsage(). 1826 */ 1827 CXTUResourceUsage clang_getCXTUResourceUsage (const CXTranslationUnit TU); 1828 1829 void clang_disposeCXTUResourceUsage (const CXTUResourceUsage usage); 1830 1831 /** 1832 * Get target information for this translation unit. 1833 * 1834 * The CXTargetInfo object cannot outlive the CXTranslationUnit object. 1835 */ 1836 CXTargetInfo clang_getTranslationUnitTargetInfo (const CXTranslationUnit CTUnit); 1837 1838 /** 1839 * Destroy the CXTargetInfo object. 1840 */ 1841 void clang_TargetInfo_dispose (const CXTargetInfo Info); 1842 1843 /** 1844 * Get the normalized target triple as a string. 1845 * 1846 * Returns the empty string in case of any error. 1847 */ 1848 CXString clang_TargetInfo_getTriple (const CXTargetInfo Info); 1849 1850 /** 1851 * Get the pointer width of the target in bits. 1852 * 1853 * Returns -1 in case of error. 1854 */ 1855 int clang_TargetInfo_getPointerWidth (const CXTargetInfo Info); 1856 1857 /** 1858 * @} 1859 */ 1860 1861 /** 1862 * Describes the kind of entity that a cursor refers to. 1863 */ 1864 enum CXCursorKind 1865 { 1866 /* Declarations */ 1867 /** 1868 * A declaration whose specific kind is not exposed via this 1869 * interface. 1870 * 1871 * Unexposed declarations have the same operations as any other kind 1872 * of declaration; one can extract their location information, 1873 * spelling, find their definitions, etc. However, the specific kind 1874 * of the declaration is not reported. 1875 */ 1876 CXCursor_UnexposedDecl = 1, 1877 /** A C or C++ struct. */ 1878 CXCursor_StructDecl = 2, 1879 /** A C or C++ union. */ 1880 CXCursor_UnionDecl = 3, 1881 /** A C++ class. */ 1882 CXCursor_ClassDecl = 4, 1883 /** An enumeration. */ 1884 CXCursor_EnumDecl = 5, 1885 /** 1886 * A field (in C) or non-static data member (in C++) in a 1887 * struct, union, or C++ class. 1888 */ 1889 CXCursor_FieldDecl = 6, 1890 /** An enumerator constant. */ 1891 CXCursor_EnumConstantDecl = 7, 1892 /** A function. */ 1893 CXCursor_FunctionDecl = 8, 1894 /** A variable. */ 1895 CXCursor_VarDecl = 9, 1896 /** A function or method parameter. */ 1897 CXCursor_ParmDecl = 10, 1898 /** An Objective-C \@interface. */ 1899 CXCursor_ObjCInterfaceDecl = 11, 1900 /** An Objective-C \@interface for a category. */ 1901 CXCursor_ObjCCategoryDecl = 12, 1902 /** An Objective-C \@protocol declaration. */ 1903 CXCursor_ObjCProtocolDecl = 13, 1904 /** An Objective-C \@property declaration. */ 1905 CXCursor_ObjCPropertyDecl = 14, 1906 /** An Objective-C instance variable. */ 1907 CXCursor_ObjCIvarDecl = 15, 1908 /** An Objective-C instance method. */ 1909 CXCursor_ObjCInstanceMethodDecl = 16, 1910 /** An Objective-C class method. */ 1911 CXCursor_ObjCClassMethodDecl = 17, 1912 /** An Objective-C \@implementation. */ 1913 CXCursor_ObjCImplementationDecl = 18, 1914 /** An Objective-C \@implementation for a category. */ 1915 CXCursor_ObjCCategoryImplDecl = 19, 1916 /** A typedef. */ 1917 CXCursor_TypedefDecl = 20, 1918 /** A C++ class method. */ 1919 CXCursor_CXXMethod = 21, 1920 /** A C++ namespace. */ 1921 CXCursor_Namespace = 22, 1922 /** A linkage specification, e.g. 'extern "C"'. */ 1923 CXCursor_LinkageSpec = 23, 1924 /** A C++ constructor. */ 1925 CXCursor_Constructor = 24, 1926 /** A C++ destructor. */ 1927 CXCursor_Destructor = 25, 1928 /** A C++ conversion function. */ 1929 CXCursor_ConversionFunction = 26, 1930 /** A C++ template type parameter. */ 1931 CXCursor_TemplateTypeParameter = 27, 1932 /** A C++ non-type template parameter. */ 1933 CXCursor_NonTypeTemplateParameter = 28, 1934 /** A C++ template template parameter. */ 1935 CXCursor_TemplateTemplateParameter = 29, 1936 /** A C++ function template. */ 1937 CXCursor_FunctionTemplate = 30, 1938 /** A C++ class template. */ 1939 CXCursor_ClassTemplate = 31, 1940 /** A C++ class template partial specialization. */ 1941 CXCursor_ClassTemplatePartialSpecialization = 32, 1942 /** A C++ namespace alias declaration. */ 1943 CXCursor_NamespaceAlias = 33, 1944 /** A C++ using directive. */ 1945 CXCursor_UsingDirective = 34, 1946 /** A C++ using declaration. */ 1947 CXCursor_UsingDeclaration = 35, 1948 /** A C++ alias declaration */ 1949 CXCursor_TypeAliasDecl = 36, 1950 /** An Objective-C \@synthesize definition. */ 1951 CXCursor_ObjCSynthesizeDecl = 37, 1952 /** An Objective-C \@dynamic definition. */ 1953 CXCursor_ObjCDynamicDecl = 38, 1954 /** An access specifier. */ 1955 CXCursor_CXXAccessSpecifier = 39, 1956 1957 CXCursor_FirstDecl = CXCursor_UnexposedDecl, 1958 CXCursor_LastDecl = CXCursor_CXXAccessSpecifier, 1959 1960 /* References */ 1961 CXCursor_FirstRef = 40, /* Decl references */ 1962 CXCursor_ObjCSuperClassRef = 40, 1963 CXCursor_ObjCProtocolRef = 41, 1964 CXCursor_ObjCClassRef = 42, 1965 /** 1966 * A reference to a type declaration. 1967 * 1968 * A type reference occurs anywhere where a type is named but not 1969 * declared. For example, given: 1970 * 1971 * \code 1972 * typedef unsigned size_type; 1973 * size_type size; 1974 * \endcode 1975 * 1976 * The typedef is a declaration of size_type (CXCursor_TypedefDecl), 1977 * while the type of the variable "size" is referenced. The cursor 1978 * referenced by the type of size is the typedef for size_type. 1979 */ 1980 CXCursor_TypeRef = 43, 1981 CXCursor_CXXBaseSpecifier = 44, 1982 /** 1983 * A reference to a class template, function template, template 1984 * template parameter, or class template partial specialization. 1985 */ 1986 CXCursor_TemplateRef = 45, 1987 /** 1988 * A reference to a namespace or namespace alias. 1989 */ 1990 CXCursor_NamespaceRef = 46, 1991 /** 1992 * A reference to a member of a struct, union, or class that occurs in 1993 * some non-expression context, e.g., a designated initializer. 1994 */ 1995 CXCursor_MemberRef = 47, 1996 /** 1997 * A reference to a labeled statement. 1998 * 1999 * This cursor kind is used to describe the jump to "start_over" in the 2000 * goto statement in the following example: 2001 * 2002 * \code 2003 * start_over: 2004 * ++counter; 2005 * 2006 * goto start_over; 2007 * \endcode 2008 * 2009 * A label reference cursor refers to a label statement. 2010 */ 2011 CXCursor_LabelRef = 48, 2012 2013 /** 2014 * A reference to a set of overloaded functions or function templates 2015 * that has not yet been resolved to a specific function or function template. 2016 * 2017 * An overloaded declaration reference cursor occurs in C++ templates where 2018 * a dependent name refers to a function. For example: 2019 * 2020 * \code 2021 * template<typename T> void swap(T&, T&); 2022 * 2023 * struct X { ... }; 2024 * void swap(X&, X&); 2025 * 2026 * template<typename T> 2027 * void reverse(T* first, T* last) { 2028 * while (first < last - 1) { 2029 * swap(*first, *--last); 2030 * ++first; 2031 * } 2032 * } 2033 * 2034 * struct Y { }; 2035 * void swap(Y&, Y&); 2036 * \endcode 2037 * 2038 * Here, the identifier "swap" is associated with an overloaded declaration 2039 * reference. In the template definition, "swap" refers to either of the two 2040 * "swap" functions declared above, so both results will be available. At 2041 * instantiation time, "swap" may also refer to other functions found via 2042 * argument-dependent lookup (e.g., the "swap" function at the end of the 2043 * example). 2044 * 2045 * The functions \c clang_getNumOverloadedDecls() and 2046 * \c clang_getOverloadedDecl() can be used to retrieve the definitions 2047 * referenced by this cursor. 2048 */ 2049 CXCursor_OverloadedDeclRef = 49, 2050 2051 /** 2052 * A reference to a variable that occurs in some non-expression 2053 * context, e.g., a C++ lambda capture list. 2054 */ 2055 CXCursor_VariableRef = 50, 2056 2057 CXCursor_LastRef = CXCursor_VariableRef, 2058 2059 /* Error conditions */ 2060 CXCursor_FirstInvalid = 70, 2061 CXCursor_InvalidFile = 70, 2062 CXCursor_NoDeclFound = 71, 2063 CXCursor_NotImplemented = 72, 2064 CXCursor_InvalidCode = 73, 2065 CXCursor_LastInvalid = CXCursor_InvalidCode, 2066 2067 /* Expressions */ 2068 CXCursor_FirstExpr = 100, 2069 2070 /** 2071 * An expression whose specific kind is not exposed via this 2072 * interface. 2073 * 2074 * Unexposed expressions have the same operations as any other kind 2075 * of expression; one can extract their location information, 2076 * spelling, children, etc. However, the specific kind of the 2077 * expression is not reported. 2078 */ 2079 CXCursor_UnexposedExpr = 100, 2080 2081 /** 2082 * An expression that refers to some value declaration, such 2083 * as a function, variable, or enumerator. 2084 */ 2085 CXCursor_DeclRefExpr = 101, 2086 2087 /** 2088 * An expression that refers to a member of a struct, union, 2089 * class, Objective-C class, etc. 2090 */ 2091 CXCursor_MemberRefExpr = 102, 2092 2093 /** An expression that calls a function. */ 2094 CXCursor_CallExpr = 103, 2095 2096 /** An expression that sends a message to an Objective-C 2097 object or class. */ 2098 CXCursor_ObjCMessageExpr = 104, 2099 2100 /** An expression that represents a block literal. */ 2101 CXCursor_BlockExpr = 105, 2102 2103 /** An integer literal. 2104 */ 2105 CXCursor_IntegerLiteral = 106, 2106 2107 /** A floating point number literal. 2108 */ 2109 CXCursor_FloatingLiteral = 107, 2110 2111 /** An imaginary number literal. 2112 */ 2113 CXCursor_ImaginaryLiteral = 108, 2114 2115 /** A string literal. 2116 */ 2117 CXCursor_StringLiteral = 109, 2118 2119 /** A character literal. 2120 */ 2121 CXCursor_CharacterLiteral = 110, 2122 2123 /** A parenthesized expression, e.g. "(1)". 2124 * 2125 * This AST node is only formed if full location information is requested. 2126 */ 2127 CXCursor_ParenExpr = 111, 2128 2129 /** This represents the unary-expression's (except sizeof and 2130 * alignof). 2131 */ 2132 CXCursor_UnaryOperator = 112, 2133 2134 /** [C99 6.5.2.1] Array Subscripting. 2135 */ 2136 CXCursor_ArraySubscriptExpr = 113, 2137 2138 /** A builtin binary operation expression such as "x + y" or 2139 * "x <= y". 2140 */ 2141 CXCursor_BinaryOperator = 114, 2142 2143 /** Compound assignment such as "+=". 2144 */ 2145 CXCursor_CompoundAssignOperator = 115, 2146 2147 /** The ?: ternary operator. 2148 */ 2149 CXCursor_ConditionalOperator = 116, 2150 2151 /** An explicit cast in C (C99 6.5.4) or a C-style cast in C++ 2152 * (C++ [expr.cast]), which uses the syntax (Type)expr. 2153 * 2154 * For example: (int)f. 2155 */ 2156 CXCursor_CStyleCastExpr = 117, 2157 2158 /** [C99 6.5.2.5] 2159 */ 2160 CXCursor_CompoundLiteralExpr = 118, 2161 2162 /** Describes an C or C++ initializer list. 2163 */ 2164 CXCursor_InitListExpr = 119, 2165 2166 /** The GNU address of label extension, representing &&label. 2167 */ 2168 CXCursor_AddrLabelExpr = 120, 2169 2170 /** This is the GNU Statement Expression extension: ({int X=4; X;}) 2171 */ 2172 CXCursor_StmtExpr = 121, 2173 2174 /** Represents a C11 generic selection. 2175 */ 2176 CXCursor_GenericSelectionExpr = 122, 2177 2178 /** Implements the GNU __null extension, which is a name for a null 2179 * pointer constant that has integral type (e.g., int or long) and is the same 2180 * size and alignment as a pointer. 2181 * 2182 * The __null extension is typically only used by system headers, which define 2183 * NULL as __null in C++ rather than using 0 (which is an integer that may not 2184 * match the size of a pointer). 2185 */ 2186 CXCursor_GNUNullExpr = 123, 2187 2188 /** C++'s static_cast<> expression. 2189 */ 2190 CXCursor_CXXStaticCastExpr = 124, 2191 2192 /** C++'s dynamic_cast<> expression. 2193 */ 2194 CXCursor_CXXDynamicCastExpr = 125, 2195 2196 /** C++'s reinterpret_cast<> expression. 2197 */ 2198 CXCursor_CXXReinterpretCastExpr = 126, 2199 2200 /** C++'s const_cast<> expression. 2201 */ 2202 CXCursor_CXXConstCastExpr = 127, 2203 2204 /** Represents an explicit C++ type conversion that uses "functional" 2205 * notion (C++ [expr.type.conv]). 2206 * 2207 * Example: 2208 * \code 2209 * x = int(0.5); 2210 * \endcode 2211 */ 2212 CXCursor_CXXFunctionalCastExpr = 128, 2213 2214 /** A C++ typeid expression (C++ [expr.typeid]). 2215 */ 2216 CXCursor_CXXTypeidExpr = 129, 2217 2218 /** [C++ 2.13.5] C++ Boolean Literal. 2219 */ 2220 CXCursor_CXXBoolLiteralExpr = 130, 2221 2222 /** [C++0x 2.14.7] C++ Pointer Literal. 2223 */ 2224 CXCursor_CXXNullPtrLiteralExpr = 131, 2225 2226 /** Represents the "this" expression in C++ 2227 */ 2228 CXCursor_CXXThisExpr = 132, 2229 2230 /** [C++ 15] C++ Throw Expression. 2231 * 2232 * This handles 'throw' and 'throw' assignment-expression. When 2233 * assignment-expression isn't present, Op will be null. 2234 */ 2235 CXCursor_CXXThrowExpr = 133, 2236 2237 /** A new expression for memory allocation and constructor calls, e.g: 2238 * "new CXXNewExpr(foo)". 2239 */ 2240 CXCursor_CXXNewExpr = 134, 2241 2242 /** A delete expression for memory deallocation and destructor calls, 2243 * e.g. "delete[] pArray". 2244 */ 2245 CXCursor_CXXDeleteExpr = 135, 2246 2247 /** A unary expression. (noexcept, sizeof, or other traits) 2248 */ 2249 CXCursor_UnaryExpr = 136, 2250 2251 /** An Objective-C string literal i.e. @"foo". 2252 */ 2253 CXCursor_ObjCStringLiteral = 137, 2254 2255 /** An Objective-C \@encode expression. 2256 */ 2257 CXCursor_ObjCEncodeExpr = 138, 2258 2259 /** An Objective-C \@selector expression. 2260 */ 2261 CXCursor_ObjCSelectorExpr = 139, 2262 2263 /** An Objective-C \@protocol expression. 2264 */ 2265 CXCursor_ObjCProtocolExpr = 140, 2266 2267 /** An Objective-C "bridged" cast expression, which casts between 2268 * Objective-C pointers and C pointers, transferring ownership in the process. 2269 * 2270 * \code 2271 * NSString *str = (__bridge_transfer NSString *)CFCreateString(); 2272 * \endcode 2273 */ 2274 CXCursor_ObjCBridgedCastExpr = 141, 2275 2276 /** Represents a C++0x pack expansion that produces a sequence of 2277 * expressions. 2278 * 2279 * A pack expansion expression contains a pattern (which itself is an 2280 * expression) followed by an ellipsis. For example: 2281 * 2282 * \code 2283 * template<typename F, typename ...Types> 2284 * void forward(F f, Types &&...args) { 2285 * f(static_cast<Types&&>(args)...); 2286 * } 2287 * \endcode 2288 */ 2289 CXCursor_PackExpansionExpr = 142, 2290 2291 /** Represents an expression that computes the length of a parameter 2292 * pack. 2293 * 2294 * \code 2295 * template<typename ...Types> 2296 * struct count { 2297 * static const unsigned value = sizeof...(Types); 2298 * }; 2299 * \endcode 2300 */ 2301 CXCursor_SizeOfPackExpr = 143, 2302 2303 /* Represents a C++ lambda expression that produces a local function 2304 * object. 2305 * 2306 * \code 2307 * void abssort(float *x, unsigned N) { 2308 * std::sort(x, x + N, 2309 * [](float a, float b) { 2310 * return std::abs(a) < std::abs(b); 2311 * }); 2312 * } 2313 * \endcode 2314 */ 2315 CXCursor_LambdaExpr = 144, 2316 2317 /** Objective-c Boolean Literal. 2318 */ 2319 CXCursor_ObjCBoolLiteralExpr = 145, 2320 2321 /** Represents the "self" expression in an Objective-C method. 2322 */ 2323 CXCursor_ObjCSelfExpr = 146, 2324 2325 /** OpenMP 5.0 [2.1.5, Array Section]. 2326 */ 2327 CXCursor_OMPArraySectionExpr = 147, 2328 2329 /** Represents an @available(...) check. 2330 */ 2331 CXCursor_ObjCAvailabilityCheckExpr = 148, 2332 2333 /** 2334 * Fixed point literal 2335 */ 2336 CXCursor_FixedPointLiteral = 149, 2337 2338 /** OpenMP 5.0 [2.1.4, Array Shaping]. 2339 */ 2340 CXCursor_OMPArrayShapingExpr = 150, 2341 2342 /** 2343 * OpenMP 5.0 [2.1.6 Iterators] 2344 */ 2345 CXCursor_OMPIteratorExpr = 151, 2346 2347 /** OpenCL's addrspace_cast<> expression. 2348 */ 2349 CXCursor_CXXAddrspaceCastExpr = 152, 2350 2351 /** 2352 * Expression that references a C++20 concept. 2353 */ 2354 CXCursor_ConceptSpecializationExpr = 153, 2355 2356 /** 2357 * Expression that references a C++20 concept. 2358 */ 2359 CXCursor_RequiresExpr = 154, 2360 2361 CXCursor_LastExpr = CXCursor_RequiresExpr, 2362 2363 /* Statements */ 2364 CXCursor_FirstStmt = 200, 2365 /** 2366 * A statement whose specific kind is not exposed via this 2367 * interface. 2368 * 2369 * Unexposed statements have the same operations as any other kind of 2370 * statement; one can extract their location information, spelling, 2371 * children, etc. However, the specific kind of the statement is not 2372 * reported. 2373 */ 2374 CXCursor_UnexposedStmt = 200, 2375 2376 /** A labelled statement in a function. 2377 * 2378 * This cursor kind is used to describe the "start_over:" label statement in 2379 * the following example: 2380 * 2381 * \code 2382 * start_over: 2383 * ++counter; 2384 * \endcode 2385 * 2386 */ 2387 CXCursor_LabelStmt = 201, 2388 2389 /** A group of statements like { stmt stmt }. 2390 * 2391 * This cursor kind is used to describe compound statements, e.g. function 2392 * bodies. 2393 */ 2394 CXCursor_CompoundStmt = 202, 2395 2396 /** A case statement. 2397 */ 2398 CXCursor_CaseStmt = 203, 2399 2400 /** A default statement. 2401 */ 2402 CXCursor_DefaultStmt = 204, 2403 2404 /** An if statement 2405 */ 2406 CXCursor_IfStmt = 205, 2407 2408 /** A switch statement. 2409 */ 2410 CXCursor_SwitchStmt = 206, 2411 2412 /** A while statement. 2413 */ 2414 CXCursor_WhileStmt = 207, 2415 2416 /** A do statement. 2417 */ 2418 CXCursor_DoStmt = 208, 2419 2420 /** A for statement. 2421 */ 2422 CXCursor_ForStmt = 209, 2423 2424 /** A goto statement. 2425 */ 2426 CXCursor_GotoStmt = 210, 2427 2428 /** An indirect goto statement. 2429 */ 2430 CXCursor_IndirectGotoStmt = 211, 2431 2432 /** A continue statement. 2433 */ 2434 CXCursor_ContinueStmt = 212, 2435 2436 /** A break statement. 2437 */ 2438 CXCursor_BreakStmt = 213, 2439 2440 /** A return statement. 2441 */ 2442 CXCursor_ReturnStmt = 214, 2443 2444 /** A GCC inline assembly statement extension. 2445 */ 2446 CXCursor_GCCAsmStmt = 215, 2447 CXCursor_AsmStmt = CXCursor_GCCAsmStmt, 2448 2449 /** Objective-C's overall \@try-\@catch-\@finally statement. 2450 */ 2451 CXCursor_ObjCAtTryStmt = 216, 2452 2453 /** Objective-C's \@catch statement. 2454 */ 2455 CXCursor_ObjCAtCatchStmt = 217, 2456 2457 /** Objective-C's \@finally statement. 2458 */ 2459 CXCursor_ObjCAtFinallyStmt = 218, 2460 2461 /** Objective-C's \@throw statement. 2462 */ 2463 CXCursor_ObjCAtThrowStmt = 219, 2464 2465 /** Objective-C's \@synchronized statement. 2466 */ 2467 CXCursor_ObjCAtSynchronizedStmt = 220, 2468 2469 /** Objective-C's autorelease pool statement. 2470 */ 2471 CXCursor_ObjCAutoreleasePoolStmt = 221, 2472 2473 /** Objective-C's collection statement. 2474 */ 2475 CXCursor_ObjCForCollectionStmt = 222, 2476 2477 /** C++'s catch statement. 2478 */ 2479 CXCursor_CXXCatchStmt = 223, 2480 2481 /** C++'s try statement. 2482 */ 2483 CXCursor_CXXTryStmt = 224, 2484 2485 /** C++'s for (* : *) statement. 2486 */ 2487 CXCursor_CXXForRangeStmt = 225, 2488 2489 /** Windows Structured Exception Handling's try statement. 2490 */ 2491 CXCursor_SEHTryStmt = 226, 2492 2493 /** Windows Structured Exception Handling's except statement. 2494 */ 2495 CXCursor_SEHExceptStmt = 227, 2496 2497 /** Windows Structured Exception Handling's finally statement. 2498 */ 2499 CXCursor_SEHFinallyStmt = 228, 2500 2501 /** A MS inline assembly statement extension. 2502 */ 2503 CXCursor_MSAsmStmt = 229, 2504 2505 /** The null statement ";": C99 6.8.3p3. 2506 * 2507 * This cursor kind is used to describe the null statement. 2508 */ 2509 CXCursor_NullStmt = 230, 2510 2511 /** Adaptor class for mixing declarations with statements and 2512 * expressions. 2513 */ 2514 CXCursor_DeclStmt = 231, 2515 2516 /** OpenMP parallel directive. 2517 */ 2518 CXCursor_OMPParallelDirective = 232, 2519 2520 /** OpenMP SIMD directive. 2521 */ 2522 CXCursor_OMPSimdDirective = 233, 2523 2524 /** OpenMP for directive. 2525 */ 2526 CXCursor_OMPForDirective = 234, 2527 2528 /** OpenMP sections directive. 2529 */ 2530 CXCursor_OMPSectionsDirective = 235, 2531 2532 /** OpenMP section directive. 2533 */ 2534 CXCursor_OMPSectionDirective = 236, 2535 2536 /** OpenMP single directive. 2537 */ 2538 CXCursor_OMPSingleDirective = 237, 2539 2540 /** OpenMP parallel for directive. 2541 */ 2542 CXCursor_OMPParallelForDirective = 238, 2543 2544 /** OpenMP parallel sections directive. 2545 */ 2546 CXCursor_OMPParallelSectionsDirective = 239, 2547 2548 /** OpenMP task directive. 2549 */ 2550 CXCursor_OMPTaskDirective = 240, 2551 2552 /** OpenMP master directive. 2553 */ 2554 CXCursor_OMPMasterDirective = 241, 2555 2556 /** OpenMP critical directive. 2557 */ 2558 CXCursor_OMPCriticalDirective = 242, 2559 2560 /** OpenMP taskyield directive. 2561 */ 2562 CXCursor_OMPTaskyieldDirective = 243, 2563 2564 /** OpenMP barrier directive. 2565 */ 2566 CXCursor_OMPBarrierDirective = 244, 2567 2568 /** OpenMP taskwait directive. 2569 */ 2570 CXCursor_OMPTaskwaitDirective = 245, 2571 2572 /** OpenMP flush directive. 2573 */ 2574 CXCursor_OMPFlushDirective = 246, 2575 2576 /** Windows Structured Exception Handling's leave statement. 2577 */ 2578 CXCursor_SEHLeaveStmt = 247, 2579 2580 /** OpenMP ordered directive. 2581 */ 2582 CXCursor_OMPOrderedDirective = 248, 2583 2584 /** OpenMP atomic directive. 2585 */ 2586 CXCursor_OMPAtomicDirective = 249, 2587 2588 /** OpenMP for SIMD directive. 2589 */ 2590 CXCursor_OMPForSimdDirective = 250, 2591 2592 /** OpenMP parallel for SIMD directive. 2593 */ 2594 CXCursor_OMPParallelForSimdDirective = 251, 2595 2596 /** OpenMP target directive. 2597 */ 2598 CXCursor_OMPTargetDirective = 252, 2599 2600 /** OpenMP teams directive. 2601 */ 2602 CXCursor_OMPTeamsDirective = 253, 2603 2604 /** OpenMP taskgroup directive. 2605 */ 2606 CXCursor_OMPTaskgroupDirective = 254, 2607 2608 /** OpenMP cancellation point directive. 2609 */ 2610 CXCursor_OMPCancellationPointDirective = 255, 2611 2612 /** OpenMP cancel directive. 2613 */ 2614 CXCursor_OMPCancelDirective = 256, 2615 2616 /** OpenMP target data directive. 2617 */ 2618 CXCursor_OMPTargetDataDirective = 257, 2619 2620 /** OpenMP taskloop directive. 2621 */ 2622 CXCursor_OMPTaskLoopDirective = 258, 2623 2624 /** OpenMP taskloop simd directive. 2625 */ 2626 CXCursor_OMPTaskLoopSimdDirective = 259, 2627 2628 /** OpenMP distribute directive. 2629 */ 2630 CXCursor_OMPDistributeDirective = 260, 2631 2632 /** OpenMP target enter data directive. 2633 */ 2634 CXCursor_OMPTargetEnterDataDirective = 261, 2635 2636 /** OpenMP target exit data directive. 2637 */ 2638 CXCursor_OMPTargetExitDataDirective = 262, 2639 2640 /** OpenMP target parallel directive. 2641 */ 2642 CXCursor_OMPTargetParallelDirective = 263, 2643 2644 /** OpenMP target parallel for directive. 2645 */ 2646 CXCursor_OMPTargetParallelForDirective = 264, 2647 2648 /** OpenMP target update directive. 2649 */ 2650 CXCursor_OMPTargetUpdateDirective = 265, 2651 2652 /** OpenMP distribute parallel for directive. 2653 */ 2654 CXCursor_OMPDistributeParallelForDirective = 266, 2655 2656 /** OpenMP distribute parallel for simd directive. 2657 */ 2658 CXCursor_OMPDistributeParallelForSimdDirective = 267, 2659 2660 /** OpenMP distribute simd directive. 2661 */ 2662 CXCursor_OMPDistributeSimdDirective = 268, 2663 2664 /** OpenMP target parallel for simd directive. 2665 */ 2666 CXCursor_OMPTargetParallelForSimdDirective = 269, 2667 2668 /** OpenMP target simd directive. 2669 */ 2670 CXCursor_OMPTargetSimdDirective = 270, 2671 2672 /** OpenMP teams distribute directive. 2673 */ 2674 CXCursor_OMPTeamsDistributeDirective = 271, 2675 2676 /** OpenMP teams distribute simd directive. 2677 */ 2678 CXCursor_OMPTeamsDistributeSimdDirective = 272, 2679 2680 /** OpenMP teams distribute parallel for simd directive. 2681 */ 2682 CXCursor_OMPTeamsDistributeParallelForSimdDirective = 273, 2683 2684 /** OpenMP teams distribute parallel for directive. 2685 */ 2686 CXCursor_OMPTeamsDistributeParallelForDirective = 274, 2687 2688 /** OpenMP target teams directive. 2689 */ 2690 CXCursor_OMPTargetTeamsDirective = 275, 2691 2692 /** OpenMP target teams distribute directive. 2693 */ 2694 CXCursor_OMPTargetTeamsDistributeDirective = 276, 2695 2696 /** OpenMP target teams distribute parallel for directive. 2697 */ 2698 CXCursor_OMPTargetTeamsDistributeParallelForDirective = 277, 2699 2700 /** OpenMP target teams distribute parallel for simd directive. 2701 */ 2702 CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective = 278, 2703 2704 /** OpenMP target teams distribute simd directive. 2705 */ 2706 CXCursor_OMPTargetTeamsDistributeSimdDirective = 279, 2707 2708 /** C++2a std::bit_cast expression. 2709 */ 2710 CXCursor_BuiltinBitCastExpr = 280, 2711 2712 /** OpenMP master taskloop directive. 2713 */ 2714 CXCursor_OMPMasterTaskLoopDirective = 281, 2715 2716 /** OpenMP parallel master taskloop directive. 2717 */ 2718 CXCursor_OMPParallelMasterTaskLoopDirective = 282, 2719 2720 /** OpenMP master taskloop simd directive. 2721 */ 2722 CXCursor_OMPMasterTaskLoopSimdDirective = 283, 2723 2724 /** OpenMP parallel master taskloop simd directive. 2725 */ 2726 CXCursor_OMPParallelMasterTaskLoopSimdDirective = 284, 2727 2728 /** OpenMP parallel master directive. 2729 */ 2730 CXCursor_OMPParallelMasterDirective = 285, 2731 2732 /** OpenMP depobj directive. 2733 */ 2734 CXCursor_OMPDepobjDirective = 286, 2735 2736 /** OpenMP scan directive. 2737 */ 2738 CXCursor_OMPScanDirective = 287, 2739 2740 /** OpenMP tile directive. 2741 */ 2742 CXCursor_OMPTileDirective = 288, 2743 2744 /** OpenMP canonical loop. 2745 */ 2746 CXCursor_OMPCanonicalLoop = 289, 2747 2748 /** OpenMP interop directive. 2749 */ 2750 CXCursor_OMPInteropDirective = 290, 2751 2752 /** OpenMP dispatch directive. 2753 */ 2754 CXCursor_OMPDispatchDirective = 291, 2755 2756 /** OpenMP masked directive. 2757 */ 2758 CXCursor_OMPMaskedDirective = 292, 2759 2760 /** OpenMP unroll directive. 2761 */ 2762 CXCursor_OMPUnrollDirective = 293, 2763 2764 /** OpenMP metadirective directive. 2765 */ 2766 CXCursor_OMPMetaDirective = 294, 2767 2768 /** OpenMP loop directive. 2769 */ 2770 CXCursor_OMPGenericLoopDirective = 295, 2771 2772 /** OpenMP teams loop directive. 2773 */ 2774 CXCursor_OMPTeamsGenericLoopDirective = 296, 2775 2776 /** OpenMP target teams loop directive. 2777 */ 2778 CXCursor_OMPTargetTeamsGenericLoopDirective = 297, 2779 2780 /** OpenMP parallel loop directive. 2781 */ 2782 CXCursor_OMPParallelGenericLoopDirective = 298, 2783 2784 /** OpenMP target parallel loop directive. 2785 */ 2786 CXCursor_OMPTargetParallelGenericLoopDirective = 299, 2787 2788 /** OpenMP parallel masked directive. 2789 */ 2790 CXCursor_OMPParallelMaskedDirective = 300, 2791 2792 /** OpenMP masked taskloop directive. 2793 */ 2794 CXCursor_OMPMaskedTaskLoopDirective = 301, 2795 2796 /** OpenMP masked taskloop simd directive. 2797 */ 2798 CXCursor_OMPMaskedTaskLoopSimdDirective = 302, 2799 2800 /** OpenMP parallel masked taskloop directive. 2801 */ 2802 CXCursor_OMPParallelMaskedTaskLoopDirective = 303, 2803 2804 /** OpenMP parallel masked taskloop simd directive. 2805 */ 2806 CXCursor_OMPParallelMaskedTaskLoopSimdDirective = 304, 2807 2808 CXCursor_LastStmt = CXCursor_OMPParallelMaskedTaskLoopSimdDirective, 2809 2810 /** 2811 * Cursor that represents the translation unit itself. 2812 * 2813 * The translation unit cursor exists primarily to act as the root 2814 * cursor for traversing the contents of a translation unit. 2815 */ 2816 CXCursor_TranslationUnit = 350, 2817 2818 /* Attributes */ 2819 CXCursor_FirstAttr = 400, 2820 /** 2821 * An attribute whose specific kind is not exposed via this 2822 * interface. 2823 */ 2824 CXCursor_UnexposedAttr = 400, 2825 2826 CXCursor_IBActionAttr = 401, 2827 CXCursor_IBOutletAttr = 402, 2828 CXCursor_IBOutletCollectionAttr = 403, 2829 CXCursor_CXXFinalAttr = 404, 2830 CXCursor_CXXOverrideAttr = 405, 2831 CXCursor_AnnotateAttr = 406, 2832 CXCursor_AsmLabelAttr = 407, 2833 CXCursor_PackedAttr = 408, 2834 CXCursor_PureAttr = 409, 2835 CXCursor_ConstAttr = 410, 2836 CXCursor_NoDuplicateAttr = 411, 2837 CXCursor_CUDAConstantAttr = 412, 2838 CXCursor_CUDADeviceAttr = 413, 2839 CXCursor_CUDAGlobalAttr = 414, 2840 CXCursor_CUDAHostAttr = 415, 2841 CXCursor_CUDASharedAttr = 416, 2842 CXCursor_VisibilityAttr = 417, 2843 CXCursor_DLLExport = 418, 2844 CXCursor_DLLImport = 419, 2845 CXCursor_NSReturnsRetained = 420, 2846 CXCursor_NSReturnsNotRetained = 421, 2847 CXCursor_NSReturnsAutoreleased = 422, 2848 CXCursor_NSConsumesSelf = 423, 2849 CXCursor_NSConsumed = 424, 2850 CXCursor_ObjCException = 425, 2851 CXCursor_ObjCNSObject = 426, 2852 CXCursor_ObjCIndependentClass = 427, 2853 CXCursor_ObjCPreciseLifetime = 428, 2854 CXCursor_ObjCReturnsInnerPointer = 429, 2855 CXCursor_ObjCRequiresSuper = 430, 2856 CXCursor_ObjCRootClass = 431, 2857 CXCursor_ObjCSubclassingRestricted = 432, 2858 CXCursor_ObjCExplicitProtocolImpl = 433, 2859 CXCursor_ObjCDesignatedInitializer = 434, 2860 CXCursor_ObjCRuntimeVisible = 435, 2861 CXCursor_ObjCBoxable = 436, 2862 CXCursor_FlagEnum = 437, 2863 CXCursor_ConvergentAttr = 438, 2864 CXCursor_WarnUnusedAttr = 439, 2865 CXCursor_WarnUnusedResultAttr = 440, 2866 CXCursor_AlignedAttr = 441, 2867 CXCursor_LastAttr = CXCursor_AlignedAttr, 2868 2869 /* Preprocessing */ 2870 CXCursor_PreprocessingDirective = 500, 2871 CXCursor_MacroDefinition = 501, 2872 CXCursor_MacroExpansion = 502, 2873 CXCursor_MacroInstantiation = CXCursor_MacroExpansion, 2874 CXCursor_InclusionDirective = 503, 2875 CXCursor_FirstPreprocessing = CXCursor_PreprocessingDirective, 2876 CXCursor_LastPreprocessing = CXCursor_InclusionDirective, 2877 2878 /* Extra Declarations */ 2879 /** 2880 * A module import declaration. 2881 */ 2882 CXCursor_ModuleImportDecl = 600, 2883 CXCursor_TypeAliasTemplateDecl = 601, 2884 /** 2885 * A static_assert or _Static_assert node 2886 */ 2887 CXCursor_StaticAssert = 602, 2888 /** 2889 * a friend declaration. 2890 */ 2891 CXCursor_FriendDecl = 603, 2892 /** 2893 * a concept declaration. 2894 */ 2895 CXCursor_ConceptDecl = 604, 2896 2897 CXCursor_FirstExtraDecl = CXCursor_ModuleImportDecl, 2898 CXCursor_LastExtraDecl = CXCursor_ConceptDecl, 2899 2900 /** 2901 * A code completion overload candidate. 2902 */ 2903 CXCursor_OverloadCandidate = 700 2904 } 2905 2906 alias CXCursor_UnexposedDecl = CXCursorKind.CXCursor_UnexposedDecl; 2907 alias CXCursor_StructDecl = CXCursorKind.CXCursor_StructDecl; 2908 alias CXCursor_UnionDecl = CXCursorKind.CXCursor_UnionDecl; 2909 alias CXCursor_ClassDecl = CXCursorKind.CXCursor_ClassDecl; 2910 alias CXCursor_EnumDecl = CXCursorKind.CXCursor_EnumDecl; 2911 alias CXCursor_FieldDecl = CXCursorKind.CXCursor_FieldDecl; 2912 alias CXCursor_EnumConstantDecl = CXCursorKind.CXCursor_EnumConstantDecl; 2913 alias CXCursor_FunctionDecl = CXCursorKind.CXCursor_FunctionDecl; 2914 alias CXCursor_VarDecl = CXCursorKind.CXCursor_VarDecl; 2915 alias CXCursor_ParmDecl = CXCursorKind.CXCursor_ParmDecl; 2916 alias CXCursor_ObjCInterfaceDecl = CXCursorKind.CXCursor_ObjCInterfaceDecl; 2917 alias CXCursor_ObjCCategoryDecl = CXCursorKind.CXCursor_ObjCCategoryDecl; 2918 alias CXCursor_ObjCProtocolDecl = CXCursorKind.CXCursor_ObjCProtocolDecl; 2919 alias CXCursor_ObjCPropertyDecl = CXCursorKind.CXCursor_ObjCPropertyDecl; 2920 alias CXCursor_ObjCIvarDecl = CXCursorKind.CXCursor_ObjCIvarDecl; 2921 alias CXCursor_ObjCInstanceMethodDecl = CXCursorKind.CXCursor_ObjCInstanceMethodDecl; 2922 alias CXCursor_ObjCClassMethodDecl = CXCursorKind.CXCursor_ObjCClassMethodDecl; 2923 alias CXCursor_ObjCImplementationDecl = CXCursorKind.CXCursor_ObjCImplementationDecl; 2924 alias CXCursor_ObjCCategoryImplDecl = CXCursorKind.CXCursor_ObjCCategoryImplDecl; 2925 alias CXCursor_TypedefDecl = CXCursorKind.CXCursor_TypedefDecl; 2926 alias CXCursor_CXXMethod = CXCursorKind.CXCursor_CXXMethod; 2927 alias CXCursor_Namespace = CXCursorKind.CXCursor_Namespace; 2928 alias CXCursor_LinkageSpec = CXCursorKind.CXCursor_LinkageSpec; 2929 alias CXCursor_Constructor = CXCursorKind.CXCursor_Constructor; 2930 alias CXCursor_Destructor = CXCursorKind.CXCursor_Destructor; 2931 alias CXCursor_ConversionFunction = CXCursorKind.CXCursor_ConversionFunction; 2932 alias CXCursor_TemplateTypeParameter = CXCursorKind.CXCursor_TemplateTypeParameter; 2933 alias CXCursor_NonTypeTemplateParameter = CXCursorKind.CXCursor_NonTypeTemplateParameter; 2934 alias CXCursor_TemplateTemplateParameter = CXCursorKind.CXCursor_TemplateTemplateParameter; 2935 alias CXCursor_FunctionTemplate = CXCursorKind.CXCursor_FunctionTemplate; 2936 alias CXCursor_ClassTemplate = CXCursorKind.CXCursor_ClassTemplate; 2937 alias CXCursor_ClassTemplatePartialSpecialization = CXCursorKind.CXCursor_ClassTemplatePartialSpecialization; 2938 alias CXCursor_NamespaceAlias = CXCursorKind.CXCursor_NamespaceAlias; 2939 alias CXCursor_UsingDirective = CXCursorKind.CXCursor_UsingDirective; 2940 alias CXCursor_UsingDeclaration = CXCursorKind.CXCursor_UsingDeclaration; 2941 alias CXCursor_TypeAliasDecl = CXCursorKind.CXCursor_TypeAliasDecl; 2942 alias CXCursor_ObjCSynthesizeDecl = CXCursorKind.CXCursor_ObjCSynthesizeDecl; 2943 alias CXCursor_ObjCDynamicDecl = CXCursorKind.CXCursor_ObjCDynamicDecl; 2944 alias CXCursor_CXXAccessSpecifier = CXCursorKind.CXCursor_CXXAccessSpecifier; 2945 alias CXCursor_FirstDecl = CXCursorKind.CXCursor_FirstDecl; 2946 alias CXCursor_LastDecl = CXCursorKind.CXCursor_LastDecl; 2947 alias CXCursor_FirstRef = CXCursorKind.CXCursor_FirstRef; 2948 alias CXCursor_ObjCSuperClassRef = CXCursorKind.CXCursor_ObjCSuperClassRef; 2949 alias CXCursor_ObjCProtocolRef = CXCursorKind.CXCursor_ObjCProtocolRef; 2950 alias CXCursor_ObjCClassRef = CXCursorKind.CXCursor_ObjCClassRef; 2951 alias CXCursor_TypeRef = CXCursorKind.CXCursor_TypeRef; 2952 alias CXCursor_CXXBaseSpecifier = CXCursorKind.CXCursor_CXXBaseSpecifier; 2953 alias CXCursor_TemplateRef = CXCursorKind.CXCursor_TemplateRef; 2954 alias CXCursor_NamespaceRef = CXCursorKind.CXCursor_NamespaceRef; 2955 alias CXCursor_MemberRef = CXCursorKind.CXCursor_MemberRef; 2956 alias CXCursor_LabelRef = CXCursorKind.CXCursor_LabelRef; 2957 alias CXCursor_OverloadedDeclRef = CXCursorKind.CXCursor_OverloadedDeclRef; 2958 alias CXCursor_VariableRef = CXCursorKind.CXCursor_VariableRef; 2959 alias CXCursor_LastRef = CXCursorKind.CXCursor_LastRef; 2960 alias CXCursor_FirstInvalid = CXCursorKind.CXCursor_FirstInvalid; 2961 alias CXCursor_InvalidFile = CXCursorKind.CXCursor_InvalidFile; 2962 alias CXCursor_NoDeclFound = CXCursorKind.CXCursor_NoDeclFound; 2963 alias CXCursor_NotImplemented = CXCursorKind.CXCursor_NotImplemented; 2964 alias CXCursor_InvalidCode = CXCursorKind.CXCursor_InvalidCode; 2965 alias CXCursor_LastInvalid = CXCursorKind.CXCursor_LastInvalid; 2966 alias CXCursor_FirstExpr = CXCursorKind.CXCursor_FirstExpr; 2967 alias CXCursor_UnexposedExpr = CXCursorKind.CXCursor_UnexposedExpr; 2968 alias CXCursor_DeclRefExpr = CXCursorKind.CXCursor_DeclRefExpr; 2969 alias CXCursor_MemberRefExpr = CXCursorKind.CXCursor_MemberRefExpr; 2970 alias CXCursor_CallExpr = CXCursorKind.CXCursor_CallExpr; 2971 alias CXCursor_ObjCMessageExpr = CXCursorKind.CXCursor_ObjCMessageExpr; 2972 alias CXCursor_BlockExpr = CXCursorKind.CXCursor_BlockExpr; 2973 alias CXCursor_IntegerLiteral = CXCursorKind.CXCursor_IntegerLiteral; 2974 alias CXCursor_FloatingLiteral = CXCursorKind.CXCursor_FloatingLiteral; 2975 alias CXCursor_ImaginaryLiteral = CXCursorKind.CXCursor_ImaginaryLiteral; 2976 alias CXCursor_StringLiteral = CXCursorKind.CXCursor_StringLiteral; 2977 alias CXCursor_CharacterLiteral = CXCursorKind.CXCursor_CharacterLiteral; 2978 alias CXCursor_ParenExpr = CXCursorKind.CXCursor_ParenExpr; 2979 alias CXCursor_UnaryOperator = CXCursorKind.CXCursor_UnaryOperator; 2980 alias CXCursor_ArraySubscriptExpr = CXCursorKind.CXCursor_ArraySubscriptExpr; 2981 alias CXCursor_BinaryOperator = CXCursorKind.CXCursor_BinaryOperator; 2982 alias CXCursor_CompoundAssignOperator = CXCursorKind.CXCursor_CompoundAssignOperator; 2983 alias CXCursor_ConditionalOperator = CXCursorKind.CXCursor_ConditionalOperator; 2984 alias CXCursor_CStyleCastExpr = CXCursorKind.CXCursor_CStyleCastExpr; 2985 alias CXCursor_CompoundLiteralExpr = CXCursorKind.CXCursor_CompoundLiteralExpr; 2986 alias CXCursor_InitListExpr = CXCursorKind.CXCursor_InitListExpr; 2987 alias CXCursor_AddrLabelExpr = CXCursorKind.CXCursor_AddrLabelExpr; 2988 alias CXCursor_StmtExpr = CXCursorKind.CXCursor_StmtExpr; 2989 alias CXCursor_GenericSelectionExpr = CXCursorKind.CXCursor_GenericSelectionExpr; 2990 alias CXCursor_GNUNullExpr = CXCursorKind.CXCursor_GNUNullExpr; 2991 alias CXCursor_CXXStaticCastExpr = CXCursorKind.CXCursor_CXXStaticCastExpr; 2992 alias CXCursor_CXXDynamicCastExpr = CXCursorKind.CXCursor_CXXDynamicCastExpr; 2993 alias CXCursor_CXXReinterpretCastExpr = CXCursorKind.CXCursor_CXXReinterpretCastExpr; 2994 alias CXCursor_CXXConstCastExpr = CXCursorKind.CXCursor_CXXConstCastExpr; 2995 alias CXCursor_CXXFunctionalCastExpr = CXCursorKind.CXCursor_CXXFunctionalCastExpr; 2996 alias CXCursor_CXXTypeidExpr = CXCursorKind.CXCursor_CXXTypeidExpr; 2997 alias CXCursor_CXXBoolLiteralExpr = CXCursorKind.CXCursor_CXXBoolLiteralExpr; 2998 alias CXCursor_CXXNullPtrLiteralExpr = CXCursorKind.CXCursor_CXXNullPtrLiteralExpr; 2999 alias CXCursor_CXXThisExpr = CXCursorKind.CXCursor_CXXThisExpr; 3000 alias CXCursor_CXXThrowExpr = CXCursorKind.CXCursor_CXXThrowExpr; 3001 alias CXCursor_CXXNewExpr = CXCursorKind.CXCursor_CXXNewExpr; 3002 alias CXCursor_CXXDeleteExpr = CXCursorKind.CXCursor_CXXDeleteExpr; 3003 alias CXCursor_UnaryExpr = CXCursorKind.CXCursor_UnaryExpr; 3004 alias CXCursor_ObjCStringLiteral = CXCursorKind.CXCursor_ObjCStringLiteral; 3005 alias CXCursor_ObjCEncodeExpr = CXCursorKind.CXCursor_ObjCEncodeExpr; 3006 alias CXCursor_ObjCSelectorExpr = CXCursorKind.CXCursor_ObjCSelectorExpr; 3007 alias CXCursor_ObjCProtocolExpr = CXCursorKind.CXCursor_ObjCProtocolExpr; 3008 alias CXCursor_ObjCBridgedCastExpr = CXCursorKind.CXCursor_ObjCBridgedCastExpr; 3009 alias CXCursor_PackExpansionExpr = CXCursorKind.CXCursor_PackExpansionExpr; 3010 alias CXCursor_SizeOfPackExpr = CXCursorKind.CXCursor_SizeOfPackExpr; 3011 alias CXCursor_LambdaExpr = CXCursorKind.CXCursor_LambdaExpr; 3012 alias CXCursor_ObjCBoolLiteralExpr = CXCursorKind.CXCursor_ObjCBoolLiteralExpr; 3013 alias CXCursor_ObjCSelfExpr = CXCursorKind.CXCursor_ObjCSelfExpr; 3014 alias CXCursor_OMPArraySectionExpr = CXCursorKind.CXCursor_OMPArraySectionExpr; 3015 alias CXCursor_ObjCAvailabilityCheckExpr = CXCursorKind.CXCursor_ObjCAvailabilityCheckExpr; 3016 alias CXCursor_FixedPointLiteral = CXCursorKind.CXCursor_FixedPointLiteral; 3017 alias CXCursor_OMPArrayShapingExpr = CXCursorKind.CXCursor_OMPArrayShapingExpr; 3018 alias CXCursor_OMPIteratorExpr = CXCursorKind.CXCursor_OMPIteratorExpr; 3019 alias CXCursor_CXXAddrspaceCastExpr = CXCursorKind.CXCursor_CXXAddrspaceCastExpr; 3020 alias CXCursor_ConceptSpecializationExpr = CXCursorKind.CXCursor_ConceptSpecializationExpr; 3021 alias CXCursor_RequiresExpr = CXCursorKind.CXCursor_RequiresExpr; 3022 alias CXCursor_LastExpr = CXCursorKind.CXCursor_LastExpr; 3023 alias CXCursor_FirstStmt = CXCursorKind.CXCursor_FirstStmt; 3024 alias CXCursor_UnexposedStmt = CXCursorKind.CXCursor_UnexposedStmt; 3025 alias CXCursor_LabelStmt = CXCursorKind.CXCursor_LabelStmt; 3026 alias CXCursor_CompoundStmt = CXCursorKind.CXCursor_CompoundStmt; 3027 alias CXCursor_CaseStmt = CXCursorKind.CXCursor_CaseStmt; 3028 alias CXCursor_DefaultStmt = CXCursorKind.CXCursor_DefaultStmt; 3029 alias CXCursor_IfStmt = CXCursorKind.CXCursor_IfStmt; 3030 alias CXCursor_SwitchStmt = CXCursorKind.CXCursor_SwitchStmt; 3031 alias CXCursor_WhileStmt = CXCursorKind.CXCursor_WhileStmt; 3032 alias CXCursor_DoStmt = CXCursorKind.CXCursor_DoStmt; 3033 alias CXCursor_ForStmt = CXCursorKind.CXCursor_ForStmt; 3034 alias CXCursor_GotoStmt = CXCursorKind.CXCursor_GotoStmt; 3035 alias CXCursor_IndirectGotoStmt = CXCursorKind.CXCursor_IndirectGotoStmt; 3036 alias CXCursor_ContinueStmt = CXCursorKind.CXCursor_ContinueStmt; 3037 alias CXCursor_BreakStmt = CXCursorKind.CXCursor_BreakStmt; 3038 alias CXCursor_ReturnStmt = CXCursorKind.CXCursor_ReturnStmt; 3039 alias CXCursor_GCCAsmStmt = CXCursorKind.CXCursor_GCCAsmStmt; 3040 alias CXCursor_AsmStmt = CXCursorKind.CXCursor_AsmStmt; 3041 alias CXCursor_ObjCAtTryStmt = CXCursorKind.CXCursor_ObjCAtTryStmt; 3042 alias CXCursor_ObjCAtCatchStmt = CXCursorKind.CXCursor_ObjCAtCatchStmt; 3043 alias CXCursor_ObjCAtFinallyStmt = CXCursorKind.CXCursor_ObjCAtFinallyStmt; 3044 alias CXCursor_ObjCAtThrowStmt = CXCursorKind.CXCursor_ObjCAtThrowStmt; 3045 alias CXCursor_ObjCAtSynchronizedStmt = CXCursorKind.CXCursor_ObjCAtSynchronizedStmt; 3046 alias CXCursor_ObjCAutoreleasePoolStmt = CXCursorKind.CXCursor_ObjCAutoreleasePoolStmt; 3047 alias CXCursor_ObjCForCollectionStmt = CXCursorKind.CXCursor_ObjCForCollectionStmt; 3048 alias CXCursor_CXXCatchStmt = CXCursorKind.CXCursor_CXXCatchStmt; 3049 alias CXCursor_CXXTryStmt = CXCursorKind.CXCursor_CXXTryStmt; 3050 alias CXCursor_CXXForRangeStmt = CXCursorKind.CXCursor_CXXForRangeStmt; 3051 alias CXCursor_SEHTryStmt = CXCursorKind.CXCursor_SEHTryStmt; 3052 alias CXCursor_SEHExceptStmt = CXCursorKind.CXCursor_SEHExceptStmt; 3053 alias CXCursor_SEHFinallyStmt = CXCursorKind.CXCursor_SEHFinallyStmt; 3054 alias CXCursor_MSAsmStmt = CXCursorKind.CXCursor_MSAsmStmt; 3055 alias CXCursor_NullStmt = CXCursorKind.CXCursor_NullStmt; 3056 alias CXCursor_DeclStmt = CXCursorKind.CXCursor_DeclStmt; 3057 alias CXCursor_OMPParallelDirective = CXCursorKind.CXCursor_OMPParallelDirective; 3058 alias CXCursor_OMPSimdDirective = CXCursorKind.CXCursor_OMPSimdDirective; 3059 alias CXCursor_OMPForDirective = CXCursorKind.CXCursor_OMPForDirective; 3060 alias CXCursor_OMPSectionsDirective = CXCursorKind.CXCursor_OMPSectionsDirective; 3061 alias CXCursor_OMPSectionDirective = CXCursorKind.CXCursor_OMPSectionDirective; 3062 alias CXCursor_OMPSingleDirective = CXCursorKind.CXCursor_OMPSingleDirective; 3063 alias CXCursor_OMPParallelForDirective = CXCursorKind.CXCursor_OMPParallelForDirective; 3064 alias CXCursor_OMPParallelSectionsDirective = CXCursorKind.CXCursor_OMPParallelSectionsDirective; 3065 alias CXCursor_OMPTaskDirective = CXCursorKind.CXCursor_OMPTaskDirective; 3066 alias CXCursor_OMPMasterDirective = CXCursorKind.CXCursor_OMPMasterDirective; 3067 alias CXCursor_OMPCriticalDirective = CXCursorKind.CXCursor_OMPCriticalDirective; 3068 alias CXCursor_OMPTaskyieldDirective = CXCursorKind.CXCursor_OMPTaskyieldDirective; 3069 alias CXCursor_OMPBarrierDirective = CXCursorKind.CXCursor_OMPBarrierDirective; 3070 alias CXCursor_OMPTaskwaitDirective = CXCursorKind.CXCursor_OMPTaskwaitDirective; 3071 alias CXCursor_OMPFlushDirective = CXCursorKind.CXCursor_OMPFlushDirective; 3072 alias CXCursor_SEHLeaveStmt = CXCursorKind.CXCursor_SEHLeaveStmt; 3073 alias CXCursor_OMPOrderedDirective = CXCursorKind.CXCursor_OMPOrderedDirective; 3074 alias CXCursor_OMPAtomicDirective = CXCursorKind.CXCursor_OMPAtomicDirective; 3075 alias CXCursor_OMPForSimdDirective = CXCursorKind.CXCursor_OMPForSimdDirective; 3076 alias CXCursor_OMPParallelForSimdDirective = CXCursorKind.CXCursor_OMPParallelForSimdDirective; 3077 alias CXCursor_OMPTargetDirective = CXCursorKind.CXCursor_OMPTargetDirective; 3078 alias CXCursor_OMPTeamsDirective = CXCursorKind.CXCursor_OMPTeamsDirective; 3079 alias CXCursor_OMPTaskgroupDirective = CXCursorKind.CXCursor_OMPTaskgroupDirective; 3080 alias CXCursor_OMPCancellationPointDirective = CXCursorKind.CXCursor_OMPCancellationPointDirective; 3081 alias CXCursor_OMPCancelDirective = CXCursorKind.CXCursor_OMPCancelDirective; 3082 alias CXCursor_OMPTargetDataDirective = CXCursorKind.CXCursor_OMPTargetDataDirective; 3083 alias CXCursor_OMPTaskLoopDirective = CXCursorKind.CXCursor_OMPTaskLoopDirective; 3084 alias CXCursor_OMPTaskLoopSimdDirective = CXCursorKind.CXCursor_OMPTaskLoopSimdDirective; 3085 alias CXCursor_OMPDistributeDirective = CXCursorKind.CXCursor_OMPDistributeDirective; 3086 alias CXCursor_OMPTargetEnterDataDirective = CXCursorKind.CXCursor_OMPTargetEnterDataDirective; 3087 alias CXCursor_OMPTargetExitDataDirective = CXCursorKind.CXCursor_OMPTargetExitDataDirective; 3088 alias CXCursor_OMPTargetParallelDirective = CXCursorKind.CXCursor_OMPTargetParallelDirective; 3089 alias CXCursor_OMPTargetParallelForDirective = CXCursorKind.CXCursor_OMPTargetParallelForDirective; 3090 alias CXCursor_OMPTargetUpdateDirective = CXCursorKind.CXCursor_OMPTargetUpdateDirective; 3091 alias CXCursor_OMPDistributeParallelForDirective = CXCursorKind.CXCursor_OMPDistributeParallelForDirective; 3092 alias CXCursor_OMPDistributeParallelForSimdDirective = CXCursorKind.CXCursor_OMPDistributeParallelForSimdDirective; 3093 alias CXCursor_OMPDistributeSimdDirective = CXCursorKind.CXCursor_OMPDistributeSimdDirective; 3094 alias CXCursor_OMPTargetParallelForSimdDirective = CXCursorKind.CXCursor_OMPTargetParallelForSimdDirective; 3095 alias CXCursor_OMPTargetSimdDirective = CXCursorKind.CXCursor_OMPTargetSimdDirective; 3096 alias CXCursor_OMPTeamsDistributeDirective = CXCursorKind.CXCursor_OMPTeamsDistributeDirective; 3097 alias CXCursor_OMPTeamsDistributeSimdDirective = CXCursorKind.CXCursor_OMPTeamsDistributeSimdDirective; 3098 alias CXCursor_OMPTeamsDistributeParallelForSimdDirective = CXCursorKind.CXCursor_OMPTeamsDistributeParallelForSimdDirective; 3099 alias CXCursor_OMPTeamsDistributeParallelForDirective = CXCursorKind.CXCursor_OMPTeamsDistributeParallelForDirective; 3100 alias CXCursor_OMPTargetTeamsDirective = CXCursorKind.CXCursor_OMPTargetTeamsDirective; 3101 alias CXCursor_OMPTargetTeamsDistributeDirective = CXCursorKind.CXCursor_OMPTargetTeamsDistributeDirective; 3102 alias CXCursor_OMPTargetTeamsDistributeParallelForDirective = CXCursorKind.CXCursor_OMPTargetTeamsDistributeParallelForDirective; 3103 alias CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective = CXCursorKind.CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective; 3104 alias CXCursor_OMPTargetTeamsDistributeSimdDirective = CXCursorKind.CXCursor_OMPTargetTeamsDistributeSimdDirective; 3105 alias CXCursor_BuiltinBitCastExpr = CXCursorKind.CXCursor_BuiltinBitCastExpr; 3106 alias CXCursor_OMPMasterTaskLoopDirective = CXCursorKind.CXCursor_OMPMasterTaskLoopDirective; 3107 alias CXCursor_OMPParallelMasterTaskLoopDirective = CXCursorKind.CXCursor_OMPParallelMasterTaskLoopDirective; 3108 alias CXCursor_OMPMasterTaskLoopSimdDirective = CXCursorKind.CXCursor_OMPMasterTaskLoopSimdDirective; 3109 alias CXCursor_OMPParallelMasterTaskLoopSimdDirective = CXCursorKind.CXCursor_OMPParallelMasterTaskLoopSimdDirective; 3110 alias CXCursor_OMPParallelMasterDirective = CXCursorKind.CXCursor_OMPParallelMasterDirective; 3111 alias CXCursor_OMPDepobjDirective = CXCursorKind.CXCursor_OMPDepobjDirective; 3112 alias CXCursor_OMPScanDirective = CXCursorKind.CXCursor_OMPScanDirective; 3113 alias CXCursor_OMPTileDirective = CXCursorKind.CXCursor_OMPTileDirective; 3114 alias CXCursor_OMPCanonicalLoop = CXCursorKind.CXCursor_OMPCanonicalLoop; 3115 alias CXCursor_OMPInteropDirective = CXCursorKind.CXCursor_OMPInteropDirective; 3116 alias CXCursor_OMPDispatchDirective = CXCursorKind.CXCursor_OMPDispatchDirective; 3117 alias CXCursor_OMPMaskedDirective = CXCursorKind.CXCursor_OMPMaskedDirective; 3118 alias CXCursor_OMPUnrollDirective = CXCursorKind.CXCursor_OMPUnrollDirective; 3119 alias CXCursor_OMPMetaDirective = CXCursorKind.CXCursor_OMPMetaDirective; 3120 alias CXCursor_OMPGenericLoopDirective = CXCursorKind.CXCursor_OMPGenericLoopDirective; 3121 alias CXCursor_OMPTeamsGenericLoopDirective = CXCursorKind.CXCursor_OMPTeamsGenericLoopDirective; 3122 alias CXCursor_OMPTargetTeamsGenericLoopDirective = CXCursorKind.CXCursor_OMPTargetTeamsGenericLoopDirective; 3123 alias CXCursor_OMPParallelGenericLoopDirective = CXCursorKind.CXCursor_OMPParallelGenericLoopDirective; 3124 alias CXCursor_OMPTargetParallelGenericLoopDirective = CXCursorKind.CXCursor_OMPTargetParallelGenericLoopDirective; 3125 alias CXCursor_OMPParallelMaskedDirective = CXCursorKind.CXCursor_OMPParallelMaskedDirective; 3126 alias CXCursor_OMPMaskedTaskLoopDirective = CXCursorKind.CXCursor_OMPMaskedTaskLoopDirective; 3127 alias CXCursor_OMPMaskedTaskLoopSimdDirective = CXCursorKind.CXCursor_OMPMaskedTaskLoopSimdDirective; 3128 alias CXCursor_OMPParallelMaskedTaskLoopDirective = CXCursorKind.CXCursor_OMPParallelMaskedTaskLoopDirective; 3129 alias CXCursor_OMPParallelMaskedTaskLoopSimdDirective = CXCursorKind.CXCursor_OMPParallelMaskedTaskLoopSimdDirective; 3130 alias CXCursor_LastStmt = CXCursorKind.CXCursor_LastStmt; 3131 alias CXCursor_TranslationUnit = CXCursorKind.CXCursor_TranslationUnit; 3132 alias CXCursor_FirstAttr = CXCursorKind.CXCursor_FirstAttr; 3133 alias CXCursor_UnexposedAttr = CXCursorKind.CXCursor_UnexposedAttr; 3134 alias CXCursor_IBActionAttr = CXCursorKind.CXCursor_IBActionAttr; 3135 alias CXCursor_IBOutletAttr = CXCursorKind.CXCursor_IBOutletAttr; 3136 alias CXCursor_IBOutletCollectionAttr = CXCursorKind.CXCursor_IBOutletCollectionAttr; 3137 alias CXCursor_CXXFinalAttr = CXCursorKind.CXCursor_CXXFinalAttr; 3138 alias CXCursor_CXXOverrideAttr = CXCursorKind.CXCursor_CXXOverrideAttr; 3139 alias CXCursor_AnnotateAttr = CXCursorKind.CXCursor_AnnotateAttr; 3140 alias CXCursor_AsmLabelAttr = CXCursorKind.CXCursor_AsmLabelAttr; 3141 alias CXCursor_PackedAttr = CXCursorKind.CXCursor_PackedAttr; 3142 alias CXCursor_PureAttr = CXCursorKind.CXCursor_PureAttr; 3143 alias CXCursor_ConstAttr = CXCursorKind.CXCursor_ConstAttr; 3144 alias CXCursor_NoDuplicateAttr = CXCursorKind.CXCursor_NoDuplicateAttr; 3145 alias CXCursor_CUDAConstantAttr = CXCursorKind.CXCursor_CUDAConstantAttr; 3146 alias CXCursor_CUDADeviceAttr = CXCursorKind.CXCursor_CUDADeviceAttr; 3147 alias CXCursor_CUDAGlobalAttr = CXCursorKind.CXCursor_CUDAGlobalAttr; 3148 alias CXCursor_CUDAHostAttr = CXCursorKind.CXCursor_CUDAHostAttr; 3149 alias CXCursor_CUDASharedAttr = CXCursorKind.CXCursor_CUDASharedAttr; 3150 alias CXCursor_VisibilityAttr = CXCursorKind.CXCursor_VisibilityAttr; 3151 alias CXCursor_DLLExport = CXCursorKind.CXCursor_DLLExport; 3152 alias CXCursor_DLLImport = CXCursorKind.CXCursor_DLLImport; 3153 alias CXCursor_NSReturnsRetained = CXCursorKind.CXCursor_NSReturnsRetained; 3154 alias CXCursor_NSReturnsNotRetained = CXCursorKind.CXCursor_NSReturnsNotRetained; 3155 alias CXCursor_NSReturnsAutoreleased = CXCursorKind.CXCursor_NSReturnsAutoreleased; 3156 alias CXCursor_NSConsumesSelf = CXCursorKind.CXCursor_NSConsumesSelf; 3157 alias CXCursor_NSConsumed = CXCursorKind.CXCursor_NSConsumed; 3158 alias CXCursor_ObjCException = CXCursorKind.CXCursor_ObjCException; 3159 alias CXCursor_ObjCNSObject = CXCursorKind.CXCursor_ObjCNSObject; 3160 alias CXCursor_ObjCIndependentClass = CXCursorKind.CXCursor_ObjCIndependentClass; 3161 alias CXCursor_ObjCPreciseLifetime = CXCursorKind.CXCursor_ObjCPreciseLifetime; 3162 alias CXCursor_ObjCReturnsInnerPointer = CXCursorKind.CXCursor_ObjCReturnsInnerPointer; 3163 alias CXCursor_ObjCRequiresSuper = CXCursorKind.CXCursor_ObjCRequiresSuper; 3164 alias CXCursor_ObjCRootClass = CXCursorKind.CXCursor_ObjCRootClass; 3165 alias CXCursor_ObjCSubclassingRestricted = CXCursorKind.CXCursor_ObjCSubclassingRestricted; 3166 alias CXCursor_ObjCExplicitProtocolImpl = CXCursorKind.CXCursor_ObjCExplicitProtocolImpl; 3167 alias CXCursor_ObjCDesignatedInitializer = CXCursorKind.CXCursor_ObjCDesignatedInitializer; 3168 alias CXCursor_ObjCRuntimeVisible = CXCursorKind.CXCursor_ObjCRuntimeVisible; 3169 alias CXCursor_ObjCBoxable = CXCursorKind.CXCursor_ObjCBoxable; 3170 alias CXCursor_FlagEnum = CXCursorKind.CXCursor_FlagEnum; 3171 alias CXCursor_ConvergentAttr = CXCursorKind.CXCursor_ConvergentAttr; 3172 alias CXCursor_WarnUnusedAttr = CXCursorKind.CXCursor_WarnUnusedAttr; 3173 alias CXCursor_WarnUnusedResultAttr = CXCursorKind.CXCursor_WarnUnusedResultAttr; 3174 alias CXCursor_AlignedAttr = CXCursorKind.CXCursor_AlignedAttr; 3175 alias CXCursor_LastAttr = CXCursorKind.CXCursor_LastAttr; 3176 alias CXCursor_PreprocessingDirective = CXCursorKind.CXCursor_PreprocessingDirective; 3177 alias CXCursor_MacroDefinition = CXCursorKind.CXCursor_MacroDefinition; 3178 alias CXCursor_MacroExpansion = CXCursorKind.CXCursor_MacroExpansion; 3179 alias CXCursor_MacroInstantiation = CXCursorKind.CXCursor_MacroInstantiation; 3180 alias CXCursor_InclusionDirective = CXCursorKind.CXCursor_InclusionDirective; 3181 alias CXCursor_FirstPreprocessing = CXCursorKind.CXCursor_FirstPreprocessing; 3182 alias CXCursor_LastPreprocessing = CXCursorKind.CXCursor_LastPreprocessing; 3183 alias CXCursor_ModuleImportDecl = CXCursorKind.CXCursor_ModuleImportDecl; 3184 alias CXCursor_TypeAliasTemplateDecl = CXCursorKind.CXCursor_TypeAliasTemplateDecl; 3185 alias CXCursor_StaticAssert = CXCursorKind.CXCursor_StaticAssert; 3186 alias CXCursor_FriendDecl = CXCursorKind.CXCursor_FriendDecl; 3187 alias CXCursor_ConceptDecl = CXCursorKind.CXCursor_ConceptDecl; 3188 alias CXCursor_FirstExtraDecl = CXCursorKind.CXCursor_FirstExtraDecl; 3189 alias CXCursor_LastExtraDecl = CXCursorKind.CXCursor_LastExtraDecl; 3190 alias CXCursor_OverloadCandidate = CXCursorKind.CXCursor_OverloadCandidate; 3191 3192 /** 3193 * A cursor representing some element in the abstract syntax tree for 3194 * a translation unit. 3195 * 3196 * The cursor abstraction unifies the different kinds of entities in a 3197 * program--declaration, statements, expressions, references to declarations, 3198 * etc.--under a single "cursor" abstraction with a common set of operations. 3199 * Common operation for a cursor include: getting the physical location in 3200 * a source file where the cursor points, getting the name associated with a 3201 * cursor, and retrieving cursors for any child nodes of a particular cursor. 3202 * 3203 * Cursors can be produced in two specific ways. 3204 * clang_getTranslationUnitCursor() produces a cursor for a translation unit, 3205 * from which one can use clang_visitChildren() to explore the rest of the 3206 * translation unit. clang_getCursor() maps from a physical source location 3207 * to the entity that resides at that location, allowing one to map from the 3208 * source code into the AST. 3209 */ 3210 struct CXCursor 3211 { 3212 CXCursorKind kind; 3213 int xdata; 3214 const(void)*[3] data; 3215 } 3216 3217 /** 3218 * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations 3219 * 3220 * @{ 3221 */ 3222 3223 /** 3224 * Retrieve the NULL cursor, which represents no entity. 3225 */ 3226 CXCursor clang_getNullCursor (); 3227 3228 /** 3229 * Retrieve the cursor that represents the given translation unit. 3230 * 3231 * The translation unit cursor can be used to start traversing the 3232 * various declarations within the given translation unit. 3233 */ 3234 CXCursor clang_getTranslationUnitCursor (const CXTranslationUnit); 3235 3236 /** 3237 * Determine whether two cursors are equivalent. 3238 */ 3239 uint clang_equalCursors (const CXCursor, CXCursor) pure; 3240 3241 /** 3242 * Returns non-zero if \p cursor is null. 3243 */ 3244 int clang_Cursor_isNull (const CXCursor cursor) pure; 3245 3246 /** 3247 * Compute a hash value for the given cursor. 3248 */ 3249 uint clang_hashCursor (const CXCursor) pure; 3250 3251 /** 3252 * Retrieve the kind of the given cursor. 3253 */ 3254 CXCursorKind clang_getCursorKind (const CXCursor) pure; 3255 3256 /** 3257 * Determine whether the given cursor kind represents a declaration. 3258 */ 3259 uint clang_isDeclaration (const CXCursorKind); 3260 3261 /** 3262 * Determine whether the given declaration is invalid. 3263 * 3264 * A declaration is invalid if it could not be parsed successfully. 3265 * 3266 * \returns non-zero if the cursor represents a declaration and it is 3267 * invalid, otherwise NULL. 3268 */ 3269 uint clang_isInvalidDeclaration (const CXCursor); 3270 3271 /** 3272 * Determine whether the given cursor kind represents a simple 3273 * reference. 3274 * 3275 * Note that other kinds of cursors (such as expressions) can also refer to 3276 * other cursors. Use clang_getCursorReferenced() to determine whether a 3277 * particular cursor refers to another entity. 3278 */ 3279 uint clang_isReference (const CXCursorKind); 3280 3281 /** 3282 * Determine whether the given cursor kind represents an expression. 3283 */ 3284 uint clang_isExpression (const CXCursorKind); 3285 3286 /** 3287 * Determine whether the given cursor kind represents a statement. 3288 */ 3289 uint clang_isStatement (const CXCursorKind); 3290 3291 /** 3292 * Determine whether the given cursor kind represents an attribute. 3293 */ 3294 uint clang_isAttribute (const CXCursorKind); 3295 3296 /** 3297 * Determine whether the given cursor has any attributes. 3298 */ 3299 uint clang_Cursor_hasAttrs (const CXCursor C); 3300 3301 /** 3302 * Determine whether the given cursor kind represents an invalid 3303 * cursor. 3304 */ 3305 uint clang_isInvalid (const CXCursorKind) pure; 3306 3307 /** 3308 * Determine whether the given cursor kind represents a translation 3309 * unit. 3310 */ 3311 uint clang_isTranslationUnit (const CXCursorKind); 3312 3313 /*** 3314 * Determine whether the given cursor represents a preprocessing 3315 * element, such as a preprocessor directive or macro instantiation. 3316 */ 3317 uint clang_isPreprocessing (const CXCursorKind); 3318 3319 /*** 3320 * Determine whether the given cursor represents a currently 3321 * unexposed piece of the AST (e.g., CXCursor_UnexposedStmt). 3322 */ 3323 uint clang_isUnexposed (const CXCursorKind); 3324 3325 /** 3326 * Describe the linkage of the entity referred to by a cursor. 3327 */ 3328 enum CXLinkageKind 3329 { 3330 /** This value indicates that no linkage information is available 3331 * for a provided CXCursor. */ 3332 CXLinkage_Invalid = 0, 3333 /** 3334 * This is the linkage for variables, parameters, and so on that 3335 * have automatic storage. This covers normal (non-extern) local variables. 3336 */ 3337 CXLinkage_NoLinkage = 1, 3338 /** This is the linkage for static variables and static functions. */ 3339 CXLinkage_Internal = 2, 3340 /** This is the linkage for entities with external linkage that live 3341 * in C++ anonymous namespaces.*/ 3342 CXLinkage_UniqueExternal = 3, 3343 /** This is the linkage for entities with true, external linkage. */ 3344 CXLinkage_External = 4 3345 } 3346 3347 alias CXLinkage_Invalid = CXLinkageKind.CXLinkage_Invalid; 3348 alias CXLinkage_NoLinkage = CXLinkageKind.CXLinkage_NoLinkage; 3349 alias CXLinkage_Internal = CXLinkageKind.CXLinkage_Internal; 3350 alias CXLinkage_UniqueExternal = CXLinkageKind.CXLinkage_UniqueExternal; 3351 alias CXLinkage_External = CXLinkageKind.CXLinkage_External; 3352 3353 /** 3354 * Determine the linkage of the entity referred to by a given cursor. 3355 */ 3356 CXLinkageKind clang_getCursorLinkage (const CXCursor cursor) pure; 3357 3358 enum CXVisibilityKind 3359 { 3360 /** This value indicates that no visibility information is available 3361 * for a provided CXCursor. */ 3362 CXVisibility_Invalid = 0, 3363 3364 /** Symbol not seen by the linker. */ 3365 CXVisibility_Hidden = 1, 3366 /** Symbol seen by the linker but resolves to a symbol inside this object. */ 3367 CXVisibility_Protected = 2, 3368 /** Symbol seen by the linker and acts like a normal symbol. */ 3369 CXVisibility_Default = 3 3370 } 3371 3372 alias CXVisibility_Invalid = CXVisibilityKind.CXVisibility_Invalid; 3373 alias CXVisibility_Hidden = CXVisibilityKind.CXVisibility_Hidden; 3374 alias CXVisibility_Protected = CXVisibilityKind.CXVisibility_Protected; 3375 alias CXVisibility_Default = CXVisibilityKind.CXVisibility_Default; 3376 3377 /** 3378 * Describe the visibility of the entity referred to by a cursor. 3379 * 3380 * This returns the default visibility if not explicitly specified by 3381 * a visibility attribute. The default visibility may be changed by 3382 * commandline arguments. 3383 * 3384 * \param cursor The cursor to query. 3385 * 3386 * \returns The visibility of the cursor. 3387 */ 3388 CXVisibilityKind clang_getCursorVisibility (const CXCursor cursor); 3389 3390 /** 3391 * Determine the availability of the entity that this cursor refers to, 3392 * taking the current target platform into account. 3393 * 3394 * \param cursor The cursor to query. 3395 * 3396 * \returns The availability of the cursor. 3397 */ 3398 CXAvailabilityKind clang_getCursorAvailability (const CXCursor cursor); 3399 3400 /** 3401 * Describes the availability of a given entity on a particular platform, e.g., 3402 * a particular class might only be available on Mac OS 10.7 or newer. 3403 */ 3404 struct CXPlatformAvailability 3405 { 3406 /** 3407 * A string that describes the platform for which this structure 3408 * provides availability information. 3409 * 3410 * Possible values are "ios" or "macos". 3411 */ 3412 //alias CXString = _Anonymous_0; ??? 3413 CXString Platform; 3414 /** 3415 * The version number in which this entity was introduced. 3416 */ 3417 CXVersion Introduced; 3418 /** 3419 * The version number in which this entity was deprecated (but is 3420 * still available). 3421 */ 3422 CXVersion Deprecated; 3423 /** 3424 * The version number in which this entity was obsoleted, and therefore 3425 * is no longer available. 3426 */ 3427 CXVersion Obsoleted; 3428 /** 3429 * Whether the entity is unconditionally unavailable on this platform. 3430 */ 3431 int Unavailable; 3432 /** 3433 * An optional message to provide to a user of this API, e.g., to 3434 * suggest replacement APIs. 3435 */ 3436 CXString Message; 3437 } 3438 3439 /** 3440 * Determine the availability of the entity that this cursor refers to 3441 * on any platforms for which availability information is known. 3442 * 3443 * \param cursor The cursor to query. 3444 * 3445 * \param always_deprecated If non-NULL, will be set to indicate whether the 3446 * entity is deprecated on all platforms. 3447 * 3448 * \param deprecated_message If non-NULL, will be set to the message text 3449 * provided along with the unconditional deprecation of this entity. The client 3450 * is responsible for deallocating this string. 3451 * 3452 * \param always_unavailable If non-NULL, will be set to indicate whether the 3453 * entity is unavailable on all platforms. 3454 * 3455 * \param unavailable_message If non-NULL, will be set to the message text 3456 * provided along with the unconditional unavailability of this entity. The 3457 * client is responsible for deallocating this string. 3458 * 3459 * \param availability If non-NULL, an array of CXPlatformAvailability instances 3460 * that will be populated with platform availability information, up to either 3461 * the number of platforms for which availability information is available (as 3462 * returned by this function) or \c availability_size, whichever is smaller. 3463 * 3464 * \param availability_size The number of elements available in the 3465 * \c availability array. 3466 * 3467 * \returns The number of platforms (N) for which availability information is 3468 * available (which is unrelated to \c availability_size). 3469 * 3470 * Note that the client is responsible for calling 3471 * \c clang_disposeCXPlatformAvailability to free each of the 3472 * platform-availability structures returned. There are 3473 * \c min(N, availability_size) such structures. 3474 */ 3475 int clang_getCursorPlatformAvailability ( 3476 CXCursor cursor, 3477 int* always_deprecated, 3478 CXString* deprecated_message, 3479 int* always_unavailable, 3480 CXString* unavailable_message, 3481 CXPlatformAvailability* availability, 3482 int availability_size); 3483 3484 /** 3485 * Free the memory associated with a \c CXPlatformAvailability structure. 3486 */ 3487 void clang_disposeCXPlatformAvailability (const CXPlatformAvailability* availability); 3488 3489 /** 3490 * If cursor refers to a variable declaration and it has initializer returns 3491 * cursor referring to the initializer otherwise return null cursor. 3492 */ 3493 CXCursor clang_Cursor_getVarDeclInitializer (const CXCursor cursor); 3494 3495 /** 3496 * If cursor refers to a variable declaration that has global storage returns 1. 3497 * If cursor refers to a variable declaration that doesn't have global storage 3498 * returns 0. Otherwise returns -1. 3499 */ 3500 int clang_Cursor_hasVarDeclGlobalStorage (const CXCursor cursor); 3501 3502 /** 3503 * If cursor refers to a variable declaration that has external storage 3504 * returns 1. If cursor refers to a variable declaration that doesn't have 3505 * external storage returns 0. Otherwise returns -1. 3506 */ 3507 int clang_Cursor_hasVarDeclExternalStorage (const CXCursor cursor); 3508 3509 /** 3510 * Describe the "language" of the entity referred to by a cursor. 3511 */ 3512 enum CXLanguageKind 3513 { 3514 CXLanguage_Invalid = 0, 3515 CXLanguage_C = 1, 3516 CXLanguage_ObjC = 2, 3517 CXLanguage_CPlusPlus = 3 3518 } 3519 3520 alias CXLanguage_Invalid = CXLanguageKind.CXLanguage_Invalid; 3521 alias CXLanguage_C = CXLanguageKind.CXLanguage_C; 3522 alias CXLanguage_ObjC = CXLanguageKind.CXLanguage_ObjC; 3523 alias CXLanguage_CPlusPlus = CXLanguageKind.CXLanguage_CPlusPlus; 3524 3525 /** 3526 * Determine the "language" of the entity referred to by a given cursor. 3527 */ 3528 CXLanguageKind clang_getCursorLanguage (const CXCursor cursor) pure; 3529 3530 /** 3531 * Describe the "thread-local storage (TLS) kind" of the declaration 3532 * referred to by a cursor. 3533 */ 3534 enum CXTLSKind 3535 { 3536 CXTLS_None = 0, 3537 CXTLS_Dynamic = 1, 3538 CXTLS_Static = 2 3539 } 3540 3541 alias CXTLS_None = CXTLSKind.CXTLS_None; 3542 alias CXTLS_Dynamic = CXTLSKind.CXTLS_Dynamic; 3543 alias CXTLS_Static = CXTLSKind.CXTLS_Static; 3544 3545 /** 3546 * Determine the "thread-local storage (TLS) kind" of the declaration 3547 * referred to by a cursor. 3548 */ 3549 CXTLSKind clang_getCursorTLSKind (const CXCursor cursor); 3550 3551 /** 3552 * Returns the translation unit that a cursor originated from. 3553 */ 3554 CXTranslationUnit clang_Cursor_getTranslationUnit (const CXCursor) pure; 3555 3556 /** 3557 * A fast container representing a set of CXCursors. 3558 */ 3559 struct CXCursorSetImpl; 3560 alias CXCursorSet = CXCursorSetImpl*; 3561 3562 /** 3563 * Creates an empty CXCursorSet. 3564 */ 3565 CXCursorSet clang_createCXCursorSet (); 3566 3567 /** 3568 * Disposes a CXCursorSet and releases its associated memory. 3569 */ 3570 void clang_disposeCXCursorSet (const CXCursorSet cset); 3571 3572 /** 3573 * Queries a CXCursorSet to see if it contains a specific CXCursor. 3574 * 3575 * \returns non-zero if the set contains the specified cursor. 3576 */ 3577 uint clang_CXCursorSet_contains (const CXCursorSet cset, CXCursor cursor); 3578 3579 /** 3580 * Inserts a CXCursor into a CXCursorSet. 3581 * 3582 * \returns zero if the CXCursor was already in the set, and non-zero otherwise. 3583 */ 3584 uint clang_CXCursorSet_insert (const CXCursorSet cset, CXCursor cursor); 3585 3586 /** 3587 * Determine the semantic parent of the given cursor. 3588 * 3589 * The semantic parent of a cursor is the cursor that semantically contains 3590 * the given \p cursor. For many declarations, the lexical and semantic parents 3591 * are equivalent (the lexical parent is returned by 3592 * \c clang_getCursorLexicalParent()). They diverge when declarations or 3593 * definitions are provided out-of-line. For example: 3594 * 3595 * \code 3596 * class C { 3597 * void f(); 3598 * }; 3599 * 3600 * void C::f() { } 3601 * \endcode 3602 * 3603 * In the out-of-line definition of \c C::f, the semantic parent is 3604 * the class \c C, of which this function is a member. The lexical parent is 3605 * the place where the declaration actually occurs in the source code; in this 3606 * case, the definition occurs in the translation unit. In general, the 3607 * lexical parent for a given entity can change without affecting the semantics 3608 * of the program, and the lexical parent of different declarations of the 3609 * same entity may be different. Changing the semantic parent of a declaration, 3610 * on the other hand, can have a major impact on semantics, and redeclarations 3611 * of a particular entity should all have the same semantic context. 3612 * 3613 * In the example above, both declarations of \c C::f have \c C as their 3614 * semantic context, while the lexical context of the first \c C::f is \c C 3615 * and the lexical context of the second \c C::f is the translation unit. 3616 * 3617 * For global declarations, the semantic parent is the translation unit. 3618 */ 3619 CXCursor clang_getCursorSemanticParent (const CXCursor cursor); 3620 3621 /** 3622 * Determine the lexical parent of the given cursor. 3623 * 3624 * The lexical parent of a cursor is the cursor in which the given \p cursor 3625 * was actually written. For many declarations, the lexical and semantic parents 3626 * are equivalent (the semantic parent is returned by 3627 * \c clang_getCursorSemanticParent()). They diverge when declarations or 3628 * definitions are provided out-of-line. For example: 3629 * 3630 * \code 3631 * class C { 3632 * void f(); 3633 * }; 3634 * 3635 * void C::f() { } 3636 * \endcode 3637 * 3638 * In the out-of-line definition of \c C::f, the semantic parent is 3639 * the class \c C, of which this function is a member. The lexical parent is 3640 * the place where the declaration actually occurs in the source code; in this 3641 * case, the definition occurs in the translation unit. In general, the 3642 * lexical parent for a given entity can change without affecting the semantics 3643 * of the program, and the lexical parent of different declarations of the 3644 * same entity may be different. Changing the semantic parent of a declaration, 3645 * on the other hand, can have a major impact on semantics, and redeclarations 3646 * of a particular entity should all have the same semantic context. 3647 * 3648 * In the example above, both declarations of \c C::f have \c C as their 3649 * semantic context, while the lexical context of the first \c C::f is \c C 3650 * and the lexical context of the second \c C::f is the translation unit. 3651 * 3652 * For declarations written in the global scope, the lexical parent is 3653 * the translation unit. 3654 */ 3655 CXCursor clang_getCursorLexicalParent (const CXCursor cursor); 3656 3657 /** 3658 * Determine the set of methods that are overridden by the given 3659 * method. 3660 * 3661 * In both Objective-C and C++, a method (aka virtual member function, 3662 * in C++) can override a virtual method in a base class. For 3663 * Objective-C, a method is said to override any method in the class's 3664 * base class, its protocols, or its categories' protocols, that has the same 3665 * selector and is of the same kind (class or instance). 3666 * If no such method exists, the search continues to the class's superclass, 3667 * its protocols, and its categories, and so on. A method from an Objective-C 3668 * implementation is considered to override the same methods as its 3669 * corresponding method in the interface. 3670 * 3671 * For C++, a virtual member function overrides any virtual member 3672 * function with the same signature that occurs in its base 3673 * classes. With multiple inheritance, a virtual member function can 3674 * override several virtual member functions coming from different 3675 * base classes. 3676 * 3677 * In all cases, this function determines the immediate overridden 3678 * method, rather than all of the overridden methods. For example, if 3679 * a method is originally declared in a class A, then overridden in B 3680 * (which in inherits from A) and also in C (which inherited from B), 3681 * then the only overridden method returned from this function when 3682 * invoked on C's method will be B's method. The client may then 3683 * invoke this function again, given the previously-found overridden 3684 * methods, to map out the complete method-override set. 3685 * 3686 * \param cursor A cursor representing an Objective-C or C++ 3687 * method. This routine will compute the set of methods that this 3688 * method overrides. 3689 * 3690 * \param overridden A pointer whose pointee will be replaced with a 3691 * pointer to an array of cursors, representing the set of overridden 3692 * methods. If there are no overridden methods, the pointee will be 3693 * set to NULL. The pointee must be freed via a call to 3694 * \c clang_disposeOverriddenCursors(). 3695 * 3696 * \param num_overridden A pointer to the number of overridden 3697 * functions, will be set to the number of overridden functions in the 3698 * array pointed to by \p overridden. 3699 */ 3700 void clang_getOverriddenCursors ( 3701 CXCursor cursor, 3702 CXCursor** overridden, 3703 uint* num_overridden); 3704 3705 /** 3706 * Free the set of overridden cursors returned by \c 3707 * clang_getOverriddenCursors(). 3708 */ 3709 void clang_disposeOverriddenCursors (const CXCursor* overridden); 3710 3711 /** 3712 * Retrieve the file that is included by the given inclusion directive 3713 * cursor. 3714 */ 3715 CXFile clang_getIncludedFile (const CXCursor cursor); 3716 3717 /** 3718 * @} 3719 */ 3720 3721 /** 3722 * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code 3723 * 3724 * Cursors represent a location within the Abstract Syntax Tree (AST). These 3725 * routines help map between cursors and the physical locations where the 3726 * described entities occur in the source code. The mapping is provided in 3727 * both directions, so one can map from source code to the AST and back. 3728 * 3729 * @{ 3730 */ 3731 3732 /** 3733 * Map a source location to the cursor that describes the entity at that 3734 * location in the source code. 3735 * 3736 * clang_getCursor() maps an arbitrary source location within a translation 3737 * unit down to the most specific cursor that describes the entity at that 3738 * location. For example, given an expression \c x + y, invoking 3739 * clang_getCursor() with a source location pointing to "x" will return the 3740 * cursor for "x"; similarly for "y". If the cursor points anywhere between 3741 * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor() 3742 * will return a cursor referring to the "+" expression. 3743 * 3744 * \returns a cursor representing the entity at the given source location, or 3745 * a NULL cursor if no such entity can be found. 3746 */ 3747 CXCursor clang_getCursor (const CXTranslationUnit, CXSourceLocation); 3748 3749 /** 3750 * Retrieve the physical location of the source constructor referenced 3751 * by the given cursor. 3752 * 3753 * The location of a declaration is typically the location of the name of that 3754 * declaration, where the name of that declaration would occur if it is 3755 * unnamed, or some keyword that introduces that particular declaration. 3756 * The location of a reference is where that reference occurs within the 3757 * source code. 3758 */ 3759 CXSourceLocation clang_getCursorLocation (const CXCursor); 3760 3761 /** 3762 * Retrieve the physical extent of the source construct referenced by 3763 * the given cursor. 3764 * 3765 * The extent of a cursor starts with the file/line/column pointing at the 3766 * first character within the source construct that the cursor refers to and 3767 * ends with the last character within that source construct. For a 3768 * declaration, the extent covers the declaration itself. For a reference, 3769 * the extent covers the location of the reference (e.g., where the referenced 3770 * entity was actually used). 3771 */ 3772 CXSourceRange clang_getCursorExtent (const CXCursor) pure; 3773 3774 /** 3775 * @} 3776 */ 3777 3778 /** 3779 * \defgroup CINDEX_TYPES Type information for CXCursors 3780 * 3781 * @{ 3782 */ 3783 3784 /** 3785 * Describes the kind of type 3786 */ 3787 enum CXTypeKind 3788 { 3789 /** 3790 * Represents an invalid type (e.g., where no type is available). 3791 */ 3792 CXType_Invalid = 0, 3793 3794 /** 3795 * A type whose specific kind is not exposed via this 3796 * interface. 3797 */ 3798 CXType_Unexposed = 1, 3799 3800 /* Builtin types */ 3801 CXType_Void = 2, 3802 CXType_Bool = 3, 3803 CXType_Char_U = 4, 3804 CXType_UChar = 5, 3805 CXType_Char16 = 6, 3806 CXType_Char32 = 7, 3807 CXType_UShort = 8, 3808 CXType_UInt = 9, 3809 CXType_ULong = 10, 3810 CXType_ULongLong = 11, 3811 CXType_UInt128 = 12, 3812 CXType_Char_S = 13, 3813 CXType_SChar = 14, 3814 CXType_WChar = 15, 3815 CXType_Short = 16, 3816 CXType_Int = 17, 3817 CXType_Long = 18, 3818 CXType_LongLong = 19, 3819 CXType_Int128 = 20, 3820 CXType_Float = 21, 3821 CXType_Double = 22, 3822 CXType_LongDouble = 23, 3823 CXType_NullPtr = 24, 3824 CXType_Overload = 25, 3825 CXType_Dependent = 26, 3826 CXType_ObjCId = 27, 3827 CXType_ObjCClass = 28, 3828 CXType_ObjCSel = 29, 3829 CXType_Float128 = 30, 3830 CXType_Half = 31, 3831 CXType_Float16 = 32, 3832 CXType_ShortAccum = 33, 3833 CXType_Accum = 34, 3834 CXType_LongAccum = 35, 3835 CXType_UShortAccum = 36, 3836 CXType_UAccum = 37, 3837 CXType_ULongAccum = 38, 3838 CXType_BFloat16 = 39, 3839 CXType_Ibm128 = 40, 3840 CXType_FirstBuiltin = CXType_Void, 3841 CXType_LastBuiltin = CXType_Ibm128, 3842 3843 CXType_Complex = 100, 3844 CXType_Pointer = 101, 3845 CXType_BlockPointer = 102, 3846 CXType_LValueReference = 103, 3847 CXType_RValueReference = 104, 3848 CXType_Record = 105, 3849 CXType_Enum = 106, 3850 CXType_Typedef = 107, 3851 CXType_ObjCInterface = 108, 3852 CXType_ObjCObjectPointer = 109, 3853 CXType_FunctionNoProto = 110, 3854 CXType_FunctionProto = 111, 3855 CXType_ConstantArray = 112, 3856 CXType_Vector = 113, 3857 CXType_IncompleteArray = 114, 3858 CXType_VariableArray = 115, 3859 CXType_DependentSizedArray = 116, 3860 CXType_MemberPointer = 117, 3861 CXType_Auto = 118, 3862 3863 /** 3864 * Represents a type that was referred to using an elaborated type keyword. 3865 * 3866 * E.g., struct S, or via a qualified name, e.g., N::M::type, or both. 3867 */ 3868 CXType_Elaborated = 119, 3869 3870 /* OpenCL PipeType. */ 3871 CXType_Pipe = 120, 3872 3873 /* OpenCL builtin types. */ 3874 CXType_OCLImage1dRO = 121, 3875 CXType_OCLImage1dArrayRO = 122, 3876 CXType_OCLImage1dBufferRO = 123, 3877 CXType_OCLImage2dRO = 124, 3878 CXType_OCLImage2dArrayRO = 125, 3879 CXType_OCLImage2dDepthRO = 126, 3880 CXType_OCLImage2dArrayDepthRO = 127, 3881 CXType_OCLImage2dMSAARO = 128, 3882 CXType_OCLImage2dArrayMSAARO = 129, 3883 CXType_OCLImage2dMSAADepthRO = 130, 3884 CXType_OCLImage2dArrayMSAADepthRO = 131, 3885 CXType_OCLImage3dRO = 132, 3886 CXType_OCLImage1dWO = 133, 3887 CXType_OCLImage1dArrayWO = 134, 3888 CXType_OCLImage1dBufferWO = 135, 3889 CXType_OCLImage2dWO = 136, 3890 CXType_OCLImage2dArrayWO = 137, 3891 CXType_OCLImage2dDepthWO = 138, 3892 CXType_OCLImage2dArrayDepthWO = 139, 3893 CXType_OCLImage2dMSAAWO = 140, 3894 CXType_OCLImage2dArrayMSAAWO = 141, 3895 CXType_OCLImage2dMSAADepthWO = 142, 3896 CXType_OCLImage2dArrayMSAADepthWO = 143, 3897 CXType_OCLImage3dWO = 144, 3898 CXType_OCLImage1dRW = 145, 3899 CXType_OCLImage1dArrayRW = 146, 3900 CXType_OCLImage1dBufferRW = 147, 3901 CXType_OCLImage2dRW = 148, 3902 CXType_OCLImage2dArrayRW = 149, 3903 CXType_OCLImage2dDepthRW = 150, 3904 CXType_OCLImage2dArrayDepthRW = 151, 3905 CXType_OCLImage2dMSAARW = 152, 3906 CXType_OCLImage2dArrayMSAARW = 153, 3907 CXType_OCLImage2dMSAADepthRW = 154, 3908 CXType_OCLImage2dArrayMSAADepthRW = 155, 3909 CXType_OCLImage3dRW = 156, 3910 CXType_OCLSampler = 157, 3911 CXType_OCLEvent = 158, 3912 CXType_OCLQueue = 159, 3913 CXType_OCLReserveID = 160, 3914 3915 CXType_ObjCObject = 161, 3916 CXType_ObjCTypeParam = 162, 3917 CXType_Attributed = 163, 3918 3919 CXType_OCLIntelSubgroupAVCMcePayload = 164, 3920 CXType_OCLIntelSubgroupAVCImePayload = 165, 3921 CXType_OCLIntelSubgroupAVCRefPayload = 166, 3922 CXType_OCLIntelSubgroupAVCSicPayload = 167, 3923 CXType_OCLIntelSubgroupAVCMceResult = 168, 3924 CXType_OCLIntelSubgroupAVCImeResult = 169, 3925 CXType_OCLIntelSubgroupAVCRefResult = 170, 3926 CXType_OCLIntelSubgroupAVCSicResult = 171, 3927 CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout = 172, 3928 CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout = 173, 3929 CXType_OCLIntelSubgroupAVCImeSingleRefStreamin = 174, 3930 3931 CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175, 3932 3933 CXType_ExtVector = 176, 3934 CXType_Atomic = 177, 3935 CXType_BTFTagAttributed = 178 3936 } 3937 3938 alias CXType_Invalid = CXTypeKind.CXType_Invalid; 3939 alias CXType_Unexposed = CXTypeKind.CXType_Unexposed; 3940 alias CXType_Void = CXTypeKind.CXType_Void; 3941 alias CXType_Bool = CXTypeKind.CXType_Bool; 3942 alias CXType_Char_U = CXTypeKind.CXType_Char_U; 3943 alias CXType_UChar = CXTypeKind.CXType_UChar; 3944 alias CXType_Char16 = CXTypeKind.CXType_Char16; 3945 alias CXType_Char32 = CXTypeKind.CXType_Char32; 3946 alias CXType_UShort = CXTypeKind.CXType_UShort; 3947 alias CXType_UInt = CXTypeKind.CXType_UInt; 3948 alias CXType_ULong = CXTypeKind.CXType_ULong; 3949 alias CXType_ULongLong = CXTypeKind.CXType_ULongLong; 3950 alias CXType_UInt128 = CXTypeKind.CXType_UInt128; 3951 alias CXType_Char_S = CXTypeKind.CXType_Char_S; 3952 alias CXType_SChar = CXTypeKind.CXType_SChar; 3953 alias CXType_WChar = CXTypeKind.CXType_WChar; 3954 alias CXType_Short = CXTypeKind.CXType_Short; 3955 alias CXType_Int = CXTypeKind.CXType_Int; 3956 alias CXType_Long = CXTypeKind.CXType_Long; 3957 alias CXType_LongLong = CXTypeKind.CXType_LongLong; 3958 alias CXType_Int128 = CXTypeKind.CXType_Int128; 3959 alias CXType_Float = CXTypeKind.CXType_Float; 3960 alias CXType_Double = CXTypeKind.CXType_Double; 3961 alias CXType_LongDouble = CXTypeKind.CXType_LongDouble; 3962 alias CXType_NullPtr = CXTypeKind.CXType_NullPtr; 3963 alias CXType_Overload = CXTypeKind.CXType_Overload; 3964 alias CXType_Dependent = CXTypeKind.CXType_Dependent; 3965 alias CXType_ObjCId = CXTypeKind.CXType_ObjCId; 3966 alias CXType_ObjCClass = CXTypeKind.CXType_ObjCClass; 3967 alias CXType_ObjCSel = CXTypeKind.CXType_ObjCSel; 3968 alias CXType_Float128 = CXTypeKind.CXType_Float128; 3969 alias CXType_Half = CXTypeKind.CXType_Half; 3970 alias CXType_Float16 = CXTypeKind.CXType_Float16; 3971 alias CXType_ShortAccum = CXTypeKind.CXType_ShortAccum; 3972 alias CXType_Accum = CXTypeKind.CXType_Accum; 3973 alias CXType_LongAccum = CXTypeKind.CXType_LongAccum; 3974 alias CXType_UShortAccum = CXTypeKind.CXType_UShortAccum; 3975 alias CXType_UAccum = CXTypeKind.CXType_UAccum; 3976 alias CXType_ULongAccum = CXTypeKind.CXType_ULongAccum; 3977 alias CXType_BFloat16 = CXTypeKind.CXType_BFloat16; 3978 alias CXType_Ibm128 = CXTypeKind.CXType_Ibm128; 3979 alias CXType_FirstBuiltin = CXTypeKind.CXType_FirstBuiltin; 3980 alias CXType_LastBuiltin = CXTypeKind.CXType_LastBuiltin; 3981 alias CXType_Complex = CXTypeKind.CXType_Complex; 3982 alias CXType_Pointer = CXTypeKind.CXType_Pointer; 3983 alias CXType_BlockPointer = CXTypeKind.CXType_BlockPointer; 3984 alias CXType_LValueReference = CXTypeKind.CXType_LValueReference; 3985 alias CXType_RValueReference = CXTypeKind.CXType_RValueReference; 3986 alias CXType_Record = CXTypeKind.CXType_Record; 3987 alias CXType_Enum = CXTypeKind.CXType_Enum; 3988 alias CXType_Typedef = CXTypeKind.CXType_Typedef; 3989 alias CXType_ObjCInterface = CXTypeKind.CXType_ObjCInterface; 3990 alias CXType_ObjCObjectPointer = CXTypeKind.CXType_ObjCObjectPointer; 3991 alias CXType_FunctionNoProto = CXTypeKind.CXType_FunctionNoProto; 3992 alias CXType_FunctionProto = CXTypeKind.CXType_FunctionProto; 3993 alias CXType_ConstantArray = CXTypeKind.CXType_ConstantArray; 3994 alias CXType_Vector = CXTypeKind.CXType_Vector; 3995 alias CXType_IncompleteArray = CXTypeKind.CXType_IncompleteArray; 3996 alias CXType_VariableArray = CXTypeKind.CXType_VariableArray; 3997 alias CXType_DependentSizedArray = CXTypeKind.CXType_DependentSizedArray; 3998 alias CXType_MemberPointer = CXTypeKind.CXType_MemberPointer; 3999 alias CXType_Auto = CXTypeKind.CXType_Auto; 4000 alias CXType_Elaborated = CXTypeKind.CXType_Elaborated; 4001 alias CXType_Pipe = CXTypeKind.CXType_Pipe; 4002 alias CXType_OCLImage1dRO = CXTypeKind.CXType_OCLImage1dRO; 4003 alias CXType_OCLImage1dArrayRO = CXTypeKind.CXType_OCLImage1dArrayRO; 4004 alias CXType_OCLImage1dBufferRO = CXTypeKind.CXType_OCLImage1dBufferRO; 4005 alias CXType_OCLImage2dRO = CXTypeKind.CXType_OCLImage2dRO; 4006 alias CXType_OCLImage2dArrayRO = CXTypeKind.CXType_OCLImage2dArrayRO; 4007 alias CXType_OCLImage2dDepthRO = CXTypeKind.CXType_OCLImage2dDepthRO; 4008 alias CXType_OCLImage2dArrayDepthRO = CXTypeKind.CXType_OCLImage2dArrayDepthRO; 4009 alias CXType_OCLImage2dMSAARO = CXTypeKind.CXType_OCLImage2dMSAARO; 4010 alias CXType_OCLImage2dArrayMSAARO = CXTypeKind.CXType_OCLImage2dArrayMSAARO; 4011 alias CXType_OCLImage2dMSAADepthRO = CXTypeKind.CXType_OCLImage2dMSAADepthRO; 4012 alias CXType_OCLImage2dArrayMSAADepthRO = CXTypeKind.CXType_OCLImage2dArrayMSAADepthRO; 4013 alias CXType_OCLImage3dRO = CXTypeKind.CXType_OCLImage3dRO; 4014 alias CXType_OCLImage1dWO = CXTypeKind.CXType_OCLImage1dWO; 4015 alias CXType_OCLImage1dArrayWO = CXTypeKind.CXType_OCLImage1dArrayWO; 4016 alias CXType_OCLImage1dBufferWO = CXTypeKind.CXType_OCLImage1dBufferWO; 4017 alias CXType_OCLImage2dWO = CXTypeKind.CXType_OCLImage2dWO; 4018 alias CXType_OCLImage2dArrayWO = CXTypeKind.CXType_OCLImage2dArrayWO; 4019 alias CXType_OCLImage2dDepthWO = CXTypeKind.CXType_OCLImage2dDepthWO; 4020 alias CXType_OCLImage2dArrayDepthWO = CXTypeKind.CXType_OCLImage2dArrayDepthWO; 4021 alias CXType_OCLImage2dMSAAWO = CXTypeKind.CXType_OCLImage2dMSAAWO; 4022 alias CXType_OCLImage2dArrayMSAAWO = CXTypeKind.CXType_OCLImage2dArrayMSAAWO; 4023 alias CXType_OCLImage2dMSAADepthWO = CXTypeKind.CXType_OCLImage2dMSAADepthWO; 4024 alias CXType_OCLImage2dArrayMSAADepthWO = CXTypeKind.CXType_OCLImage2dArrayMSAADepthWO; 4025 alias CXType_OCLImage3dWO = CXTypeKind.CXType_OCLImage3dWO; 4026 alias CXType_OCLImage1dRW = CXTypeKind.CXType_OCLImage1dRW; 4027 alias CXType_OCLImage1dArrayRW = CXTypeKind.CXType_OCLImage1dArrayRW; 4028 alias CXType_OCLImage1dBufferRW = CXTypeKind.CXType_OCLImage1dBufferRW; 4029 alias CXType_OCLImage2dRW = CXTypeKind.CXType_OCLImage2dRW; 4030 alias CXType_OCLImage2dArrayRW = CXTypeKind.CXType_OCLImage2dArrayRW; 4031 alias CXType_OCLImage2dDepthRW = CXTypeKind.CXType_OCLImage2dDepthRW; 4032 alias CXType_OCLImage2dArrayDepthRW = CXTypeKind.CXType_OCLImage2dArrayDepthRW; 4033 alias CXType_OCLImage2dMSAARW = CXTypeKind.CXType_OCLImage2dMSAARW; 4034 alias CXType_OCLImage2dArrayMSAARW = CXTypeKind.CXType_OCLImage2dArrayMSAARW; 4035 alias CXType_OCLImage2dMSAADepthRW = CXTypeKind.CXType_OCLImage2dMSAADepthRW; 4036 alias CXType_OCLImage2dArrayMSAADepthRW = CXTypeKind.CXType_OCLImage2dArrayMSAADepthRW; 4037 alias CXType_OCLImage3dRW = CXTypeKind.CXType_OCLImage3dRW; 4038 alias CXType_OCLSampler = CXTypeKind.CXType_OCLSampler; 4039 alias CXType_OCLEvent = CXTypeKind.CXType_OCLEvent; 4040 alias CXType_OCLQueue = CXTypeKind.CXType_OCLQueue; 4041 alias CXType_OCLReserveID = CXTypeKind.CXType_OCLReserveID; 4042 alias CXType_ObjCObject = CXTypeKind.CXType_ObjCObject; 4043 alias CXType_ObjCTypeParam = CXTypeKind.CXType_ObjCTypeParam; 4044 alias CXType_Attributed = CXTypeKind.CXType_Attributed; 4045 alias CXType_OCLIntelSubgroupAVCMcePayload = CXTypeKind.CXType_OCLIntelSubgroupAVCMcePayload; 4046 alias CXType_OCLIntelSubgroupAVCImePayload = CXTypeKind.CXType_OCLIntelSubgroupAVCImePayload; 4047 alias CXType_OCLIntelSubgroupAVCRefPayload = CXTypeKind.CXType_OCLIntelSubgroupAVCRefPayload; 4048 alias CXType_OCLIntelSubgroupAVCSicPayload = CXTypeKind.CXType_OCLIntelSubgroupAVCSicPayload; 4049 alias CXType_OCLIntelSubgroupAVCMceResult = CXTypeKind.CXType_OCLIntelSubgroupAVCMceResult; 4050 alias CXType_OCLIntelSubgroupAVCImeResult = CXTypeKind.CXType_OCLIntelSubgroupAVCImeResult; 4051 alias CXType_OCLIntelSubgroupAVCRefResult = CXTypeKind.CXType_OCLIntelSubgroupAVCRefResult; 4052 alias CXType_OCLIntelSubgroupAVCSicResult = CXTypeKind.CXType_OCLIntelSubgroupAVCSicResult; 4053 alias CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout = CXTypeKind.CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout; 4054 alias CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout = CXTypeKind.CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout; 4055 alias CXType_OCLIntelSubgroupAVCImeSingleRefStreamin = CXTypeKind.CXType_OCLIntelSubgroupAVCImeSingleRefStreamin; 4056 alias CXType_OCLIntelSubgroupAVCImeDualRefStreamin = CXTypeKind.CXType_OCLIntelSubgroupAVCImeDualRefStreamin; 4057 alias CXType_ExtVector = CXTypeKind.CXType_ExtVector; 4058 alias CXType_Atomic = CXTypeKind.CXType_Atomic; 4059 alias CXType_BTFTagAttributed = CXTypeKind.CXType_BTFTagAttributed; 4060 4061 /** 4062 * Describes the calling convention of a function type 4063 */ 4064 enum CXCallingConv 4065 { 4066 CXCallingConv_Default = 0, 4067 CXCallingConv_C = 1, 4068 CXCallingConv_X86StdCall = 2, 4069 CXCallingConv_X86FastCall = 3, 4070 CXCallingConv_X86ThisCall = 4, 4071 CXCallingConv_X86Pascal = 5, 4072 CXCallingConv_AAPCS = 6, 4073 CXCallingConv_AAPCS_VFP = 7, 4074 CXCallingConv_X86RegCall = 8, 4075 CXCallingConv_IntelOclBicc = 9, 4076 CXCallingConv_Win64 = 10, 4077 /* Alias for compatibility with older versions of API. */ 4078 CXCallingConv_X86_64Win64 = CXCallingConv_Win64, 4079 CXCallingConv_X86_64SysV = 11, 4080 CXCallingConv_X86VectorCall = 12, 4081 CXCallingConv_Swift = 13, 4082 CXCallingConv_PreserveMost = 14, 4083 CXCallingConv_PreserveAll = 15, 4084 CXCallingConv_AArch64VectorCall = 16, 4085 CXCallingConv_SwiftAsync = 17, 4086 CXCallingConv_AArch64SVEPCS = 18, 4087 4088 CXCallingConv_Invalid = 100, 4089 CXCallingConv_Unexposed = 200 4090 } 4091 4092 alias CXCallingConv_Default = CXCallingConv.CXCallingConv_Default; 4093 alias CXCallingConv_C = CXCallingConv.CXCallingConv_C; 4094 alias CXCallingConv_X86StdCall = CXCallingConv.CXCallingConv_X86StdCall; 4095 alias CXCallingConv_X86FastCall = CXCallingConv.CXCallingConv_X86FastCall; 4096 alias CXCallingConv_X86ThisCall = CXCallingConv.CXCallingConv_X86ThisCall; 4097 alias CXCallingConv_X86Pascal = CXCallingConv.CXCallingConv_X86Pascal; 4098 alias CXCallingConv_AAPCS = CXCallingConv.CXCallingConv_AAPCS; 4099 alias CXCallingConv_AAPCS_VFP = CXCallingConv.CXCallingConv_AAPCS_VFP; 4100 alias CXCallingConv_X86RegCall = CXCallingConv.CXCallingConv_X86RegCall; 4101 alias CXCallingConv_IntelOclBicc = CXCallingConv.CXCallingConv_IntelOclBicc; 4102 alias CXCallingConv_Win64 = CXCallingConv.CXCallingConv_Win64; 4103 alias CXCallingConv_X86_64Win64 = CXCallingConv.CXCallingConv_X86_64Win64; 4104 alias CXCallingConv_X86_64SysV = CXCallingConv.CXCallingConv_X86_64SysV; 4105 alias CXCallingConv_X86VectorCall = CXCallingConv.CXCallingConv_X86VectorCall; 4106 alias CXCallingConv_Swift = CXCallingConv.CXCallingConv_Swift; 4107 alias CXCallingConv_PreserveMost = CXCallingConv.CXCallingConv_PreserveMost; 4108 alias CXCallingConv_PreserveAll = CXCallingConv.CXCallingConv_PreserveAll; 4109 alias CXCallingConv_AArch64VectorCall = CXCallingConv.CXCallingConv_AArch64VectorCall; 4110 alias CXCallingConv_SwiftAsync = CXCallingConv.CXCallingConv_SwiftAsync; 4111 alias CXCallingConv_AArch64SVEPCS = CXCallingConv.CXCallingConv_AArch64SVEPCS; 4112 alias CXCallingConv_Invalid = CXCallingConv.CXCallingConv_Invalid; 4113 alias CXCallingConv_Unexposed = CXCallingConv.CXCallingConv_Unexposed; 4114 4115 /** 4116 * The type of an element in the abstract syntax tree. 4117 * 4118 */ 4119 struct CXType 4120 { 4121 CXTypeKind kind; 4122 void*[2] data; 4123 } 4124 4125 /** 4126 * Retrieve the type of a CXCursor (if any). 4127 */ 4128 CXType clang_getCursorType (const CXCursor C) pure; 4129 4130 /** 4131 * Pretty-print the underlying type using the rules of the 4132 * language of the translation unit from which it came. 4133 * 4134 * If the type is invalid, an empty string is returned. 4135 */ 4136 CXString clang_getTypeSpelling (const CXType CT); 4137 4138 /** 4139 * Retrieve the underlying type of a typedef declaration. 4140 * 4141 * If the cursor does not reference a typedef declaration, an invalid type is 4142 * returned. 4143 */ 4144 CXType clang_getTypedefDeclUnderlyingType (const CXCursor C) pure; 4145 4146 /** 4147 * Retrieve the integer type of an enum declaration. 4148 * 4149 * If the cursor does not reference an enum declaration, an invalid type is 4150 * returned. 4151 */ 4152 CXType clang_getEnumDeclIntegerType (const CXCursor C); 4153 4154 /** 4155 * Retrieve the integer value of an enum constant declaration as a signed 4156 * long long. 4157 * 4158 * If the cursor does not reference an enum constant declaration, LLONG_MIN is 4159 * returned. Since this is also potentially a valid constant value, the kind of 4160 * the cursor must be verified before calling this function. 4161 */ 4162 long clang_getEnumConstantDeclValue (const CXCursor C) pure; 4163 4164 /** 4165 * Retrieve the integer value of an enum constant declaration as an unsigned 4166 * long long. 4167 * 4168 * If the cursor does not reference an enum constant declaration, ULLONG_MAX is 4169 * returned. Since this is also potentially a valid constant value, the kind of 4170 * the cursor must be verified before calling this function. 4171 */ 4172 ulong clang_getEnumConstantDeclUnsignedValue (const CXCursor C); 4173 4174 /** 4175 * Retrieve the bit width of a bit field declaration as an integer. 4176 * 4177 * If a cursor that is not a bit field declaration is passed in, -1 is returned. 4178 */ 4179 int clang_getFieldDeclBitWidth (const CXCursor C) pure; 4180 4181 /** 4182 * Retrieve the number of non-variadic arguments associated with a given 4183 * cursor. 4184 * 4185 * The number of arguments can be determined for calls as well as for 4186 * declarations of functions or methods. For other cursors -1 is returned. 4187 */ 4188 int clang_Cursor_getNumArguments (const CXCursor C); 4189 4190 /** 4191 * Retrieve the argument cursor of a function or method. 4192 * 4193 * The argument cursor can be determined for calls as well as for declarations 4194 * of functions or methods. For other cursors and for invalid indices, an 4195 * invalid cursor is returned. 4196 */ 4197 CXCursor clang_Cursor_getArgument (const CXCursor C, uint i); 4198 4199 /** 4200 * Describes the kind of a template argument. 4201 * 4202 * See the definition of llvm::clang::TemplateArgument::ArgKind for full 4203 * element descriptions. 4204 */ 4205 enum CXTemplateArgumentKind 4206 { 4207 CXTemplateArgumentKind_Null = 0, 4208 CXTemplateArgumentKind_Type = 1, 4209 CXTemplateArgumentKind_Declaration = 2, 4210 CXTemplateArgumentKind_NullPtr = 3, 4211 CXTemplateArgumentKind_Integral = 4, 4212 CXTemplateArgumentKind_Template = 5, 4213 CXTemplateArgumentKind_TemplateExpansion = 6, 4214 CXTemplateArgumentKind_Expression = 7, 4215 CXTemplateArgumentKind_Pack = 8, 4216 /* Indicates an error case, preventing the kind from being deduced. */ 4217 CXTemplateArgumentKind_Invalid = 9 4218 } 4219 4220 alias CXTemplateArgumentKind_Null = CXTemplateArgumentKind.CXTemplateArgumentKind_Null; 4221 alias CXTemplateArgumentKind_Type = CXTemplateArgumentKind.CXTemplateArgumentKind_Type; 4222 alias CXTemplateArgumentKind_Declaration = CXTemplateArgumentKind.CXTemplateArgumentKind_Declaration; 4223 alias CXTemplateArgumentKind_NullPtr = CXTemplateArgumentKind.CXTemplateArgumentKind_NullPtr; 4224 alias CXTemplateArgumentKind_Integral = CXTemplateArgumentKind.CXTemplateArgumentKind_Integral; 4225 alias CXTemplateArgumentKind_Template = CXTemplateArgumentKind.CXTemplateArgumentKind_Template; 4226 alias CXTemplateArgumentKind_TemplateExpansion = CXTemplateArgumentKind.CXTemplateArgumentKind_TemplateExpansion; 4227 alias CXTemplateArgumentKind_Expression = CXTemplateArgumentKind.CXTemplateArgumentKind_Expression; 4228 alias CXTemplateArgumentKind_Pack = CXTemplateArgumentKind.CXTemplateArgumentKind_Pack; 4229 alias CXTemplateArgumentKind_Invalid = CXTemplateArgumentKind.CXTemplateArgumentKind_Invalid; 4230 4231 /** 4232 *Returns the number of template args of a function decl representing a 4233 * template specialization. 4234 * 4235 * If the argument cursor cannot be converted into a template function 4236 * declaration, -1 is returned. 4237 * 4238 * For example, for the following declaration and specialization: 4239 * template <typename T, int kInt, bool kBool> 4240 * void foo() { ... } 4241 * 4242 * template <> 4243 * void foo<float, -7, true>(); 4244 * 4245 * The value 3 would be returned from this call. 4246 */ 4247 int clang_Cursor_getNumTemplateArguments (const CXCursor C) pure; 4248 4249 /** 4250 * Retrieve the kind of the I'th template argument of the CXCursor C. 4251 * 4252 * If the argument CXCursor does not represent a FunctionDecl, an invalid 4253 * template argument kind is returned. 4254 * 4255 * For example, for the following declaration and specialization: 4256 * template <typename T, int kInt, bool kBool> 4257 * void foo() { ... } 4258 * 4259 * template <> 4260 * void foo<float, -7, true>(); 4261 * 4262 * For I = 0, 1, and 2, Type, Integral, and Integral will be returned, 4263 * respectively. 4264 */ 4265 CXTemplateArgumentKind clang_Cursor_getTemplateArgumentKind ( 4266 CXCursor C, 4267 uint I) pure; 4268 4269 /** 4270 * Retrieve a CXType representing the type of a TemplateArgument of a 4271 * function decl representing a template specialization. 4272 * 4273 * If the argument CXCursor does not represent a FunctionDecl whose I'th 4274 * template argument has a kind of CXTemplateArgKind_Integral, an invalid type 4275 * is returned. 4276 * 4277 * For example, for the following declaration and specialization: 4278 * template <typename T, int kInt, bool kBool> 4279 * void foo() { ... } 4280 * 4281 * template <> 4282 * void foo<float, -7, true>(); 4283 * 4284 * If called with I = 0, "float", will be returned. 4285 * Invalid types will be returned for I == 1 or 2. 4286 */ 4287 CXType clang_Cursor_getTemplateArgumentType (const CXCursor C, uint I) pure; 4288 4289 /** 4290 * Retrieve the value of an Integral TemplateArgument (of a function 4291 * decl representing a template specialization) as a signed long long. 4292 * 4293 * It is undefined to call this function on a CXCursor that does not represent a 4294 * FunctionDecl or whose I'th template argument is not an integral value. 4295 * 4296 * For example, for the following declaration and specialization: 4297 * template <typename T, int kInt, bool kBool> 4298 * void foo() { ... } 4299 * 4300 * template <> 4301 * void foo<float, -7, true>(); 4302 * 4303 * If called with I = 1 or 2, -7 or true will be returned, respectively. 4304 * For I == 0, this function's behavior is undefined. 4305 */ 4306 long clang_Cursor_getTemplateArgumentValue (const CXCursor C, uint I) pure; 4307 4308 /** 4309 * Retrieve the value of an Integral TemplateArgument (of a function 4310 * decl representing a template specialization) as an unsigned long long. 4311 * 4312 * It is undefined to call this function on a CXCursor that does not represent a 4313 * FunctionDecl or whose I'th template argument is not an integral value. 4314 * 4315 * For example, for the following declaration and specialization: 4316 * template <typename T, int kInt, bool kBool> 4317 * void foo() { ... } 4318 * 4319 * template <> 4320 * void foo<float, 2147483649, true>(); 4321 * 4322 * If called with I = 1 or 2, 2147483649 or true will be returned, respectively. 4323 * For I == 0, this function's behavior is undefined. 4324 */ 4325 ulong clang_Cursor_getTemplateArgumentUnsignedValue (const CXCursor C, uint I); 4326 4327 /** 4328 * Determine whether two CXTypes represent the same type. 4329 * 4330 * \returns non-zero if the CXTypes represent the same type and 4331 * zero otherwise. 4332 */ 4333 uint clang_equalTypes (const CXType A, const CXType B); 4334 4335 /** 4336 * Return the canonical type for a CXType. 4337 * 4338 * Clang's type system explicitly models typedefs and all the ways 4339 * a specific type can be represented. The canonical type is the underlying 4340 * type with all the "sugar" removed. For example, if 'T' is a typedef 4341 * for 'int', the canonical type for 'T' would be 'int'. 4342 */ 4343 CXType clang_getCanonicalType (const CXType T) pure; 4344 4345 /** 4346 * Determine whether a CXType has the "const" qualifier set, 4347 * without looking through typedefs that may have added "const" at a 4348 * different level. 4349 */ 4350 uint clang_isConstQualifiedType (const CXType T) pure; 4351 4352 /** 4353 * Determine whether a CXCursor that is a macro, is 4354 * function like. 4355 */ 4356 uint clang_Cursor_isMacroFunctionLike (const CXCursor C) pure; 4357 4358 /** 4359 * Determine whether a CXCursor that is a macro, is a 4360 * builtin one. 4361 */ 4362 uint clang_Cursor_isMacroBuiltin (const CXCursor C) pure; 4363 4364 /** 4365 * Determine whether a CXCursor that is a function declaration, is an 4366 * inline declaration. 4367 */ 4368 uint clang_Cursor_isFunctionInlined (const CXCursor C); 4369 4370 /** 4371 * Determine whether a CXType has the "volatile" qualifier set, 4372 * without looking through typedefs that may have added "volatile" at 4373 * a different level. 4374 */ 4375 uint clang_isVolatileQualifiedType (const CXType T) pure; 4376 4377 /** 4378 * Determine whether a CXType has the "restrict" qualifier set, 4379 * without looking through typedefs that may have added "restrict" at a 4380 * different level. 4381 */ 4382 uint clang_isRestrictQualifiedType (const CXType T); 4383 4384 /** 4385 * Returns the address space of the given type. 4386 */ 4387 uint clang_getAddressSpace (const CXType T); 4388 4389 /** 4390 * Returns the typedef name of the given type. 4391 */ 4392 CXString clang_getTypedefName (const CXType CT); 4393 4394 /** 4395 * For pointer types, returns the type of the pointee. 4396 */ 4397 CXType clang_getPointeeType (const CXType T) pure; 4398 4399 /** 4400 * Return the cursor for the declaration of the given type. 4401 */ 4402 CXCursor clang_getTypeDeclaration (const CXType T) pure; 4403 4404 /** 4405 * Returns the Objective-C type encoding for the specified declaration. 4406 */ 4407 CXString clang_getDeclObjCTypeEncoding (const CXCursor C); 4408 4409 /** 4410 * Returns the Objective-C type encoding for the specified CXType. 4411 */ 4412 CXString clang_Type_getObjCEncoding (const CXType type); 4413 4414 /** 4415 * Retrieve the spelling of a given CXTypeKind. 4416 */ 4417 CXString clang_getTypeKindSpelling (const CXTypeKind K); 4418 4419 /** 4420 * Retrieve the calling convention associated with a function type. 4421 * 4422 * If a non-function type is passed in, CXCallingConv_Invalid is returned. 4423 */ 4424 CXCallingConv clang_getFunctionTypeCallingConv (const CXType T); 4425 4426 /** 4427 * Retrieve the return type associated with a function type. 4428 * 4429 * If a non-function type is passed in, an invalid type is returned. 4430 */ 4431 CXType clang_getResultType (const CXType T) pure; 4432 4433 /** 4434 * Retrieve the exception specification type associated with a function type. 4435 * This is a value of type CXCursor_ExceptionSpecificationKind. 4436 * 4437 * If a non-function type is passed in, an error code of -1 is returned. 4438 */ 4439 int clang_getExceptionSpecificationType (const CXType T); 4440 4441 /** 4442 * Retrieve the number of non-variadic parameters associated with a 4443 * function type. 4444 * 4445 * If a non-function type is passed in, -1 is returned. 4446 */ 4447 int clang_getNumArgTypes (const CXType T); 4448 4449 /** 4450 * Retrieve the type of a parameter of a function type. 4451 * 4452 * If a non-function type is passed in or the function does not have enough 4453 * parameters, an invalid type is returned. 4454 */ 4455 CXType clang_getArgType (const CXType T, uint i); 4456 4457 /** 4458 * Retrieves the base type of the ObjCObjectType. 4459 * 4460 * If the type is not an ObjC object, an invalid type is returned. 4461 */ 4462 CXType clang_Type_getObjCObjectBaseType (const CXType T); 4463 4464 /** 4465 * Retrieve the number of protocol references associated with an ObjC object/id. 4466 * 4467 * If the type is not an ObjC object, 0 is returned. 4468 */ 4469 uint clang_Type_getNumObjCProtocolRefs (const CXType T); 4470 4471 /** 4472 * Retrieve the decl for a protocol reference for an ObjC object/id. 4473 * 4474 * If the type is not an ObjC object or there are not enough protocol 4475 * references, an invalid cursor is returned. 4476 */ 4477 CXCursor clang_Type_getObjCProtocolDecl (const CXType T, uint i); 4478 4479 /** 4480 * Retrieve the number of type arguments associated with an ObjC object. 4481 * 4482 * If the type is not an ObjC object, 0 is returned. 4483 */ 4484 uint clang_Type_getNumObjCTypeArgs (const CXType T); 4485 4486 /** 4487 * Retrieve a type argument associated with an ObjC object. 4488 * 4489 * If the type is not an ObjC or the index is not valid, 4490 * an invalid type is returned. 4491 */ 4492 CXType clang_Type_getObjCTypeArg (const CXType T, uint i); 4493 4494 /** 4495 * Return 1 if the CXType is a variadic function type, and 0 otherwise. 4496 */ 4497 uint clang_isFunctionTypeVariadic (const CXType T) pure; 4498 4499 /** 4500 * Retrieve the return type associated with a given cursor. 4501 * 4502 * This only returns a valid type if the cursor refers to a function or method. 4503 */ 4504 CXType clang_getCursorResultType (const CXCursor C) pure; 4505 4506 /** 4507 * Retrieve the exception specification type associated with a given cursor. 4508 * This is a value of type CXCursor_ExceptionSpecificationKind. 4509 * 4510 * This only returns a valid result if the cursor refers to a function or 4511 * method. 4512 */ 4513 int clang_getCursorExceptionSpecificationType (const CXCursor C); 4514 4515 /** 4516 * Return 1 if the CXType is a POD (plain old data) type, and 0 4517 * otherwise. 4518 */ 4519 uint clang_isPODType (const CXType T); 4520 4521 /** 4522 * Return the element type of an array, complex, or vector type. 4523 * 4524 * If a type is passed in that is not an array, complex, or vector type, 4525 * an invalid type is returned. 4526 */ 4527 CXType clang_getElementType (const CXType T) pure; 4528 4529 /** 4530 * Return the number of elements of an array or vector type. 4531 * 4532 * If a type is passed in that is not an array or vector type, 4533 * -1 is returned. 4534 */ 4535 long clang_getNumElements (const CXType T) pure; 4536 4537 /** 4538 * Return the element type of an array type. 4539 * 4540 * If a non-array type is passed in, an invalid type is returned. 4541 */ 4542 CXType clang_getArrayElementType (const CXType T); 4543 4544 /** 4545 * Return the array size of a constant array. 4546 * 4547 * If a non-array type is passed in, -1 is returned. 4548 */ 4549 long clang_getArraySize (const CXType T) pure; 4550 4551 /** 4552 * Retrieve the type named by the qualified-id. 4553 * 4554 * If a non-elaborated type is passed in, an invalid type is returned. 4555 */ 4556 CXType clang_Type_getNamedType (const CXType T) pure; 4557 4558 /** 4559 * Determine if a typedef is 'transparent' tag. 4560 * 4561 * A typedef is considered 'transparent' if it shares a name and spelling 4562 * location with its underlying tag type, as is the case with the NS_ENUM macro. 4563 * 4564 * \returns non-zero if transparent and zero otherwise. 4565 */ 4566 uint clang_Type_isTransparentTagTypedef (const CXType T); 4567 4568 enum CXTypeNullabilityKind 4569 { 4570 /** 4571 * Values of this type can never be null. 4572 */ 4573 CXTypeNullability_NonNull = 0, 4574 /** 4575 * Values of this type can be null. 4576 */ 4577 CXTypeNullability_Nullable = 1, 4578 /** 4579 * Whether values of this type can be null is (explicitly) 4580 * unspecified. This captures a (fairly rare) case where we 4581 * can't conclude anything about the nullability of the type even 4582 * though it has been considered. 4583 */ 4584 CXTypeNullability_Unspecified = 2, 4585 /** 4586 * Nullability is not applicable to this type. 4587 */ 4588 CXTypeNullability_Invalid = 3, 4589 4590 /** 4591 * Generally behaves like Nullable, except when used in a block parameter that 4592 * was imported into a swift async method. There, swift will assume that the 4593 * parameter can get null even if no error occurred. _Nullable parameters are 4594 * assumed to only get null on error. 4595 */ 4596 CXTypeNullability_NullableResult = 4 4597 } 4598 4599 alias CXTypeNullability_NonNull = CXTypeNullabilityKind.CXTypeNullability_NonNull; 4600 alias CXTypeNullability_Nullable = CXTypeNullabilityKind.CXTypeNullability_Nullable; 4601 alias CXTypeNullability_Unspecified = CXTypeNullabilityKind.CXTypeNullability_Unspecified; 4602 alias CXTypeNullability_Invalid = CXTypeNullabilityKind.CXTypeNullability_Invalid; 4603 alias CXTypeNullability_NullableResult = CXTypeNullabilityKind.CXTypeNullability_NullableResult; 4604 4605 /** 4606 * Retrieve the nullability kind of a pointer type. 4607 */ 4608 CXTypeNullabilityKind clang_Type_getNullability (const CXType T); 4609 4610 /** 4611 * List the possible error codes for \c clang_Type_getSizeOf, 4612 * \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and 4613 * \c clang_Cursor_getOffsetOf. 4614 * 4615 * A value of this enumeration type can be returned if the target type is not 4616 * a valid argument to sizeof, alignof or offsetof. 4617 */ 4618 enum CXTypeLayoutError 4619 { 4620 /** 4621 * Type is of kind CXType_Invalid. 4622 */ 4623 CXTypeLayoutError_Invalid = -1, 4624 /** 4625 * The type is an incomplete Type. 4626 */ 4627 CXTypeLayoutError_Incomplete = -2, 4628 /** 4629 * The type is a dependent Type. 4630 */ 4631 CXTypeLayoutError_Dependent = -3, 4632 /** 4633 * The type is not a constant size type. 4634 */ 4635 CXTypeLayoutError_NotConstantSize = -4, 4636 /** 4637 * The Field name is not valid for this record. 4638 */ 4639 CXTypeLayoutError_InvalidFieldName = -5, 4640 /** 4641 * The type is undeduced. 4642 */ 4643 CXTypeLayoutError_Undeduced = -6 4644 } 4645 4646 alias CXTypeLayoutError_Invalid = CXTypeLayoutError.CXTypeLayoutError_Invalid; 4647 alias CXTypeLayoutError_Incomplete = CXTypeLayoutError.CXTypeLayoutError_Incomplete; 4648 alias CXTypeLayoutError_Dependent = CXTypeLayoutError.CXTypeLayoutError_Dependent; 4649 alias CXTypeLayoutError_NotConstantSize = CXTypeLayoutError.CXTypeLayoutError_NotConstantSize; 4650 alias CXTypeLayoutError_InvalidFieldName = CXTypeLayoutError.CXTypeLayoutError_InvalidFieldName; 4651 alias CXTypeLayoutError_Undeduced = CXTypeLayoutError.CXTypeLayoutError_Undeduced; 4652 4653 /** 4654 * Return the alignment of a type in bytes as per C++[expr.alignof] 4655 * standard. 4656 * 4657 * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. 4658 * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete 4659 * is returned. 4660 * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is 4661 * returned. 4662 * If the type declaration is not a constant size type, 4663 * CXTypeLayoutError_NotConstantSize is returned. 4664 */ 4665 long clang_Type_getAlignOf (const CXType T); 4666 4667 /** 4668 * Return the class type of an member pointer type. 4669 * 4670 * If a non-member-pointer type is passed in, an invalid type is returned. 4671 */ 4672 CXType clang_Type_getClassType (const CXType T); 4673 4674 /** 4675 * Return the size of a type in bytes as per C++[expr.sizeof] standard. 4676 * 4677 * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. 4678 * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete 4679 * is returned. 4680 * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is 4681 * returned. 4682 */ 4683 long clang_Type_getSizeOf (const CXType T); 4684 4685 /** 4686 * Return the offset of a field named S in a record of type T in bits 4687 * as it would be returned by __offsetof__ as per C++11[18.2p4] 4688 * 4689 * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid 4690 * is returned. 4691 * If the field's type declaration is an incomplete type, 4692 * CXTypeLayoutError_Incomplete is returned. 4693 * If the field's type declaration is a dependent type, 4694 * CXTypeLayoutError_Dependent is returned. 4695 * If the field's name S is not found, 4696 * CXTypeLayoutError_InvalidFieldName is returned. 4697 */ 4698 long clang_Type_getOffsetOf (const CXType T, const(char)* S); 4699 4700 /** 4701 * Return the type that was modified by this attributed type. 4702 * 4703 * If the type is not an attributed type, an invalid type is returned. 4704 */ 4705 CXType clang_Type_getModifiedType (const CXType T); 4706 4707 /** 4708 * Gets the type contained by this atomic type. 4709 * 4710 * If a non-atomic type is passed in, an invalid type is returned. 4711 */ 4712 CXType clang_Type_getValueType (const CXType CT); 4713 4714 /** 4715 * Return the offset of the field represented by the Cursor. 4716 * 4717 * If the cursor is not a field declaration, -1 is returned. 4718 * If the cursor semantic parent is not a record field declaration, 4719 * CXTypeLayoutError_Invalid is returned. 4720 * If the field's type declaration is an incomplete type, 4721 * CXTypeLayoutError_Incomplete is returned. 4722 * If the field's type declaration is a dependent type, 4723 * CXTypeLayoutError_Dependent is returned. 4724 * If the field's name S is not found, 4725 * CXTypeLayoutError_InvalidFieldName is returned. 4726 */ 4727 long clang_Cursor_getOffsetOfField (const CXCursor C); 4728 4729 /** 4730 * Determine whether the given cursor represents an anonymous 4731 * tag or namespace 4732 */ 4733 uint clang_Cursor_isAnonymous (const CXCursor C) pure; 4734 4735 /** 4736 * Determine whether the given cursor represents an anonymous record 4737 * declaration. 4738 */ 4739 uint clang_Cursor_isAnonymousRecordDecl (const CXCursor C); 4740 4741 /** 4742 * Determine whether the given cursor represents an inline namespace 4743 * declaration. 4744 */ 4745 uint clang_Cursor_isInlineNamespace (const CXCursor C); 4746 4747 enum CXRefQualifierKind 4748 { 4749 /** No ref-qualifier was provided. */ 4750 CXRefQualifier_None = 0, 4751 /** An lvalue ref-qualifier was provided (\c &). */ 4752 CXRefQualifier_LValue = 1, 4753 /** An rvalue ref-qualifier was provided (\c &&). */ 4754 CXRefQualifier_RValue = 2 4755 } 4756 4757 alias CXRefQualifier_None = CXRefQualifierKind.CXRefQualifier_None; 4758 alias CXRefQualifier_LValue = CXRefQualifierKind.CXRefQualifier_LValue; 4759 alias CXRefQualifier_RValue = CXRefQualifierKind.CXRefQualifier_RValue; 4760 4761 /** 4762 * Returns the number of template arguments for given template 4763 * specialization, or -1 if type \c T is not a template specialization. 4764 */ 4765 int clang_Type_getNumTemplateArguments (const CXType T); 4766 4767 /** 4768 * Returns the type template argument of a template class specialization 4769 * at given index. 4770 * 4771 * This function only returns template type arguments and does not handle 4772 * template template arguments or variadic packs. 4773 */ 4774 CXType clang_Type_getTemplateArgumentAsType (const CXType T, uint i); 4775 4776 /** 4777 * Retrieve the ref-qualifier kind of a function or method. 4778 * 4779 * The ref-qualifier is returned for C++ functions or methods. For other types 4780 * or non-C++ declarations, CXRefQualifier_None is returned. 4781 */ 4782 CXRefQualifierKind clang_Type_getCXXRefQualifier (const CXType T); 4783 4784 /** 4785 * Returns non-zero if the cursor specifies a Record member that is a 4786 * bitfield. 4787 */ 4788 uint clang_Cursor_isBitField (const CXCursor C) pure; 4789 4790 /** 4791 * Returns 1 if the base class specified by the cursor with kind 4792 * CX_CXXBaseSpecifier is virtual. 4793 */ 4794 uint clang_isVirtualBase (const CXCursor); 4795 4796 /** 4797 * Represents the C++ access control level to a base class for a 4798 * cursor with kind CX_CXXBaseSpecifier. 4799 */ 4800 enum CX_CXXAccessSpecifier 4801 { 4802 CX_CXXInvalidAccessSpecifier = 0, 4803 CX_CXXPublic = 1, 4804 CX_CXXProtected = 2, 4805 CX_CXXPrivate = 3 4806 } 4807 4808 alias CX_CXXInvalidAccessSpecifier = CX_CXXAccessSpecifier.CX_CXXInvalidAccessSpecifier; 4809 alias CX_CXXPublic = CX_CXXAccessSpecifier.CX_CXXPublic; 4810 alias CX_CXXProtected = CX_CXXAccessSpecifier.CX_CXXProtected; 4811 alias CX_CXXPrivate = CX_CXXAccessSpecifier.CX_CXXPrivate; 4812 4813 /** 4814 * Returns the access control level for the referenced object. 4815 * 4816 * If the cursor refers to a C++ declaration, its access control level within 4817 * its parent scope is returned. Otherwise, if the cursor refers to a base 4818 * specifier or access specifier, the specifier itself is returned. 4819 */ 4820 CX_CXXAccessSpecifier clang_getCXXAccessSpecifier (const CXCursor) pure; 4821 4822 /** 4823 * Represents the storage classes as declared in the source. CX_SC_Invalid 4824 * was added for the case that the passed cursor in not a declaration. 4825 */ 4826 enum CX_StorageClass 4827 { 4828 CX_SC_Invalid = 0, 4829 CX_SC_None = 1, 4830 CX_SC_Extern = 2, 4831 CX_SC_Static = 3, 4832 CX_SC_PrivateExtern = 4, 4833 CX_SC_OpenCLWorkGroupLocal = 5, 4834 CX_SC_Auto = 6, 4835 CX_SC_Register = 7 4836 } 4837 4838 alias CX_SC_Invalid = CX_StorageClass.CX_SC_Invalid; 4839 alias CX_SC_None = CX_StorageClass.CX_SC_None; 4840 alias CX_SC_Extern = CX_StorageClass.CX_SC_Extern; 4841 alias CX_SC_Static = CX_StorageClass.CX_SC_Static; 4842 alias CX_SC_PrivateExtern = CX_StorageClass.CX_SC_PrivateExtern; 4843 alias CX_SC_OpenCLWorkGroupLocal = CX_StorageClass.CX_SC_OpenCLWorkGroupLocal; 4844 alias CX_SC_Auto = CX_StorageClass.CX_SC_Auto; 4845 alias CX_SC_Register = CX_StorageClass.CX_SC_Register; 4846 4847 /** 4848 * Returns the storage class for a function or variable declaration. 4849 * 4850 * If the passed in Cursor is not a function or variable declaration, 4851 * CX_SC_Invalid is returned else the storage class. 4852 */ 4853 CX_StorageClass clang_Cursor_getStorageClass (const CXCursor) pure; 4854 4855 /** 4856 * Determine the number of overloaded declarations referenced by a 4857 * \c CXCursor_OverloadedDeclRef cursor. 4858 * 4859 * \param cursor The cursor whose overloaded declarations are being queried. 4860 * 4861 * \returns The number of overloaded declarations referenced by \c cursor. If it 4862 * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0. 4863 */ 4864 uint clang_getNumOverloadedDecls (const CXCursor cursor) pure; 4865 4866 /** 4867 * Retrieve a cursor for one of the overloaded declarations referenced 4868 * by a \c CXCursor_OverloadedDeclRef cursor. 4869 * 4870 * \param cursor The cursor whose overloaded declarations are being queried. 4871 * 4872 * \param index The zero-based index into the set of overloaded declarations in 4873 * the cursor. 4874 * 4875 * \returns A cursor representing the declaration referenced by the given 4876 * \c cursor at the specified \c index. If the cursor does not have an 4877 * associated set of overloaded declarations, or if the index is out of bounds, 4878 * returns \c clang_getNullCursor(); 4879 */ 4880 CXCursor clang_getOverloadedDecl (const CXCursor cursor, uint index); 4881 4882 /** 4883 * @} 4884 */ 4885 4886 /** 4887 * \defgroup CINDEX_ATTRIBUTES Information for attributes 4888 * 4889 * @{ 4890 */ 4891 4892 /** 4893 * For cursors representing an iboutletcollection attribute, 4894 * this function returns the collection element type. 4895 * 4896 */ 4897 CXType clang_getIBOutletCollectionType (const CXCursor); 4898 4899 /** 4900 * @} 4901 */ 4902 4903 /** 4904 * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors 4905 * 4906 * These routines provide the ability to traverse the abstract syntax tree 4907 * using cursors. 4908 * 4909 * @{ 4910 */ 4911 4912 /** 4913 * Describes how the traversal of the children of a particular 4914 * cursor should proceed after visiting a particular child cursor. 4915 * 4916 * A value of this enumeration type should be returned by each 4917 * \c CXCursorVisitor to indicate how clang_visitChildren() proceed. 4918 */ 4919 enum CXChildVisitResult 4920 { 4921 /** 4922 * Terminates the cursor traversal. 4923 */ 4924 CXChildVisit_Break = 0, 4925 /** 4926 * Continues the cursor traversal with the next sibling of 4927 * the cursor just visited, without visiting its children. 4928 */ 4929 CXChildVisit_Continue = 1, 4930 /** 4931 * Recursively traverse the children of this cursor, using 4932 * the same visitor and client data. 4933 */ 4934 CXChildVisit_Recurse = 2 4935 } 4936 4937 alias CXChildVisit_Break = CXChildVisitResult.CXChildVisit_Break; 4938 alias CXChildVisit_Continue = CXChildVisitResult.CXChildVisit_Continue; 4939 alias CXChildVisit_Recurse = CXChildVisitResult.CXChildVisit_Recurse; 4940 4941 /** 4942 * Visitor invoked for each cursor found by a traversal. 4943 * 4944 * This visitor block will be invoked for each cursor found by 4945 * clang_visitChildrenWithBlock(). Its first argument is the cursor being 4946 * visited, its second argument is the parent visitor for that cursor. 4947 * 4948 * The visitor should return one of the \c CXChildVisitResult values 4949 * to direct clang_visitChildrenWithBlock(). 4950 */ 4951 4952 /** 4953 * Visits the children of a cursor using the specified block. Behaves 4954 * identically to clang_visitChildren() in all other respects. 4955 */ 4956 4957 /** 4958 * @} 4959 */ 4960 4961 /** 4962 * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST 4963 * 4964 * These routines provide the ability to determine references within and 4965 * across translation units, by providing the names of the entities referenced 4966 * by cursors, follow reference cursors to the declarations they reference, 4967 * and associate declarations with their definitions. 4968 * 4969 * @{ 4970 */ 4971 4972 /** 4973 * Retrieve a Unified Symbol Resolution (USR) for the entity referenced 4974 * by the given cursor. 4975 * 4976 * A Unified Symbol Resolution (USR) is a string that identifies a particular 4977 * entity (function, class, variable, etc.) within a program. USRs can be 4978 * compared across translation units to determine, e.g., when references in 4979 * one translation refer to an entity defined in another translation unit. 4980 */ 4981 CXString clang_getCursorUSR (const CXCursor); 4982 4983 /** 4984 * Construct a USR for a specified Objective-C class. 4985 */ 4986 CXString clang_constructUSR_ObjCClass (const(char)* class_name); 4987 4988 /** 4989 * Construct a USR for a specified Objective-C category. 4990 */ 4991 CXString clang_constructUSR_ObjCCategory ( 4992 const(char)* class_name, 4993 const(char)* category_name); 4994 4995 /** 4996 * Construct a USR for a specified Objective-C protocol. 4997 */ 4998 CXString clang_constructUSR_ObjCProtocol (const(char)* protocol_name); 4999 5000 /** 5001 * Construct a USR for a specified Objective-C instance variable and 5002 * the USR for its containing class. 5003 */ 5004 CXString clang_constructUSR_ObjCIvar (const(char)* name, CXString classUSR); 5005 5006 /** 5007 * Construct a USR for a specified Objective-C method and 5008 * the USR for its containing class. 5009 */ 5010 CXString clang_constructUSR_ObjCMethod ( 5011 const(char)* name, 5012 uint isInstanceMethod, 5013 CXString classUSR); 5014 5015 /** 5016 * Construct a USR for a specified Objective-C property and the USR 5017 * for its containing class. 5018 */ 5019 CXString clang_constructUSR_ObjCProperty ( 5020 const(char)* property, 5021 CXString classUSR); 5022 5023 /** 5024 * Retrieve a name for the entity referenced by this cursor. 5025 */ 5026 CXString clang_getCursorSpelling (const CXCursor) pure; 5027 5028 /** 5029 * Retrieve a range for a piece that forms the cursors spelling name. 5030 * Most of the times there is only one range for the complete spelling but for 5031 * Objective-C methods and Objective-C message expressions, there are multiple 5032 * pieces for each selector identifier. 5033 * 5034 * \param pieceIndex the index of the spelling name piece. If this is greater 5035 * than the actual number of pieces, it will return a NULL (invalid) range. 5036 * 5037 * \param options Reserved. 5038 */ 5039 CXSourceRange clang_Cursor_getSpellingNameRange ( 5040 CXCursor, 5041 uint pieceIndex, 5042 uint options); 5043 5044 /** 5045 * Opaque pointer representing a policy that controls pretty printing 5046 * for \c clang_getCursorPrettyPrinted. 5047 */ 5048 alias CXPrintingPolicy = void*; 5049 5050 /** 5051 * Properties for the printing policy. 5052 * 5053 * See \c clang::PrintingPolicy for more information. 5054 */ 5055 enum CXPrintingPolicyProperty 5056 { 5057 CXPrintingPolicy_Indentation = 0, 5058 CXPrintingPolicy_SuppressSpecifiers = 1, 5059 CXPrintingPolicy_SuppressTagKeyword = 2, 5060 CXPrintingPolicy_IncludeTagDefinition = 3, 5061 CXPrintingPolicy_SuppressScope = 4, 5062 CXPrintingPolicy_SuppressUnwrittenScope = 5, 5063 CXPrintingPolicy_SuppressInitializers = 6, 5064 CXPrintingPolicy_ConstantArraySizeAsWritten = 7, 5065 CXPrintingPolicy_AnonymousTagLocations = 8, 5066 CXPrintingPolicy_SuppressStrongLifetime = 9, 5067 CXPrintingPolicy_SuppressLifetimeQualifiers = 10, 5068 CXPrintingPolicy_SuppressTemplateArgsInCXXConstructors = 11, 5069 CXPrintingPolicy_Bool = 12, 5070 CXPrintingPolicy_Restrict = 13, 5071 CXPrintingPolicy_Alignof = 14, 5072 CXPrintingPolicy_UnderscoreAlignof = 15, 5073 CXPrintingPolicy_UseVoidForZeroParams = 16, 5074 CXPrintingPolicy_TerseOutput = 17, 5075 CXPrintingPolicy_PolishForDeclaration = 18, 5076 CXPrintingPolicy_Half = 19, 5077 CXPrintingPolicy_MSWChar = 20, 5078 CXPrintingPolicy_IncludeNewlines = 21, 5079 CXPrintingPolicy_MSVCFormatting = 22, 5080 CXPrintingPolicy_ConstantsAsWritten = 23, 5081 CXPrintingPolicy_SuppressImplicitBase = 24, 5082 CXPrintingPolicy_FullyQualifiedName = 25, 5083 5084 CXPrintingPolicy_LastProperty = CXPrintingPolicy_FullyQualifiedName 5085 } 5086 5087 alias CXPrintingPolicy_Indentation = CXPrintingPolicyProperty.CXPrintingPolicy_Indentation; 5088 alias CXPrintingPolicy_SuppressSpecifiers = CXPrintingPolicyProperty.CXPrintingPolicy_SuppressSpecifiers; 5089 alias CXPrintingPolicy_SuppressTagKeyword = CXPrintingPolicyProperty.CXPrintingPolicy_SuppressTagKeyword; 5090 alias CXPrintingPolicy_IncludeTagDefinition = CXPrintingPolicyProperty.CXPrintingPolicy_IncludeTagDefinition; 5091 alias CXPrintingPolicy_SuppressScope = CXPrintingPolicyProperty.CXPrintingPolicy_SuppressScope; 5092 alias CXPrintingPolicy_SuppressUnwrittenScope = CXPrintingPolicyProperty.CXPrintingPolicy_SuppressUnwrittenScope; 5093 alias CXPrintingPolicy_SuppressInitializers = CXPrintingPolicyProperty.CXPrintingPolicy_SuppressInitializers; 5094 alias CXPrintingPolicy_ConstantArraySizeAsWritten = CXPrintingPolicyProperty.CXPrintingPolicy_ConstantArraySizeAsWritten; 5095 alias CXPrintingPolicy_AnonymousTagLocations = CXPrintingPolicyProperty.CXPrintingPolicy_AnonymousTagLocations; 5096 alias CXPrintingPolicy_SuppressStrongLifetime = CXPrintingPolicyProperty.CXPrintingPolicy_SuppressStrongLifetime; 5097 alias CXPrintingPolicy_SuppressLifetimeQualifiers = CXPrintingPolicyProperty.CXPrintingPolicy_SuppressLifetimeQualifiers; 5098 alias CXPrintingPolicy_SuppressTemplateArgsInCXXConstructors = CXPrintingPolicyProperty.CXPrintingPolicy_SuppressTemplateArgsInCXXConstructors; 5099 alias CXPrintingPolicy_Bool = CXPrintingPolicyProperty.CXPrintingPolicy_Bool; 5100 alias CXPrintingPolicy_Restrict = CXPrintingPolicyProperty.CXPrintingPolicy_Restrict; 5101 alias CXPrintingPolicy_Alignof = CXPrintingPolicyProperty.CXPrintingPolicy_Alignof; 5102 alias CXPrintingPolicy_UnderscoreAlignof = CXPrintingPolicyProperty.CXPrintingPolicy_UnderscoreAlignof; 5103 alias CXPrintingPolicy_UseVoidForZeroParams = CXPrintingPolicyProperty.CXPrintingPolicy_UseVoidForZeroParams; 5104 alias CXPrintingPolicy_TerseOutput = CXPrintingPolicyProperty.CXPrintingPolicy_TerseOutput; 5105 alias CXPrintingPolicy_PolishForDeclaration = CXPrintingPolicyProperty.CXPrintingPolicy_PolishForDeclaration; 5106 alias CXPrintingPolicy_Half = CXPrintingPolicyProperty.CXPrintingPolicy_Half; 5107 alias CXPrintingPolicy_MSWChar = CXPrintingPolicyProperty.CXPrintingPolicy_MSWChar; 5108 alias CXPrintingPolicy_IncludeNewlines = CXPrintingPolicyProperty.CXPrintingPolicy_IncludeNewlines; 5109 alias CXPrintingPolicy_MSVCFormatting = CXPrintingPolicyProperty.CXPrintingPolicy_MSVCFormatting; 5110 alias CXPrintingPolicy_ConstantsAsWritten = CXPrintingPolicyProperty.CXPrintingPolicy_ConstantsAsWritten; 5111 alias CXPrintingPolicy_SuppressImplicitBase = CXPrintingPolicyProperty.CXPrintingPolicy_SuppressImplicitBase; 5112 alias CXPrintingPolicy_FullyQualifiedName = CXPrintingPolicyProperty.CXPrintingPolicy_FullyQualifiedName; 5113 alias CXPrintingPolicy_LastProperty = CXPrintingPolicyProperty.CXPrintingPolicy_LastProperty; 5114 5115 /** 5116 * Get a property value for the given printing policy. 5117 */ 5118 uint clang_PrintingPolicy_getProperty ( 5119 CXPrintingPolicy Policy, 5120 CXPrintingPolicyProperty Property); 5121 5122 /** 5123 * Set a property value for the given printing policy. 5124 */ 5125 void clang_PrintingPolicy_setProperty ( 5126 CXPrintingPolicy Policy, 5127 CXPrintingPolicyProperty Property, 5128 uint Value); 5129 5130 /** 5131 * Retrieve the default policy for the cursor. 5132 * 5133 * The policy should be released after use with \c 5134 * clang_PrintingPolicy_dispose. 5135 */ 5136 CXPrintingPolicy clang_getCursorPrintingPolicy (const CXCursor); 5137 5138 /** 5139 * Release a printing policy. 5140 */ 5141 void clang_PrintingPolicy_dispose (const CXPrintingPolicy Policy); 5142 5143 /** 5144 * Pretty print declarations. 5145 * 5146 * \param Cursor The cursor representing a declaration. 5147 * 5148 * \param Policy The policy to control the entities being printed. If 5149 * NULL, a default policy is used. 5150 * 5151 * \returns The pretty printed declaration or the empty string for 5152 * other cursors. 5153 */ 5154 CXString clang_getCursorPrettyPrinted ( 5155 CXCursor Cursor, 5156 CXPrintingPolicy Policy); 5157 5158 /** 5159 * Retrieve the display name for the entity referenced by this cursor. 5160 * 5161 * The display name contains extra information that helps identify the cursor, 5162 * such as the parameters of a function or template or the arguments of a 5163 * class template specialization. 5164 */ 5165 CXString clang_getCursorDisplayName (const CXCursor) pure; 5166 5167 /** For a cursor that is a reference, retrieve a cursor representing the 5168 * entity that it references. 5169 * 5170 * Reference cursors refer to other entities in the AST. For example, an 5171 * Objective-C superclass reference cursor refers to an Objective-C class. 5172 * This function produces the cursor for the Objective-C class from the 5173 * cursor for the superclass reference. If the input cursor is a declaration or 5174 * definition, it returns that declaration or definition unchanged. 5175 * Otherwise, returns the NULL cursor. 5176 */ 5177 CXCursor clang_getCursorReferenced (const CXCursor); 5178 5179 /** 5180 * For a cursor that is either a reference to or a declaration 5181 * of some entity, retrieve a cursor that describes the definition of 5182 * that entity. 5183 * 5184 * Some entities can be declared multiple times within a translation 5185 * unit, but only one of those declarations can also be a 5186 * definition. For example, given: 5187 * 5188 * \code 5189 * int f(int, int); 5190 * int g(int x, int y) { return f(x, y); } 5191 * int f(int a, int b) { return a + b; } 5192 * int f(int, int); 5193 * \endcode 5194 * 5195 * there are three declarations of the function "f", but only the 5196 * second one is a definition. The clang_getCursorDefinition() 5197 * function will take any cursor pointing to a declaration of "f" 5198 * (the first or fourth lines of the example) or a cursor referenced 5199 * that uses "f" (the call to "f' inside "g") and will return a 5200 * declaration cursor pointing to the definition (the second "f" 5201 * declaration). 5202 * 5203 * If given a cursor for which there is no corresponding definition, 5204 * e.g., because there is no definition of that entity within this 5205 * translation unit, returns a NULL cursor. 5206 */ 5207 CXCursor clang_getCursorDefinition (const CXCursor); 5208 5209 /** 5210 * Determine whether the declaration pointed to by this cursor 5211 * is also a definition of that entity. 5212 */ 5213 uint clang_isCursorDefinition (const CXCursor) pure; 5214 5215 /** 5216 * Retrieve the canonical cursor corresponding to the given cursor. 5217 * 5218 * In the C family of languages, many kinds of entities can be declared several 5219 * times within a single translation unit. For example, a structure type can 5220 * be forward-declared (possibly multiple times) and later defined: 5221 * 5222 * \code 5223 * struct X; 5224 * struct X; 5225 * struct X { 5226 * int member; 5227 * }; 5228 * \endcode 5229 * 5230 * The declarations and the definition of \c X are represented by three 5231 * different cursors, all of which are declarations of the same underlying 5232 * entity. One of these cursor is considered the "canonical" cursor, which 5233 * is effectively the representative for the underlying entity. One can 5234 * determine if two cursors are declarations of the same underlying entity by 5235 * comparing their canonical cursors. 5236 * 5237 * \returns The canonical cursor for the entity referred to by the given cursor. 5238 */ 5239 CXCursor clang_getCanonicalCursor (const CXCursor) pure; 5240 5241 /** 5242 * If the cursor points to a selector identifier in an Objective-C 5243 * method or message expression, this returns the selector index. 5244 * 5245 * After getting a cursor with #clang_getCursor, this can be called to 5246 * determine if the location points to a selector identifier. 5247 * 5248 * \returns The selector index if the cursor is an Objective-C method or message 5249 * expression and the cursor is pointing to a selector identifier, or -1 5250 * otherwise. 5251 */ 5252 int clang_Cursor_getObjCSelectorIndex (const CXCursor); 5253 5254 /** 5255 * Given a cursor pointing to a C++ method call or an Objective-C 5256 * message, returns non-zero if the method/message is "dynamic", meaning: 5257 * 5258 * For a C++ method: the call is virtual. 5259 * For an Objective-C message: the receiver is an object instance, not 'super' 5260 * or a specific class. 5261 * 5262 * If the method/message is "static" or the cursor does not point to a 5263 * method/message, it will return zero. 5264 */ 5265 int clang_Cursor_isDynamicCall (const CXCursor C); 5266 5267 /** 5268 * Given a cursor pointing to an Objective-C message or property 5269 * reference, or C++ method call, returns the CXType of the receiver. 5270 */ 5271 CXType clang_Cursor_getReceiverType (const CXCursor C); 5272 5273 /** 5274 * Property attributes for a \c CXCursor_ObjCPropertyDecl. 5275 */ 5276 enum CXObjCPropertyAttrKind 5277 { 5278 CXObjCPropertyAttr_noattr = 0x00, 5279 CXObjCPropertyAttr_readonly = 0x01, 5280 CXObjCPropertyAttr_getter = 0x02, 5281 CXObjCPropertyAttr_assign = 0x04, 5282 CXObjCPropertyAttr_readwrite = 0x08, 5283 CXObjCPropertyAttr_retain = 0x10, 5284 CXObjCPropertyAttr_copy = 0x20, 5285 CXObjCPropertyAttr_nonatomic = 0x40, 5286 CXObjCPropertyAttr_setter = 0x80, 5287 CXObjCPropertyAttr_atomic = 0x100, 5288 CXObjCPropertyAttr_weak = 0x200, 5289 CXObjCPropertyAttr_strong = 0x400, 5290 CXObjCPropertyAttr_unsafe_unretained = 0x800, 5291 CXObjCPropertyAttr_class = 0x1000 5292 } 5293 5294 mixin EnumC!CXObjCPropertyAttrKind; 5295 // alias CXObjCPropertyAttr_noattr = .CXObjCPropertyAttr_noattr; 5296 // alias CXObjCPropertyAttr_readonly = .CXObjCPropertyAttr_readonly; 5297 // alias CXObjCPropertyAttr_getter = .CXObjCPropertyAttr_getter; 5298 // alias CXObjCPropertyAttr_assign = .CXObjCPropertyAttr_assign; 5299 // alias CXObjCPropertyAttr_readwrite = .CXObjCPropertyAttr_readwrite; 5300 // alias CXObjCPropertyAttr_retain = .CXObjCPropertyAttr_retain; 5301 // alias CXObjCPropertyAttr_copy = .CXObjCPropertyAttr_copy; 5302 // alias CXObjCPropertyAttr_nonatomic = .CXObjCPropertyAttr_nonatomic; 5303 // alias CXObjCPropertyAttr_setter = .CXObjCPropertyAttr_setter; 5304 // alias CXObjCPropertyAttr_atomic = .CXObjCPropertyAttr_atomic; 5305 // alias CXObjCPropertyAttr_weak = .CXObjCPropertyAttr_weak; 5306 // alias CXObjCPropertyAttr_strong = .CXObjCPropertyAttr_strong; 5307 // alias CXObjCPropertyAttr_unsafe_unretained = .CXObjCPropertyAttr_unsafe_unretained; 5308 // alias CXObjCPropertyAttr_class = .CXObjCPropertyAttr_class; 5309 5310 /** 5311 * Given a cursor that represents a property declaration, return the 5312 * associated property attributes. The bits are formed from 5313 * \c CXObjCPropertyAttrKind. 5314 * 5315 * \param reserved Reserved for future use, pass 0. 5316 */ 5317 uint clang_Cursor_getObjCPropertyAttributes (const CXCursor C, uint reserved); 5318 5319 /** 5320 * Given a cursor that represents a property declaration, return the 5321 * name of the method that implements the getter. 5322 */ 5323 CXString clang_Cursor_getObjCPropertyGetterName (const CXCursor C); 5324 5325 /** 5326 * Given a cursor that represents a property declaration, return the 5327 * name of the method that implements the setter, if any. 5328 */ 5329 CXString clang_Cursor_getObjCPropertySetterName (const CXCursor C); 5330 5331 /** 5332 * 'Qualifiers' written next to the return and parameter types in 5333 * Objective-C method declarations. 5334 */ 5335 enum CXObjCDeclQualifierKind 5336 { 5337 CXObjCDeclQualifier_None = 0x0, 5338 CXObjCDeclQualifier_In = 0x1, 5339 CXObjCDeclQualifier_Inout = 0x2, 5340 CXObjCDeclQualifier_Out = 0x4, 5341 CXObjCDeclQualifier_Bycopy = 0x8, 5342 CXObjCDeclQualifier_Byref = 0x10, 5343 CXObjCDeclQualifier_Oneway = 0x20 5344 } 5345 mixin EnumC!CXObjCDeclQualifierKind; 5346 5347 // alias CXObjCDeclQualifier_None = .CXObjCDeclQualifier_None; 5348 // alias CXObjCDeclQualifier_In = .CXObjCDeclQualifier_In; 5349 // alias CXObjCDeclQualifier_Inout = .CXObjCDeclQualifier_Inout; 5350 // alias CXObjCDeclQualifier_Out = .CXObjCDeclQualifier_Out; 5351 // alias CXObjCDeclQualifier_Bycopy = .CXObjCDeclQualifier_Bycopy; 5352 // alias CXObjCDeclQualifier_Byref = .CXObjCDeclQualifier_Byref; 5353 // alias CXObjCDeclQualifier_Oneway = .CXObjCDeclQualifier_Oneway; 5354 5355 /** 5356 * Given a cursor that represents an Objective-C method or parameter 5357 * declaration, return the associated Objective-C qualifiers for the return 5358 * type or the parameter respectively. The bits are formed from 5359 * CXObjCDeclQualifierKind. 5360 */ 5361 uint clang_Cursor_getObjCDeclQualifiers (const CXCursor C); 5362 5363 /** 5364 * Given a cursor that represents an Objective-C method or property 5365 * declaration, return non-zero if the declaration was affected by "\@optional". 5366 * Returns zero if the cursor is not such a declaration or it is "\@required". 5367 */ 5368 uint clang_Cursor_isObjCOptional (const CXCursor C); 5369 5370 /** 5371 * Returns non-zero if the given cursor is a variadic function or method. 5372 */ 5373 uint clang_Cursor_isVariadic (const CXCursor C); 5374 5375 /** 5376 * Returns non-zero if the given cursor points to a symbol marked with 5377 * external_source_symbol attribute. 5378 * 5379 * \param language If non-NULL, and the attribute is present, will be set to 5380 * the 'language' string from the attribute. 5381 * 5382 * \param definedIn If non-NULL, and the attribute is present, will be set to 5383 * the 'definedIn' string from the attribute. 5384 * 5385 * \param isGenerated If non-NULL, and the attribute is present, will be set to 5386 * non-zero if the 'generated_declaration' is set in the attribute. 5387 */ 5388 uint clang_Cursor_isExternalSymbol ( 5389 CXCursor C, 5390 CXString* language, 5391 CXString* definedIn, 5392 uint* isGenerated); 5393 5394 /** 5395 * Given a cursor that represents a declaration, return the associated 5396 * comment's source range. The range may include multiple consecutive comments 5397 * with whitespace in between. 5398 */ 5399 CXSourceRange clang_Cursor_getCommentRange (const CXCursor C); 5400 5401 /** 5402 * Given a cursor that represents a declaration, return the associated 5403 * comment text, including comment markers. 5404 */ 5405 CXString clang_Cursor_getRawCommentText (const CXCursor C) pure; 5406 5407 /** 5408 * Given a cursor that represents a documentable entity (e.g., 5409 * declaration), return the associated \paragraph; otherwise return the 5410 * first paragraph. 5411 */ 5412 CXString clang_Cursor_getBriefCommentText (const CXCursor C); 5413 5414 /** 5415 * @} 5416 */ 5417 5418 /** \defgroup CINDEX_MANGLE Name Mangling API Functions 5419 * 5420 * @{ 5421 */ 5422 5423 /** 5424 * Retrieve the CXString representing the mangled name of the cursor. 5425 */ 5426 CXString clang_Cursor_getMangling (const CXCursor) pure; 5427 5428 /** 5429 * Retrieve the CXStrings representing the mangled symbols of the C++ 5430 * constructor or destructor at the cursor. 5431 */ 5432 CXStringSet* clang_Cursor_getCXXManglings (const CXCursor) pure; 5433 5434 /** 5435 * Retrieve the CXStrings representing the mangled symbols of the ObjC 5436 * class interface or implementation at the cursor. 5437 */ 5438 CXStringSet* clang_Cursor_getObjCManglings (const CXCursor); 5439 5440 /** 5441 * @} 5442 */ 5443 5444 /** 5445 * \defgroup CINDEX_MODULE Module introspection 5446 * 5447 * The functions in this group provide access to information about modules. 5448 * 5449 * @{ 5450 */ 5451 5452 alias CXModule = void*; 5453 5454 /** 5455 * Given a CXCursor_ModuleImportDecl cursor, return the associated module. 5456 */ 5457 CXModule clang_Cursor_getModule (const CXCursor C); 5458 5459 /** 5460 * Given a CXFile header file, return the module that contains it, if one 5461 * exists. 5462 */ 5463 CXModule clang_getModuleForFile (const CXTranslationUnit, CXFile); 5464 5465 /** 5466 * \param Module a module object. 5467 * 5468 * \returns the module file where the provided module object came from. 5469 */ 5470 CXFile clang_Module_getASTFile (const CXModule Module); 5471 5472 /** 5473 * \param Module a module object. 5474 * 5475 * \returns the parent of a sub-module or NULL if the given module is top-level, 5476 * e.g. for 'std.vector' it will return the 'std' module. 5477 */ 5478 CXModule clang_Module_getParent (const CXModule Module); 5479 5480 /** 5481 * \param Module a module object. 5482 * 5483 * \returns the name of the module, e.g. for the 'std.vector' sub-module it 5484 * will return "vector". 5485 */ 5486 CXString clang_Module_getName (const CXModule Module); 5487 5488 /** 5489 * \param Module a module object. 5490 * 5491 * \returns the full name of the module, e.g. "std.vector". 5492 */ 5493 CXString clang_Module_getFullName (const CXModule Module); 5494 5495 /** 5496 * \param Module a module object. 5497 * 5498 * \returns non-zero if the module is a system one. 5499 */ 5500 int clang_Module_isSystem (const CXModule Module); 5501 5502 /** 5503 * \param Module a module object. 5504 * 5505 * \returns the number of top level headers associated with this module. 5506 */ 5507 uint clang_Module_getNumTopLevelHeaders (const CXTranslationUnit, CXModule Module); 5508 5509 /** 5510 * \param Module a module object. 5511 * 5512 * \param Index top level header index (zero-based). 5513 * 5514 * \returns the specified top level header associated with the module. 5515 */ 5516 CXFile clang_Module_getTopLevelHeader ( 5517 CXTranslationUnit, 5518 CXModule Module, 5519 uint Index); 5520 5521 /** 5522 * @} 5523 */ 5524 5525 /** 5526 * \defgroup CINDEX_CPP C++ AST introspection 5527 * 5528 * The routines in this group provide access information in the ASTs specific 5529 * to C++ language features. 5530 * 5531 * @{ 5532 */ 5533 5534 /** 5535 * Determine if a C++ constructor is a converting constructor. 5536 */ 5537 uint clang_CXXConstructor_isConvertingConstructor (const CXCursor C); 5538 5539 /** 5540 * Determine if a C++ constructor is a copy constructor. 5541 */ 5542 uint clang_CXXConstructor_isCopyConstructor (const CXCursor C) pure; 5543 5544 /** 5545 * Determine if a C++ constructor is the default constructor. 5546 */ 5547 uint clang_CXXConstructor_isDefaultConstructor (const CXCursor C); 5548 5549 /** 5550 * Determine if a C++ constructor is a move constructor. 5551 */ 5552 uint clang_CXXConstructor_isMoveConstructor (const CXCursor C) pure; 5553 5554 /** 5555 * Determine if a C++ field is declared 'mutable'. 5556 */ 5557 uint clang_CXXField_isMutable (const CXCursor C); 5558 5559 /** 5560 * Determine if a C++ method is declared '= default'. 5561 */ 5562 uint clang_CXXMethod_isDefaulted (const CXCursor C); 5563 5564 /** 5565 * Determine if a C++ member function or member function template is 5566 * pure virtual. 5567 */ 5568 uint clang_CXXMethod_isPureVirtual (const CXCursor C) pure; 5569 5570 /** 5571 * Determine if a C++ member function or member function template is 5572 * declared 'static'. 5573 */ 5574 uint clang_CXXMethod_isStatic (const CXCursor C); 5575 5576 /** 5577 * Determine if a C++ member function or member function template is 5578 * explicitly declared 'virtual' or if it overrides a virtual method from 5579 * one of the base classes. 5580 */ 5581 uint clang_CXXMethod_isVirtual (const CXCursor C) pure; 5582 5583 /** 5584 * Determine if a C++ record is abstract, i.e. whether a class or struct 5585 * has a pure virtual member function. 5586 */ 5587 uint clang_CXXRecord_isAbstract (const CXCursor C); 5588 5589 /** 5590 * Determine if an enum declaration refers to a scoped enum. 5591 */ 5592 uint clang_EnumDecl_isScoped (const CXCursor C); 5593 5594 /** 5595 * Determine if a C++ member function or member function template is 5596 * declared 'const'. 5597 */ 5598 uint clang_CXXMethod_isConst (const CXCursor C) pure; 5599 5600 /** 5601 * Given a cursor that represents a template, determine 5602 * the cursor kind of the specializations would be generated by instantiating 5603 * the template. 5604 * 5605 * This routine can be used to determine what flavor of function template, 5606 * class template, or class template partial specialization is stored in the 5607 * cursor. For example, it can describe whether a class template cursor is 5608 * declared with "struct", "class" or "union". 5609 * 5610 * \param C The cursor to query. This cursor should represent a template 5611 * declaration. 5612 * 5613 * \returns The cursor kind of the specializations that would be generated 5614 * by instantiating the template \p C. If \p C is not a template, returns 5615 * \c CXCursor_NoDeclFound. 5616 */ 5617 CXCursorKind clang_getTemplateCursorKind (const CXCursor C); 5618 5619 /** 5620 * Given a cursor that may represent a specialization or instantiation 5621 * of a template, retrieve the cursor that represents the template that it 5622 * specializes or from which it was instantiated. 5623 * 5624 * This routine determines the template involved both for explicit 5625 * specializations of templates and for implicit instantiations of the template, 5626 * both of which are referred to as "specializations". For a class template 5627 * specialization (e.g., \c std::vector<bool>), this routine will return 5628 * either the primary template (\c std::vector) or, if the specialization was 5629 * instantiated from a class template partial specialization, the class template 5630 * partial specialization. For a class template partial specialization and a 5631 * function template specialization (including instantiations), this 5632 * this routine will return the specialized template. 5633 * 5634 * For members of a class template (e.g., member functions, member classes, or 5635 * static data members), returns the specialized or instantiated member. 5636 * Although not strictly "templates" in the C++ language, members of class 5637 * templates have the same notions of specializations and instantiations that 5638 * templates do, so this routine treats them similarly. 5639 * 5640 * \param C A cursor that may be a specialization of a template or a member 5641 * of a template. 5642 * 5643 * \returns If the given cursor is a specialization or instantiation of a 5644 * template or a member thereof, the template or member that it specializes or 5645 * from which it was instantiated. Otherwise, returns a NULL cursor. 5646 */ 5647 CXCursor clang_getSpecializedCursorTemplate (const CXCursor C) pure; 5648 5649 /** 5650 * Given a cursor that references something else, return the source range 5651 * covering that reference. 5652 * 5653 * \param C A cursor pointing to a member reference, a declaration reference, or 5654 * an operator call. 5655 * \param NameFlags A bitset with three independent flags: 5656 * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and 5657 * CXNameRange_WantSinglePiece. 5658 * \param PieceIndex For contiguous names or when passing the flag 5659 * CXNameRange_WantSinglePiece, only one piece with index 0 is 5660 * available. When the CXNameRange_WantSinglePiece flag is not passed for a 5661 * non-contiguous names, this index can be used to retrieve the individual 5662 * pieces of the name. See also CXNameRange_WantSinglePiece. 5663 * 5664 * \returns The piece of the name pointed to by the given cursor. If there is no 5665 * name, or if the PieceIndex is out-of-range, a null-cursor will be returned. 5666 */ 5667 CXSourceRange clang_getCursorReferenceNameRange ( 5668 CXCursor C, 5669 uint NameFlags, 5670 uint PieceIndex); 5671 5672 enum CXNameRefFlags 5673 { 5674 /** 5675 * Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the 5676 * range. 5677 */ 5678 CXNameRange_WantQualifier = 0x1, 5679 5680 /** 5681 * Include the explicit template arguments, e.g. \<int> in x.f<int>, 5682 * in the range. 5683 */ 5684 CXNameRange_WantTemplateArgs = 0x2, 5685 5686 /** 5687 * If the name is non-contiguous, return the full spanning range. 5688 * 5689 * Non-contiguous names occur in Objective-C when a selector with two or more 5690 * parameters is used, or in C++ when using an operator: 5691 * \code 5692 * [object doSomething:here withValue:there]; // Objective-C 5693 * return some_vector[1]; // C++ 5694 * \endcode 5695 */ 5696 CXNameRange_WantSinglePiece = 0x4 5697 } 5698 5699 alias CXNameRange_WantQualifier = CXNameRefFlags.CXNameRange_WantQualifier; 5700 alias CXNameRange_WantTemplateArgs = CXNameRefFlags.CXNameRange_WantTemplateArgs; 5701 alias CXNameRange_WantSinglePiece = CXNameRefFlags.CXNameRange_WantSinglePiece; 5702 5703 /** 5704 * @} 5705 */ 5706 5707 /** 5708 * \defgroup CINDEX_LEX Token extraction and manipulation 5709 * 5710 * The routines in this group provide access to the tokens within a 5711 * translation unit, along with a semantic mapping of those tokens to 5712 * their corresponding cursors. 5713 * 5714 * @{ 5715 */ 5716 5717 /** 5718 * Describes a kind of token. 5719 */ 5720 enum CXTokenKind 5721 { 5722 /** 5723 * A token that contains some kind of punctuation. 5724 */ 5725 CXToken_Punctuation = 0, 5726 5727 /** 5728 * A language keyword. 5729 */ 5730 CXToken_Keyword = 1, 5731 5732 /** 5733 * An identifier (that is not a keyword). 5734 */ 5735 CXToken_Identifier = 2, 5736 5737 /** 5738 * A numeric, string, or character literal. 5739 */ 5740 CXToken_Literal = 3, 5741 5742 /** 5743 * A comment. 5744 */ 5745 CXToken_Comment = 4 5746 } 5747 5748 alias CXToken_Punctuation = CXTokenKind.CXToken_Punctuation; 5749 alias CXToken_Keyword = CXTokenKind.CXToken_Keyword; 5750 alias CXToken_Identifier = CXTokenKind.CXToken_Identifier; 5751 alias CXToken_Literal = CXTokenKind.CXToken_Literal; 5752 alias CXToken_Comment = CXTokenKind.CXToken_Comment; 5753 5754 /** 5755 * Describes a single preprocessing token. 5756 */ 5757 struct CXToken 5758 { 5759 uint[4] int_data; 5760 void* ptr_data; 5761 } 5762 5763 /** 5764 * Get the raw lexical token starting with the given location. 5765 * 5766 * \param TU the translation unit whose text is being tokenized. 5767 * 5768 * \param Location the source location with which the token starts. 5769 * 5770 * \returns The token starting with the given location or NULL if no such token 5771 * exist. The returned pointer must be freed with clang_disposeTokens before the 5772 * translation unit is destroyed. 5773 */ 5774 CXToken* clang_getToken (const CXTranslationUnit TU, CXSourceLocation Location); 5775 5776 /** 5777 * Determine the kind of the given token. 5778 */ 5779 CXTokenKind clang_getTokenKind (const CXToken); 5780 5781 /** 5782 * Determine the spelling of the given token. 5783 * 5784 * The spelling of a token is the textual representation of that token, e.g., 5785 * the text of an identifier or keyword. 5786 */ 5787 CXString clang_getTokenSpelling (const CXTranslationUnit, CXToken); 5788 5789 /** 5790 * Retrieve the source location of the given token. 5791 */ 5792 CXSourceLocation clang_getTokenLocation (const CXTranslationUnit, CXToken); 5793 5794 /** 5795 * Retrieve a source range that covers the given token. 5796 */ 5797 CXSourceRange clang_getTokenExtent (const CXTranslationUnit, CXToken); 5798 5799 /** 5800 * Tokenize the source code described by the given range into raw 5801 * lexical tokens. 5802 * 5803 * \param TU the translation unit whose text is being tokenized. 5804 * 5805 * \param Range the source range in which text should be tokenized. All of the 5806 * tokens produced by tokenization will fall within this source range, 5807 * 5808 * \param Tokens this pointer will be set to point to the array of tokens 5809 * that occur within the given source range. The returned pointer must be 5810 * freed with clang_disposeTokens() before the translation unit is destroyed. 5811 * 5812 * \param NumTokens will be set to the number of tokens in the \c *Tokens 5813 * array. 5814 * 5815 */ 5816 void clang_tokenize ( 5817 CXTranslationUnit TU, 5818 CXSourceRange Range, 5819 CXToken** Tokens, 5820 uint* NumTokens); 5821 5822 /** 5823 * Annotate the given set of tokens by providing cursors for each token 5824 * that can be mapped to a specific entity within the abstract syntax tree. 5825 * 5826 * This token-annotation routine is equivalent to invoking 5827 * clang_getCursor() for the source locations of each of the 5828 * tokens. The cursors provided are filtered, so that only those 5829 * cursors that have a direct correspondence to the token are 5830 * accepted. For example, given a function call \c f(x), 5831 * clang_getCursor() would provide the following cursors: 5832 * 5833 * * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'. 5834 * * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'. 5835 * * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'. 5836 * 5837 * Only the first and last of these cursors will occur within the 5838 * annotate, since the tokens "f" and "x' directly refer to a function 5839 * and a variable, respectively, but the parentheses are just a small 5840 * part of the full syntax of the function call expression, which is 5841 * not provided as an annotation. 5842 * 5843 * \param TU the translation unit that owns the given tokens. 5844 * 5845 * \param Tokens the set of tokens to annotate. 5846 * 5847 * \param NumTokens the number of tokens in \p Tokens. 5848 * 5849 * \param Cursors an array of \p NumTokens cursors, whose contents will be 5850 * replaced with the cursors corresponding to each token. 5851 */ 5852 void clang_annotateTokens ( 5853 CXTranslationUnit TU, 5854 CXToken* Tokens, 5855 uint NumTokens, 5856 CXCursor* Cursors); 5857 5858 /** 5859 * Free the given set of tokens. 5860 */ 5861 void clang_disposeTokens ( 5862 CXTranslationUnit TU, 5863 CXToken* Tokens, 5864 uint NumTokens); 5865 5866 /** 5867 * @} 5868 */ 5869 5870 /** 5871 * \defgroup CINDEX_DEBUG Debugging facilities 5872 * 5873 * These routines are used for testing and debugging, only, and should not 5874 * be relied upon. 5875 * 5876 * @{ 5877 */ 5878 5879 /* for debug/testing */ 5880 CXString clang_getCursorKindSpelling (const CXCursorKind Kind); 5881 void clang_getDefinitionSpellingAndExtent ( 5882 CXCursor, 5883 const(char*)* startBuf, 5884 const(char*)* endBuf, 5885 uint* startLine, 5886 uint* startColumn, 5887 uint* endLine, 5888 uint* endColumn); 5889 void clang_enableStackTraces (); 5890 void clang_executeOnThread ( 5891 void function (void*) fn, 5892 void* user_data, 5893 uint stack_size); 5894 5895 /** 5896 * @} 5897 */ 5898 5899 /** 5900 * \defgroup CINDEX_CODE_COMPLET Code completion 5901 * 5902 * Code completion involves taking an (incomplete) source file, along with 5903 * knowledge of where the user is actively editing that file, and suggesting 5904 * syntactically- and semantically-valid constructs that the user might want to 5905 * use at that particular point in the source code. These data structures and 5906 * routines provide support for code completion. 5907 * 5908 * @{ 5909 */ 5910 5911 /** 5912 * A semantic string that describes a code-completion result. 5913 * 5914 * A semantic string that describes the formatting of a code-completion 5915 * result as a single "template" of text that should be inserted into the 5916 * source buffer when a particular code-completion result is selected. 5917 * Each semantic string is made up of some number of "chunks", each of which 5918 * contains some text along with a description of what that text means, e.g., 5919 * the name of the entity being referenced, whether the text chunk is part of 5920 * the template, or whether it is a "placeholder" that the user should replace 5921 * with actual code,of a specific kind. See \c CXCompletionChunkKind for a 5922 * description of the different kinds of chunks. 5923 */ 5924 alias CXCompletionString = void*; 5925 5926 /** 5927 * A single result of code completion. 5928 */ 5929 struct CXCompletionResult 5930 { 5931 /** 5932 * The kind of entity that this completion refers to. 5933 * 5934 * The cursor kind will be a macro, keyword, or a declaration (one of the 5935 * *Decl cursor kinds), describing the entity that the completion is 5936 * referring to. 5937 * 5938 * \todo In the future, we would like to provide a full cursor, to allow 5939 * the client to extract additional information from declaration. 5940 */ 5941 CXCursorKind CursorKind; 5942 5943 /** 5944 * The code-completion string that describes how to insert this 5945 * code-completion result into the editing buffer. 5946 */ 5947 CXCompletionString CompletionString; 5948 } 5949 5950 /** 5951 * Describes a single piece of text within a code-completion string. 5952 * 5953 * Each "chunk" within a code-completion string (\c CXCompletionString) is 5954 * either a piece of text with a specific "kind" that describes how that text 5955 * should be interpreted by the client or is another completion string. 5956 */ 5957 enum CXCompletionChunkKind 5958 { 5959 /** 5960 * A code-completion string that describes "optional" text that 5961 * could be a part of the template (but is not required). 5962 * 5963 * The Optional chunk is the only kind of chunk that has a code-completion 5964 * string for its representation, which is accessible via 5965 * \c clang_getCompletionChunkCompletionString(). The code-completion string 5966 * describes an additional part of the template that is completely optional. 5967 * For example, optional chunks can be used to describe the placeholders for 5968 * arguments that match up with defaulted function parameters, e.g. given: 5969 * 5970 * \code 5971 * void f(int x, float y = 3.14, double z = 2.71828); 5972 * \endcode 5973 * 5974 * The code-completion string for this function would contain: 5975 * - a TypedText chunk for "f". 5976 * - a LeftParen chunk for "(". 5977 * - a Placeholder chunk for "int x" 5978 * - an Optional chunk containing the remaining defaulted arguments, e.g., 5979 * - a Comma chunk for "," 5980 * - a Placeholder chunk for "float y" 5981 * - an Optional chunk containing the last defaulted argument: 5982 * - a Comma chunk for "," 5983 * - a Placeholder chunk for "double z" 5984 * - a RightParen chunk for ")" 5985 * 5986 * There are many ways to handle Optional chunks. Two simple approaches are: 5987 * - Completely ignore optional chunks, in which case the template for the 5988 * function "f" would only include the first parameter ("int x"). 5989 * - Fully expand all optional chunks, in which case the template for the 5990 * function "f" would have all of the parameters. 5991 */ 5992 CXCompletionChunk_Optional = 0, 5993 /** 5994 * Text that a user would be expected to type to get this 5995 * code-completion result. 5996 * 5997 * There will be exactly one "typed text" chunk in a semantic string, which 5998 * will typically provide the spelling of a keyword or the name of a 5999 * declaration that could be used at the current code point. Clients are 6000 * expected to filter the code-completion results based on the text in this 6001 * chunk. 6002 */ 6003 CXCompletionChunk_TypedText = 1, 6004 /** 6005 * Text that should be inserted as part of a code-completion result. 6006 * 6007 * A "text" chunk represents text that is part of the template to be 6008 * inserted into user code should this particular code-completion result 6009 * be selected. 6010 */ 6011 CXCompletionChunk_Text = 2, 6012 /** 6013 * Placeholder text that should be replaced by the user. 6014 * 6015 * A "placeholder" chunk marks a place where the user should insert text 6016 * into the code-completion template. For example, placeholders might mark 6017 * the function parameters for a function declaration, to indicate that the 6018 * user should provide arguments for each of those parameters. The actual 6019 * text in a placeholder is a suggestion for the text to display before 6020 * the user replaces the placeholder with real code. 6021 */ 6022 CXCompletionChunk_Placeholder = 3, 6023 /** 6024 * Informative text that should be displayed but never inserted as 6025 * part of the template. 6026 * 6027 * An "informative" chunk contains annotations that can be displayed to 6028 * help the user decide whether a particular code-completion result is the 6029 * right option, but which is not part of the actual template to be inserted 6030 * by code completion. 6031 */ 6032 CXCompletionChunk_Informative = 4, 6033 /** 6034 * Text that describes the current parameter when code-completion is 6035 * referring to function call, message send, or template specialization. 6036 * 6037 * A "current parameter" chunk occurs when code-completion is providing 6038 * information about a parameter corresponding to the argument at the 6039 * code-completion point. For example, given a function 6040 * 6041 * \code 6042 * int add(int x, int y); 6043 * \endcode 6044 * 6045 * and the source code \c add(, where the code-completion point is after the 6046 * "(", the code-completion string will contain a "current parameter" chunk 6047 * for "int x", indicating that the current argument will initialize that 6048 * parameter. After typing further, to \c add(17, (where the code-completion 6049 * point is after the ","), the code-completion string will contain a 6050 * "current parameter" chunk to "int y". 6051 */ 6052 CXCompletionChunk_CurrentParameter = 5, 6053 /** 6054 * A left parenthesis ('('), used to initiate a function call or 6055 * signal the beginning of a function parameter list. 6056 */ 6057 CXCompletionChunk_LeftParen = 6, 6058 /** 6059 * A right parenthesis (')'), used to finish a function call or 6060 * signal the end of a function parameter list. 6061 */ 6062 CXCompletionChunk_RightParen = 7, 6063 /** 6064 * A left bracket ('['). 6065 */ 6066 CXCompletionChunk_LeftBracket = 8, 6067 /** 6068 * A right bracket (']'). 6069 */ 6070 CXCompletionChunk_RightBracket = 9, 6071 /** 6072 * A left brace ('{'). 6073 */ 6074 CXCompletionChunk_LeftBrace = 10, 6075 /** 6076 * A right brace ('}'). 6077 */ 6078 CXCompletionChunk_RightBrace = 11, 6079 /** 6080 * A left angle bracket ('<'). 6081 */ 6082 CXCompletionChunk_LeftAngle = 12, 6083 /** 6084 * A right angle bracket ('>'). 6085 */ 6086 CXCompletionChunk_RightAngle = 13, 6087 /** 6088 * A comma separator (','). 6089 */ 6090 CXCompletionChunk_Comma = 14, 6091 /** 6092 * Text that specifies the result type of a given result. 6093 * 6094 * This special kind of informative chunk is not meant to be inserted into 6095 * the text buffer. Rather, it is meant to illustrate the type that an 6096 * expression using the given completion string would have. 6097 */ 6098 CXCompletionChunk_ResultType = 15, 6099 /** 6100 * A colon (':'). 6101 */ 6102 CXCompletionChunk_Colon = 16, 6103 /** 6104 * A semicolon (';'). 6105 */ 6106 CXCompletionChunk_SemiColon = 17, 6107 /** 6108 * An '=' sign. 6109 */ 6110 CXCompletionChunk_Equal = 18, 6111 /** 6112 * Horizontal space (' '). 6113 */ 6114 CXCompletionChunk_HorizontalSpace = 19, 6115 /** 6116 * Vertical space ('\\n'), after which it is generally a good idea to 6117 * perform indentation. 6118 */ 6119 CXCompletionChunk_VerticalSpace = 20 6120 } 6121 6122 alias CXCompletionChunk_Optional = CXCompletionChunkKind.CXCompletionChunk_Optional; 6123 alias CXCompletionChunk_TypedText = CXCompletionChunkKind.CXCompletionChunk_TypedText; 6124 alias CXCompletionChunk_Text = CXCompletionChunkKind.CXCompletionChunk_Text; 6125 alias CXCompletionChunk_Placeholder = CXCompletionChunkKind.CXCompletionChunk_Placeholder; 6126 alias CXCompletionChunk_Informative = CXCompletionChunkKind.CXCompletionChunk_Informative; 6127 alias CXCompletionChunk_CurrentParameter = CXCompletionChunkKind.CXCompletionChunk_CurrentParameter; 6128 alias CXCompletionChunk_LeftParen = CXCompletionChunkKind.CXCompletionChunk_LeftParen; 6129 alias CXCompletionChunk_RightParen = CXCompletionChunkKind.CXCompletionChunk_RightParen; 6130 alias CXCompletionChunk_LeftBracket = CXCompletionChunkKind.CXCompletionChunk_LeftBracket; 6131 alias CXCompletionChunk_RightBracket = CXCompletionChunkKind.CXCompletionChunk_RightBracket; 6132 alias CXCompletionChunk_LeftBrace = CXCompletionChunkKind.CXCompletionChunk_LeftBrace; 6133 alias CXCompletionChunk_RightBrace = CXCompletionChunkKind.CXCompletionChunk_RightBrace; 6134 alias CXCompletionChunk_LeftAngle = CXCompletionChunkKind.CXCompletionChunk_LeftAngle; 6135 alias CXCompletionChunk_RightAngle = CXCompletionChunkKind.CXCompletionChunk_RightAngle; 6136 alias CXCompletionChunk_Comma = CXCompletionChunkKind.CXCompletionChunk_Comma; 6137 alias CXCompletionChunk_ResultType = CXCompletionChunkKind.CXCompletionChunk_ResultType; 6138 alias CXCompletionChunk_Colon = CXCompletionChunkKind.CXCompletionChunk_Colon; 6139 alias CXCompletionChunk_SemiColon = CXCompletionChunkKind.CXCompletionChunk_SemiColon; 6140 alias CXCompletionChunk_Equal = CXCompletionChunkKind.CXCompletionChunk_Equal; 6141 alias CXCompletionChunk_HorizontalSpace = CXCompletionChunkKind.CXCompletionChunk_HorizontalSpace; 6142 alias CXCompletionChunk_VerticalSpace = CXCompletionChunkKind.CXCompletionChunk_VerticalSpace; 6143 6144 /** 6145 * Determine the kind of a particular chunk within a completion string. 6146 * 6147 * \param completion_string the completion string to query. 6148 * 6149 * \param chunk_number the 0-based index of the chunk in the completion string. 6150 * 6151 * \returns the kind of the chunk at the index \c chunk_number. 6152 */ 6153 CXCompletionChunkKind clang_getCompletionChunkKind ( 6154 CXCompletionString completion_string, 6155 uint chunk_number); 6156 6157 /** 6158 * Retrieve the text associated with a particular chunk within a 6159 * completion string. 6160 * 6161 * \param completion_string the completion string to query. 6162 * 6163 * \param chunk_number the 0-based index of the chunk in the completion string. 6164 * 6165 * \returns the text associated with the chunk at index \c chunk_number. 6166 */ 6167 CXString clang_getCompletionChunkText ( 6168 CXCompletionString completion_string, 6169 uint chunk_number); 6170 6171 /** 6172 * Retrieve the completion string associated with a particular chunk 6173 * within a completion string. 6174 * 6175 * \param completion_string the completion string to query. 6176 * 6177 * \param chunk_number the 0-based index of the chunk in the completion string. 6178 * 6179 * \returns the completion string associated with the chunk at index 6180 * \c chunk_number. 6181 */ 6182 CXCompletionString clang_getCompletionChunkCompletionString ( 6183 CXCompletionString completion_string, 6184 uint chunk_number); 6185 6186 /** 6187 * Retrieve the number of chunks in the given code-completion string. 6188 */ 6189 uint clang_getNumCompletionChunks (const CXCompletionString completion_string); 6190 6191 /** 6192 * Determine the priority of this code completion. 6193 * 6194 * The priority of a code completion indicates how likely it is that this 6195 * particular completion is the completion that the user will select. The 6196 * priority is selected by various internal heuristics. 6197 * 6198 * \param completion_string The completion string to query. 6199 * 6200 * \returns The priority of this completion string. Smaller values indicate 6201 * higher-priority (more likely) completions. 6202 */ 6203 uint clang_getCompletionPriority (const CXCompletionString completion_string); 6204 6205 /** 6206 * Determine the availability of the entity that this code-completion 6207 * string refers to. 6208 * 6209 * \param completion_string The completion string to query. 6210 * 6211 * \returns The availability of the completion string. 6212 */ 6213 CXAvailabilityKind clang_getCompletionAvailability ( 6214 CXCompletionString completion_string); 6215 6216 /** 6217 * Retrieve the number of annotations associated with the given 6218 * completion string. 6219 * 6220 * \param completion_string the completion string to query. 6221 * 6222 * \returns the number of annotations associated with the given completion 6223 * string. 6224 */ 6225 uint clang_getCompletionNumAnnotations (const CXCompletionString completion_string); 6226 6227 /** 6228 * Retrieve the annotation associated with the given completion string. 6229 * 6230 * \param completion_string the completion string to query. 6231 * 6232 * \param annotation_number the 0-based index of the annotation of the 6233 * completion string. 6234 * 6235 * \returns annotation string associated with the completion at index 6236 * \c annotation_number, or a NULL string if that annotation is not available. 6237 */ 6238 CXString clang_getCompletionAnnotation ( 6239 CXCompletionString completion_string, 6240 uint annotation_number); 6241 6242 /** 6243 * Retrieve the parent context of the given completion string. 6244 * 6245 * The parent context of a completion string is the semantic parent of 6246 * the declaration (if any) that the code completion represents. For example, 6247 * a code completion for an Objective-C method would have the method's class 6248 * or protocol as its context. 6249 * 6250 * \param completion_string The code completion string whose parent is 6251 * being queried. 6252 * 6253 * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL. 6254 * 6255 * \returns The name of the completion parent, e.g., "NSObject" if 6256 * the completion string represents a method in the NSObject class. 6257 */ 6258 CXString clang_getCompletionParent ( 6259 CXCompletionString completion_string, 6260 CXCursorKind* kind); 6261 6262 /** 6263 * Retrieve the brief documentation comment attached to the declaration 6264 * that corresponds to the given completion string. 6265 */ 6266 CXString clang_getCompletionBriefComment (const CXCompletionString completion_string); 6267 6268 /** 6269 * Retrieve a completion string for an arbitrary declaration or macro 6270 * definition cursor. 6271 * 6272 * \param cursor The cursor to query. 6273 * 6274 * \returns A non-context-sensitive completion string for declaration and macro 6275 * definition cursors, or NULL for other kinds of cursors. 6276 */ 6277 CXCompletionString clang_getCursorCompletionString (const CXCursor cursor); 6278 6279 /** 6280 * Contains the results of code-completion. 6281 * 6282 * This data structure contains the results of code completion, as 6283 * produced by \c clang_codeCompleteAt(). Its contents must be freed by 6284 * \c clang_disposeCodeCompleteResults. 6285 */ 6286 struct CXCodeCompleteResults 6287 { 6288 /** 6289 * The code-completion results. 6290 */ 6291 CXCompletionResult* Results; 6292 6293 /** 6294 * The number of code-completion results stored in the 6295 * \c Results array. 6296 */ 6297 uint NumResults; 6298 } 6299 6300 /** 6301 * Retrieve the number of fix-its for the given completion index. 6302 * 6303 * Calling this makes sense only if CXCodeComplete_IncludeCompletionsWithFixIts 6304 * option was set. 6305 * 6306 * \param results The structure keeping all completion results 6307 * 6308 * \param completion_index The index of the completion 6309 * 6310 * \return The number of fix-its which must be applied before the completion at 6311 * completion_index can be applied 6312 */ 6313 uint clang_getCompletionNumFixIts ( 6314 CXCodeCompleteResults* results, 6315 uint completion_index); 6316 6317 /** 6318 * Fix-its that *must* be applied before inserting the text for the 6319 * corresponding completion. 6320 * 6321 * By default, clang_codeCompleteAt() only returns completions with empty 6322 * fix-its. Extra completions with non-empty fix-its should be explicitly 6323 * requested by setting CXCodeComplete_IncludeCompletionsWithFixIts. 6324 * 6325 * For the clients to be able to compute position of the cursor after applying 6326 * fix-its, the following conditions are guaranteed to hold for 6327 * replacement_range of the stored fix-its: 6328 * - Ranges in the fix-its are guaranteed to never contain the completion 6329 * point (or identifier under completion point, if any) inside them, except 6330 * at the start or at the end of the range. 6331 * - If a fix-it range starts or ends with completion point (or starts or 6332 * ends after the identifier under completion point), it will contain at 6333 * least one character. It allows to unambiguously recompute completion 6334 * point after applying the fix-it. 6335 * 6336 * The intuition is that provided fix-its change code around the identifier we 6337 * complete, but are not allowed to touch the identifier itself or the 6338 * completion point. One example of completions with corrections are the ones 6339 * replacing '.' with '->' and vice versa: 6340 * 6341 * std::unique_ptr<std::vector<int>> vec_ptr; 6342 * In 'vec_ptr.^', one of the completions is 'push_back', it requires 6343 * replacing '.' with '->'. 6344 * In 'vec_ptr->^', one of the completions is 'release', it requires 6345 * replacing '->' with '.'. 6346 * 6347 * \param results The structure keeping all completion results 6348 * 6349 * \param completion_index The index of the completion 6350 * 6351 * \param fixit_index The index of the fix-it for the completion at 6352 * completion_index 6353 * 6354 * \param replacement_range The fix-it range that must be replaced before the 6355 * completion at completion_index can be applied 6356 * 6357 * \returns The fix-it string that must replace the code at replacement_range 6358 * before the completion at completion_index can be applied 6359 */ 6360 CXString clang_getCompletionFixIt ( 6361 CXCodeCompleteResults* results, 6362 uint completion_index, 6363 uint fixit_index, 6364 CXSourceRange* replacement_range); 6365 6366 /** 6367 * Flags that can be passed to \c clang_codeCompleteAt() to 6368 * modify its behavior. 6369 * 6370 * The enumerators in this enumeration can be bitwise-OR'd together to 6371 * provide multiple options to \c clang_codeCompleteAt(). 6372 */ 6373 enum CXCodeComplete_Flags 6374 { 6375 /** 6376 * Whether to include macros within the set of code 6377 * completions returned. 6378 */ 6379 CXCodeComplete_IncludeMacros = 0x01, 6380 6381 /** 6382 * Whether to include code patterns for language constructs 6383 * within the set of code completions, e.g., for loops. 6384 */ 6385 CXCodeComplete_IncludeCodePatterns = 0x02, 6386 6387 /** 6388 * Whether to include brief documentation within the set of code 6389 * completions returned. 6390 */ 6391 CXCodeComplete_IncludeBriefComments = 0x04, 6392 6393 /** 6394 * Whether to speed up completion by omitting top- or namespace-level entities 6395 * defined in the preamble. There's no guarantee any particular entity is 6396 * omitted. This may be useful if the headers are indexed externally. 6397 */ 6398 CXCodeComplete_SkipPreamble = 0x08, 6399 6400 /** 6401 * Whether to include completions with small 6402 * fix-its, e.g. change '.' to '->' on member access, etc. 6403 */ 6404 CXCodeComplete_IncludeCompletionsWithFixIts = 0x10 6405 } 6406 6407 alias CXCodeComplete_IncludeMacros = CXCodeComplete_Flags.CXCodeComplete_IncludeMacros; 6408 alias CXCodeComplete_IncludeCodePatterns = CXCodeComplete_Flags.CXCodeComplete_IncludeCodePatterns; 6409 alias CXCodeComplete_IncludeBriefComments = CXCodeComplete_Flags.CXCodeComplete_IncludeBriefComments; 6410 alias CXCodeComplete_SkipPreamble = CXCodeComplete_Flags.CXCodeComplete_SkipPreamble; 6411 alias CXCodeComplete_IncludeCompletionsWithFixIts = CXCodeComplete_Flags.CXCodeComplete_IncludeCompletionsWithFixIts; 6412 6413 /** 6414 * Bits that represent the context under which completion is occurring. 6415 * 6416 * The enumerators in this enumeration may be bitwise-OR'd together if multiple 6417 * contexts are occurring simultaneously. 6418 */ 6419 enum CXCompletionContext 6420 { 6421 /** 6422 * The context for completions is unexposed, as only Clang results 6423 * should be included. (This is equivalent to having no context bits set.) 6424 */ 6425 CXCompletionContext_Unexposed = 0, 6426 6427 /** 6428 * Completions for any possible type should be included in the results. 6429 */ 6430 CXCompletionContext_AnyType = 1 << 0, 6431 6432 /** 6433 * Completions for any possible value (variables, function calls, etc.) 6434 * should be included in the results. 6435 */ 6436 CXCompletionContext_AnyValue = 1 << 1, 6437 /** 6438 * Completions for values that resolve to an Objective-C object should 6439 * be included in the results. 6440 */ 6441 CXCompletionContext_ObjCObjectValue = 1 << 2, 6442 /** 6443 * Completions for values that resolve to an Objective-C selector 6444 * should be included in the results. 6445 */ 6446 CXCompletionContext_ObjCSelectorValue = 1 << 3, 6447 /** 6448 * Completions for values that resolve to a C++ class type should be 6449 * included in the results. 6450 */ 6451 CXCompletionContext_CXXClassTypeValue = 1 << 4, 6452 6453 /** 6454 * Completions for fields of the member being accessed using the dot 6455 * operator should be included in the results. 6456 */ 6457 CXCompletionContext_DotMemberAccess = 1 << 5, 6458 /** 6459 * Completions for fields of the member being accessed using the arrow 6460 * operator should be included in the results. 6461 */ 6462 CXCompletionContext_ArrowMemberAccess = 1 << 6, 6463 /** 6464 * Completions for properties of the Objective-C object being accessed 6465 * using the dot operator should be included in the results. 6466 */ 6467 CXCompletionContext_ObjCPropertyAccess = 1 << 7, 6468 6469 /** 6470 * Completions for enum tags should be included in the results. 6471 */ 6472 CXCompletionContext_EnumTag = 1 << 8, 6473 /** 6474 * Completions for union tags should be included in the results. 6475 */ 6476 CXCompletionContext_UnionTag = 1 << 9, 6477 /** 6478 * Completions for struct tags should be included in the results. 6479 */ 6480 CXCompletionContext_StructTag = 1 << 10, 6481 6482 /** 6483 * Completions for C++ class names should be included in the results. 6484 */ 6485 CXCompletionContext_ClassTag = 1 << 11, 6486 /** 6487 * Completions for C++ namespaces and namespace aliases should be 6488 * included in the results. 6489 */ 6490 CXCompletionContext_Namespace = 1 << 12, 6491 /** 6492 * Completions for C++ nested name specifiers should be included in 6493 * the results. 6494 */ 6495 CXCompletionContext_NestedNameSpecifier = 1 << 13, 6496 6497 /** 6498 * Completions for Objective-C interfaces (classes) should be included 6499 * in the results. 6500 */ 6501 CXCompletionContext_ObjCInterface = 1 << 14, 6502 /** 6503 * Completions for Objective-C protocols should be included in 6504 * the results. 6505 */ 6506 CXCompletionContext_ObjCProtocol = 1 << 15, 6507 /** 6508 * Completions for Objective-C categories should be included in 6509 * the results. 6510 */ 6511 CXCompletionContext_ObjCCategory = 1 << 16, 6512 /** 6513 * Completions for Objective-C instance messages should be included 6514 * in the results. 6515 */ 6516 CXCompletionContext_ObjCInstanceMessage = 1 << 17, 6517 /** 6518 * Completions for Objective-C class messages should be included in 6519 * the results. 6520 */ 6521 CXCompletionContext_ObjCClassMessage = 1 << 18, 6522 /** 6523 * Completions for Objective-C selector names should be included in 6524 * the results. 6525 */ 6526 CXCompletionContext_ObjCSelectorName = 1 << 19, 6527 6528 /** 6529 * Completions for preprocessor macro names should be included in 6530 * the results. 6531 */ 6532 CXCompletionContext_MacroName = 1 << 20, 6533 6534 /** 6535 * Natural language completions should be included in the results. 6536 */ 6537 CXCompletionContext_NaturalLanguage = 1 << 21, 6538 6539 /** 6540 * #include file completions should be included in the results. 6541 */ 6542 CXCompletionContext_IncludedFile = 1 << 22, 6543 6544 /** 6545 * The current context is unknown, so set all contexts. 6546 */ 6547 CXCompletionContext_Unknown = (1 << 23) - 1 6548 } 6549 6550 alias CXCompletionContext_Unexposed = CXCompletionContext.CXCompletionContext_Unexposed; 6551 alias CXCompletionContext_AnyType = CXCompletionContext.CXCompletionContext_AnyType; 6552 alias CXCompletionContext_AnyValue = CXCompletionContext.CXCompletionContext_AnyValue; 6553 alias CXCompletionContext_ObjCObjectValue = CXCompletionContext.CXCompletionContext_ObjCObjectValue; 6554 alias CXCompletionContext_ObjCSelectorValue = CXCompletionContext.CXCompletionContext_ObjCSelectorValue; 6555 alias CXCompletionContext_CXXClassTypeValue = CXCompletionContext.CXCompletionContext_CXXClassTypeValue; 6556 alias CXCompletionContext_DotMemberAccess = CXCompletionContext.CXCompletionContext_DotMemberAccess; 6557 alias CXCompletionContext_ArrowMemberAccess = CXCompletionContext.CXCompletionContext_ArrowMemberAccess; 6558 alias CXCompletionContext_ObjCPropertyAccess = CXCompletionContext.CXCompletionContext_ObjCPropertyAccess; 6559 alias CXCompletionContext_EnumTag = CXCompletionContext.CXCompletionContext_EnumTag; 6560 alias CXCompletionContext_UnionTag = CXCompletionContext.CXCompletionContext_UnionTag; 6561 alias CXCompletionContext_StructTag = CXCompletionContext.CXCompletionContext_StructTag; 6562 alias CXCompletionContext_ClassTag = CXCompletionContext.CXCompletionContext_ClassTag; 6563 alias CXCompletionContext_Namespace = CXCompletionContext.CXCompletionContext_Namespace; 6564 alias CXCompletionContext_NestedNameSpecifier = CXCompletionContext.CXCompletionContext_NestedNameSpecifier; 6565 alias CXCompletionContext_ObjCInterface = CXCompletionContext.CXCompletionContext_ObjCInterface; 6566 alias CXCompletionContext_ObjCProtocol = CXCompletionContext.CXCompletionContext_ObjCProtocol; 6567 alias CXCompletionContext_ObjCCategory = CXCompletionContext.CXCompletionContext_ObjCCategory; 6568 alias CXCompletionContext_ObjCInstanceMessage = CXCompletionContext.CXCompletionContext_ObjCInstanceMessage; 6569 alias CXCompletionContext_ObjCClassMessage = CXCompletionContext.CXCompletionContext_ObjCClassMessage; 6570 alias CXCompletionContext_ObjCSelectorName = CXCompletionContext.CXCompletionContext_ObjCSelectorName; 6571 alias CXCompletionContext_MacroName = CXCompletionContext.CXCompletionContext_MacroName; 6572 alias CXCompletionContext_NaturalLanguage = CXCompletionContext.CXCompletionContext_NaturalLanguage; 6573 alias CXCompletionContext_IncludedFile = CXCompletionContext.CXCompletionContext_IncludedFile; 6574 alias CXCompletionContext_Unknown = CXCompletionContext.CXCompletionContext_Unknown; 6575 6576 /** 6577 * Returns a default set of code-completion options that can be 6578 * passed to\c clang_codeCompleteAt(). 6579 */ 6580 uint clang_defaultCodeCompleteOptions (); 6581 6582 /** 6583 * Perform code completion at a given location in a translation unit. 6584 * 6585 * This function performs code completion at a particular file, line, and 6586 * column within source code, providing results that suggest potential 6587 * code snippets based on the context of the completion. The basic model 6588 * for code completion is that Clang will parse a complete source file, 6589 * performing syntax checking up to the location where code-completion has 6590 * been requested. At that point, a special code-completion token is passed 6591 * to the parser, which recognizes this token and determines, based on the 6592 * current location in the C/Objective-C/C++ grammar and the state of 6593 * semantic analysis, what completions to provide. These completions are 6594 * returned via a new \c CXCodeCompleteResults structure. 6595 * 6596 * Code completion itself is meant to be triggered by the client when the 6597 * user types punctuation characters or whitespace, at which point the 6598 * code-completion location will coincide with the cursor. For example, if \c p 6599 * is a pointer, code-completion might be triggered after the "-" and then 6600 * after the ">" in \c p->. When the code-completion location is after the ">", 6601 * the completion results will provide, e.g., the members of the struct that 6602 * "p" points to. The client is responsible for placing the cursor at the 6603 * beginning of the token currently being typed, then filtering the results 6604 * based on the contents of the token. For example, when code-completing for 6605 * the expression \c p->get, the client should provide the location just after 6606 * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the 6607 * client can filter the results based on the current token text ("get"), only 6608 * showing those results that start with "get". The intent of this interface 6609 * is to separate the relatively high-latency acquisition of code-completion 6610 * results from the filtering of results on a per-character basis, which must 6611 * have a lower latency. 6612 * 6613 * \param TU The translation unit in which code-completion should 6614 * occur. The source files for this translation unit need not be 6615 * completely up-to-date (and the contents of those source files may 6616 * be overridden via \p unsaved_files). Cursors referring into the 6617 * translation unit may be invalidated by this invocation. 6618 * 6619 * \param complete_filename The name of the source file where code 6620 * completion should be performed. This filename may be any file 6621 * included in the translation unit. 6622 * 6623 * \param complete_line The line at which code-completion should occur. 6624 * 6625 * \param complete_column The column at which code-completion should occur. 6626 * Note that the column should point just after the syntactic construct that 6627 * initiated code completion, and not in the middle of a lexical token. 6628 * 6629 * \param unsaved_files the Files that have not yet been saved to disk 6630 * but may be required for parsing or code completion, including the 6631 * contents of those files. The contents and name of these files (as 6632 * specified by CXUnsavedFile) are copied when necessary, so the 6633 * client only needs to guarantee their validity until the call to 6634 * this function returns. 6635 * 6636 * \param num_unsaved_files The number of unsaved file entries in \p 6637 * unsaved_files. 6638 * 6639 * \param options Extra options that control the behavior of code 6640 * completion, expressed as a bitwise OR of the enumerators of the 6641 * CXCodeComplete_Flags enumeration. The 6642 * \c clang_defaultCodeCompleteOptions() function returns a default set 6643 * of code-completion options. 6644 * 6645 * \returns If successful, a new \c CXCodeCompleteResults structure 6646 * containing code-completion results, which should eventually be 6647 * freed with \c clang_disposeCodeCompleteResults(). If code 6648 * completion fails, returns NULL. 6649 */ 6650 CXCodeCompleteResults* clang_codeCompleteAt ( 6651 CXTranslationUnit TU, 6652 const(char)* complete_filename, 6653 uint complete_line, 6654 uint complete_column, 6655 CXUnsavedFile* unsaved_files, 6656 uint num_unsaved_files, 6657 uint options); 6658 6659 /** 6660 * Sort the code-completion results in case-insensitive alphabetical 6661 * order. 6662 * 6663 * \param Results The set of results to sort. 6664 * \param NumResults The number of results in \p Results. 6665 */ 6666 void clang_sortCodeCompletionResults ( 6667 CXCompletionResult* Results, 6668 uint NumResults); 6669 6670 /** 6671 * Free the given set of code-completion results. 6672 */ 6673 void clang_disposeCodeCompleteResults (const CXCodeCompleteResults* Results); 6674 6675 /** 6676 * Determine the number of diagnostics produced prior to the 6677 * location where code completion was performed. 6678 */ 6679 uint clang_codeCompleteGetNumDiagnostics (const CXCodeCompleteResults* Results); 6680 6681 /** 6682 * Retrieve a diagnostic associated with the given code completion. 6683 * 6684 * \param Results the code completion results to query. 6685 * \param Index the zero-based diagnostic number to retrieve. 6686 * 6687 * \returns the requested diagnostic. This diagnostic must be freed 6688 * via a call to \c clang_disposeDiagnostic(). 6689 */ 6690 CXDiagnostic clang_codeCompleteGetDiagnostic ( 6691 CXCodeCompleteResults* Results, 6692 uint Index); 6693 6694 /** 6695 * Determines what completions are appropriate for the context 6696 * the given code completion. 6697 * 6698 * \param Results the code completion results to query 6699 * 6700 * \returns the kinds of completions that are appropriate for use 6701 * along with the given code completion results. 6702 */ 6703 ulong clang_codeCompleteGetContexts (const CXCodeCompleteResults* Results); 6704 6705 /** 6706 * Returns the cursor kind for the container for the current code 6707 * completion context. The container is only guaranteed to be set for 6708 * contexts where a container exists (i.e. member accesses or Objective-C 6709 * message sends); if there is not a container, this function will return 6710 * CXCursor_InvalidCode. 6711 * 6712 * \param Results the code completion results to query 6713 * 6714 * \param IsIncomplete on return, this value will be false if Clang has complete 6715 * information about the container. If Clang does not have complete 6716 * information, this value will be true. 6717 * 6718 * \returns the container kind, or CXCursor_InvalidCode if there is not a 6719 * container 6720 */ 6721 CXCursorKind clang_codeCompleteGetContainerKind ( 6722 CXCodeCompleteResults* Results, 6723 uint* IsIncomplete); 6724 6725 /** 6726 * Returns the USR for the container for the current code completion 6727 * context. If there is not a container for the current context, this 6728 * function will return the empty string. 6729 * 6730 * \param Results the code completion results to query 6731 * 6732 * \returns the USR for the container 6733 */ 6734 CXString clang_codeCompleteGetContainerUSR (const CXCodeCompleteResults* Results); 6735 6736 /** 6737 * Returns the currently-entered selector for an Objective-C message 6738 * send, formatted like "initWithFoo:bar:". Only guaranteed to return a 6739 * non-empty string for CXCompletionContext_ObjCInstanceMessage and 6740 * CXCompletionContext_ObjCClassMessage. 6741 * 6742 * \param Results the code completion results to query 6743 * 6744 * \returns the selector (or partial selector) that has been entered thus far 6745 * for an Objective-C message send. 6746 */ 6747 CXString clang_codeCompleteGetObjCSelector (const CXCodeCompleteResults* Results); 6748 6749 /** 6750 * @} 6751 */ 6752 6753 /** 6754 * \defgroup CINDEX_MISC Miscellaneous utility functions 6755 * 6756 * @{ 6757 */ 6758 6759 /** 6760 * Return a version string, suitable for showing to a user, but not 6761 * intended to be parsed (the format is not guaranteed to be stable). 6762 */ 6763 CXString clang_getClangVersion (); 6764 6765 /** 6766 * Enable/disable crash recovery. 6767 * 6768 * \param isEnabled Flag to indicate if crash recovery is enabled. A non-zero 6769 * value enables crash recovery, while 0 disables it. 6770 */ 6771 void clang_toggleCrashRecovery (uint isEnabled); 6772 6773 /** 6774 * Visitor invoked for each file in a translation unit 6775 * (used with clang_getInclusions()). 6776 * 6777 * This visitor function will be invoked by clang_getInclusions() for each 6778 * file included (either at the top-level or by \#include directives) within 6779 * a translation unit. The first argument is the file being included, and 6780 * the second and third arguments provide the inclusion stack. The 6781 * array is sorted in order of immediate inclusion. For example, 6782 * the first element refers to the location that included 'included_file'. 6783 */ 6784 alias CXInclusionVisitor = void function ( 6785 CXFile included_file, 6786 CXSourceLocation* inclusion_stack, 6787 uint include_len, 6788 CXClientData client_data); 6789 6790 /** 6791 * Visit the set of preprocessor inclusions in a translation unit. 6792 * The visitor function is called with the provided data for every included 6793 * file. This does not include headers included by the PCH file (unless one 6794 * is inspecting the inclusions in the PCH file itself). 6795 */ 6796 void clang_getInclusions ( 6797 CXTranslationUnit tu, 6798 CXInclusionVisitor visitor, 6799 CXClientData client_data); 6800 6801 enum CXEvalResultKind 6802 { 6803 CXEval_Int = 1, 6804 CXEval_Float = 2, 6805 CXEval_ObjCStrLiteral = 3, 6806 CXEval_StrLiteral = 4, 6807 CXEval_CFStr = 5, 6808 CXEval_Other = 6, 6809 6810 CXEval_UnExposed = 0 6811 } 6812 6813 mixin EnumC!CXEvalResultKind; 6814 // alias CXEval_Int = .CXEval_Int; 6815 // alias CXEval_Float = .CXEval_Float; 6816 // alias CXEval_ObjCStrLiteral = .CXEval_ObjCStrLiteral; 6817 // alias CXEval_StrLiteral = .CXEval_StrLiteral; 6818 // alias CXEval_CFStr = .CXEval_CFStr; 6819 // alias CXEval_Other = .CXEval_Other; 6820 // alias CXEval_UnExposed = .CXEval_UnExposed; 6821 6822 /** 6823 * Evaluation result of a cursor 6824 */ 6825 alias CXEvalResult = void*; 6826 6827 /** 6828 * If cursor is a statement declaration tries to evaluate the 6829 * statement and if its variable, tries to evaluate its initializer, 6830 * into its corresponding type. 6831 * If it's an expression, tries to evaluate the expression. 6832 */ 6833 CXEvalResult clang_Cursor_Evaluate (const CXCursor C); 6834 6835 /** 6836 * Returns the kind of the evaluated result. 6837 */ 6838 CXEvalResultKind clang_EvalResult_getKind (const CXEvalResult E); 6839 6840 /** 6841 * Returns the evaluation result as integer if the 6842 * kind is Int. 6843 */ 6844 int clang_EvalResult_getAsInt (const CXEvalResult E); 6845 6846 /** 6847 * Returns the evaluation result as a long long integer if the 6848 * kind is Int. This prevents overflows that may happen if the result is 6849 * returned with clang_EvalResult_getAsInt. 6850 */ 6851 long clang_EvalResult_getAsLongLong (const CXEvalResult E); 6852 6853 /** 6854 * Returns a non-zero value if the kind is Int and the evaluation 6855 * result resulted in an unsigned integer. 6856 */ 6857 uint clang_EvalResult_isUnsignedInt (const CXEvalResult E); 6858 6859 /** 6860 * Returns the evaluation result as an unsigned integer if 6861 * the kind is Int and clang_EvalResult_isUnsignedInt is non-zero. 6862 */ 6863 ulong clang_EvalResult_getAsUnsigned (const CXEvalResult E); 6864 6865 /** 6866 * Returns the evaluation result as double if the 6867 * kind is double. 6868 */ 6869 double clang_EvalResult_getAsDouble (const CXEvalResult E); 6870 6871 /** 6872 * Returns the evaluation result as a constant string if the 6873 * kind is other than Int or float. User must not free this pointer, 6874 * instead call clang_EvalResult_dispose on the CXEvalResult returned 6875 * by clang_Cursor_Evaluate. 6876 */ 6877 const(char)* clang_EvalResult_getAsStr (const CXEvalResult E); 6878 6879 /** 6880 * Disposes the created Eval memory. 6881 */ 6882 void clang_EvalResult_dispose (const CXEvalResult E); 6883 /** 6884 * @} 6885 */ 6886 6887 /** \defgroup CINDEX_REMAPPING Remapping functions 6888 * 6889 * @{ 6890 */ 6891 6892 /** 6893 * A remapping of original source files and their translated files. 6894 */ 6895 alias CXRemapping = void*; 6896 6897 /** 6898 * Retrieve a remapping. 6899 * 6900 * \param path the path that contains metadata about remappings. 6901 * 6902 * \returns the requested remapping. This remapping must be freed 6903 * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. 6904 */ 6905 CXRemapping clang_getRemappings (const(char)* path); 6906 6907 /** 6908 * Retrieve a remapping. 6909 * 6910 * \param filePaths pointer to an array of file paths containing remapping info. 6911 * 6912 * \param numFiles number of file paths. 6913 * 6914 * \returns the requested remapping. This remapping must be freed 6915 * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. 6916 */ 6917 CXRemapping clang_getRemappingsFromFileList ( 6918 const(char*)* filePaths, 6919 uint numFiles); 6920 6921 /** 6922 * Determine the number of remappings. 6923 */ 6924 uint clang_remap_getNumFiles (const CXRemapping); 6925 6926 /** 6927 * Get the original and the associated filename from the remapping. 6928 * 6929 * \param original If non-NULL, will be set to the original filename. 6930 * 6931 * \param transformed If non-NULL, will be set to the filename that the original 6932 * is associated with. 6933 */ 6934 void clang_remap_getFilenames ( 6935 CXRemapping, 6936 uint index, 6937 CXString* original, 6938 CXString* transformed); 6939 6940 /** 6941 * Dispose the remapping. 6942 */ 6943 void clang_remap_dispose (const CXRemapping); 6944 6945 /** 6946 * @} 6947 */ 6948 6949 /** \defgroup CINDEX_HIGH Higher level API functions 6950 * 6951 * @{ 6952 */ 6953 6954 enum CXVisitorResult 6955 { 6956 CXVisit_Break = 0, 6957 CXVisit_Continue = 1 6958 } 6959 6960 alias CXVisit_Break = CXVisitorResult.CXVisit_Break; 6961 alias CXVisit_Continue = CXVisitorResult.CXVisit_Continue; 6962 6963 struct CXCursorAndRangeVisitor 6964 { 6965 void* context; 6966 CXVisitorResult function (void* context, CXCursor, CXSourceRange) visit; 6967 } 6968 6969 enum CXResult 6970 { 6971 /** 6972 * Function returned successfully. 6973 */ 6974 CXResult_Success = 0, 6975 /** 6976 * One of the parameters was invalid for the function. 6977 */ 6978 CXResult_Invalid = 1, 6979 /** 6980 * The function was terminated by a callback (e.g. it returned 6981 * CXVisit_Break) 6982 */ 6983 CXResult_VisitBreak = 2 6984 } 6985 6986 mixin EnumC!CXResult; 6987 // alias CXResult_Success = .CXResult_Success; 6988 // alias CXResult_Invalid = .CXResult_Invalid; 6989 // alias CXResult_VisitBreak = .CXResult_VisitBreak; 6990 6991 /** 6992 * Find references of a declaration in a specific file. 6993 * 6994 * \param cursor pointing to a declaration or a reference of one. 6995 * 6996 * \param file to search for references. 6997 * 6998 * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for 6999 * each reference found. 7000 * The CXSourceRange will point inside the file; if the reference is inside 7001 * a macro (and not a macro argument) the CXSourceRange will be invalid. 7002 * 7003 * \returns one of the CXResult enumerators. 7004 */ 7005 CXResult clang_findReferencesInFile ( 7006 CXCursor cursor, 7007 CXFile file, 7008 CXCursorAndRangeVisitor visitor); 7009 7010 /** 7011 * Find #import/#include directives in a specific file. 7012 * 7013 * \param TU translation unit containing the file to query. 7014 * 7015 * \param file to search for #import/#include directives. 7016 * 7017 * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for 7018 * each directive found. 7019 * 7020 * \returns one of the CXResult enumerators. 7021 */ 7022 CXResult clang_findIncludesInFile ( 7023 CXTranslationUnit TU, 7024 CXFile file, 7025 CXCursorAndRangeVisitor visitor); 7026 7027 /** 7028 * The client's data object that is associated with a CXFile. 7029 */ 7030 alias CXIdxClientFile = void*; 7031 7032 /** 7033 * The client's data object that is associated with a semantic entity. 7034 */ 7035 alias CXIdxClientEntity = void*; 7036 7037 /** 7038 * The client's data object that is associated with a semantic container 7039 * of entities. 7040 */ 7041 alias CXIdxClientContainer = void*; 7042 7043 /** 7044 * The client's data object that is associated with an AST file (PCH 7045 * or module). 7046 */ 7047 alias CXIdxClientASTFile = void*; 7048 7049 /** 7050 * Source location passed to index callbacks. 7051 */ 7052 struct CXIdxLoc 7053 { 7054 void*[2] ptr_data; 7055 uint int_data; 7056 } 7057 7058 /** 7059 * Data for ppIncludedFile callback. 7060 */ 7061 struct CXIdxIncludedFileInfo 7062 { 7063 /** 7064 * Location of '#' in the \#include/\#import directive. 7065 */ 7066 CXIdxLoc hashLoc; 7067 /** 7068 * Filename as written in the \#include/\#import directive. 7069 */ 7070 const(char)* filename; 7071 /** 7072 * The actual file that the \#include/\#import directive resolved to. 7073 */ 7074 CXFile file; 7075 int isImport; 7076 int isAngled; 7077 /** 7078 * Non-zero if the directive was automatically turned into a module 7079 * import. 7080 */ 7081 int isModuleImport; 7082 } 7083 7084 /** 7085 * Data for IndexerCallbacks#importedASTFile. 7086 */ 7087 struct CXIdxImportedASTFileInfo 7088 { 7089 /** 7090 * Top level AST file containing the imported PCH, module or submodule. 7091 */ 7092 CXFile file; 7093 /** 7094 * The imported module or NULL if the AST file is a PCH. 7095 */ 7096 CXModule module_; 7097 /** 7098 * Location where the file is imported. Applicable only for modules. 7099 */ 7100 CXIdxLoc loc; 7101 /** 7102 * Non-zero if an inclusion directive was automatically turned into 7103 * a module import. Applicable only for modules. 7104 */ 7105 int isImplicit; 7106 } 7107 7108 enum CXIdxEntityKind 7109 { 7110 CXIdxEntity_Unexposed = 0, 7111 CXIdxEntity_Typedef = 1, 7112 CXIdxEntity_Function = 2, 7113 CXIdxEntity_Variable = 3, 7114 CXIdxEntity_Field = 4, 7115 CXIdxEntity_EnumConstant = 5, 7116 7117 CXIdxEntity_ObjCClass = 6, 7118 CXIdxEntity_ObjCProtocol = 7, 7119 CXIdxEntity_ObjCCategory = 8, 7120 7121 CXIdxEntity_ObjCInstanceMethod = 9, 7122 CXIdxEntity_ObjCClassMethod = 10, 7123 CXIdxEntity_ObjCProperty = 11, 7124 CXIdxEntity_ObjCIvar = 12, 7125 7126 CXIdxEntity_Enum = 13, 7127 CXIdxEntity_Struct = 14, 7128 CXIdxEntity_Union = 15, 7129 7130 CXIdxEntity_CXXClass = 16, 7131 CXIdxEntity_CXXNamespace = 17, 7132 CXIdxEntity_CXXNamespaceAlias = 18, 7133 CXIdxEntity_CXXStaticVariable = 19, 7134 CXIdxEntity_CXXStaticMethod = 20, 7135 CXIdxEntity_CXXInstanceMethod = 21, 7136 CXIdxEntity_CXXConstructor = 22, 7137 CXIdxEntity_CXXDestructor = 23, 7138 CXIdxEntity_CXXConversionFunction = 24, 7139 CXIdxEntity_CXXTypeAlias = 25, 7140 CXIdxEntity_CXXInterface = 26, 7141 CXIdxEntity_CXXConcept = 27 7142 } 7143 7144 mixin EnumC!CXIdxEntityKind; 7145 // alias CXIdxEntity_Unexposed = .CXIdxEntity_Unexposed; 7146 // alias CXIdxEntity_Typedef = .CXIdxEntity_Typedef; 7147 // alias CXIdxEntity_Function = .CXIdxEntity_Function; 7148 // alias CXIdxEntity_Variable = .CXIdxEntity_Variable; 7149 // alias CXIdxEntity_Field = .CXIdxEntity_Field; 7150 // alias CXIdxEntity_EnumConstant = .CXIdxEntity_EnumConstant; 7151 // alias CXIdxEntity_ObjCClass = .CXIdxEntity_ObjCClass; 7152 // alias CXIdxEntity_ObjCProtocol = .CXIdxEntity_ObjCProtocol; 7153 // alias CXIdxEntity_ObjCCategory = .CXIdxEntity_ObjCCategory; 7154 // alias CXIdxEntity_ObjCInstanceMethod = .CXIdxEntity_ObjCInstanceMethod; 7155 // alias CXIdxEntity_ObjCClassMethod = .CXIdxEntity_ObjCClassMethod; 7156 // alias CXIdxEntity_ObjCProperty = .CXIdxEntity_ObjCProperty; 7157 // alias CXIdxEntity_ObjCIvar = .CXIdxEntity_ObjCIvar; 7158 // alias CXIdxEntity_Enum = .CXIdxEntity_Enum; 7159 // alias CXIdxEntity_Struct = .CXIdxEntity_Struct; 7160 // alias CXIdxEntity_Union = .CXIdxEntity_Union; 7161 // alias CXIdxEntity_CXXClass = .CXIdxEntity_CXXClass; 7162 // alias CXIdxEntity_CXXNamespace = .CXIdxEntity_CXXNamespace; 7163 // alias CXIdxEntity_CXXNamespaceAlias = .CXIdxEntity_CXXNamespaceAlias; 7164 // alias CXIdxEntity_CXXStaticVariable = .CXIdxEntity_CXXStaticVariable; 7165 // alias CXIdxEntity_CXXStaticMethod = .CXIdxEntity_CXXStaticMethod; 7166 // alias CXIdxEntity_CXXInstanceMethod = .CXIdxEntity_CXXInstanceMethod; 7167 // alias CXIdxEntity_CXXConstructor = .CXIdxEntity_CXXConstructor; 7168 // alias CXIdxEntity_CXXDestructor = .CXIdxEntity_CXXDestructor; 7169 // alias CXIdxEntity_CXXConversionFunction = .CXIdxEntity_CXXConversionFunction; 7170 // alias CXIdxEntity_CXXTypeAlias = .CXIdxEntity_CXXTypeAlias; 7171 // alias CXIdxEntity_CXXInterface = .CXIdxEntity_CXXInterface; 7172 // alias CXIdxEntity_CXXConcept = .CXIdxEntity_CXXConcept; 7173 7174 enum CXIdxEntityLanguage 7175 { 7176 CXIdxEntityLang_None = 0, 7177 CXIdxEntityLang_C = 1, 7178 CXIdxEntityLang_ObjC = 2, 7179 CXIdxEntityLang_CXX = 3, 7180 CXIdxEntityLang_Swift = 4 7181 } 7182 7183 mixin EnumC!CXIdxEntityLanguage; 7184 // alias CXIdxEntityLang_None = .CXIdxEntityLang_None; 7185 // alias CXIdxEntityLang_C = .CXIdxEntityLang_C; 7186 // alias CXIdxEntityLang_ObjC = .CXIdxEntityLang_ObjC; 7187 // alias CXIdxEntityLang_CXX = .CXIdxEntityLang_CXX; 7188 // alias CXIdxEntityLang_Swift = .CXIdxEntityLang_Swift; 7189 7190 /** 7191 * Extra C++ template information for an entity. This can apply to: 7192 * CXIdxEntity_Function 7193 * CXIdxEntity_CXXClass 7194 * CXIdxEntity_CXXStaticMethod 7195 * CXIdxEntity_CXXInstanceMethod 7196 * CXIdxEntity_CXXConstructor 7197 * CXIdxEntity_CXXConversionFunction 7198 * CXIdxEntity_CXXTypeAlias 7199 */ 7200 enum CXIdxEntityCXXTemplateKind 7201 { 7202 CXIdxEntity_NonTemplate = 0, 7203 CXIdxEntity_Template = 1, 7204 CXIdxEntity_TemplatePartialSpecialization = 2, 7205 CXIdxEntity_TemplateSpecialization = 3 7206 } 7207 7208 mixin EnumC!CXIdxEntityCXXTemplateKind; 7209 // alias CXIdxEntity_NonTemplate = .CXIdxEntity_NonTemplate; 7210 // alias CXIdxEntity_Template = .CXIdxEntity_Template; 7211 // alias CXIdxEntity_TemplatePartialSpecialization = .CXIdxEntity_TemplatePartialSpecialization; 7212 // alias CXIdxEntity_TemplateSpecialization = .CXIdxEntity_TemplateSpecialization; 7213 7214 enum CXIdxAttrKind 7215 { 7216 CXIdxAttr_Unexposed = 0, 7217 CXIdxAttr_IBAction = 1, 7218 CXIdxAttr_IBOutlet = 2, 7219 CXIdxAttr_IBOutletCollection = 3 7220 } 7221 7222 mixin EnumC!CXIdxAttrKind; 7223 // alias CXIdxAttr_Unexposed = .CXIdxAttr_Unexposed; 7224 // alias CXIdxAttr_IBAction = .CXIdxAttr_IBAction; 7225 // alias CXIdxAttr_IBOutlet = .CXIdxAttr_IBOutlet; 7226 // alias CXIdxAttr_IBOutletCollection = .CXIdxAttr_IBOutletCollection; 7227 7228 struct CXIdxAttrInfo 7229 { 7230 CXIdxAttrKind kind; 7231 CXCursor cursor; 7232 CXIdxLoc loc; 7233 } 7234 7235 struct CXIdxEntityInfo 7236 { 7237 CXIdxEntityKind kind; 7238 CXIdxEntityCXXTemplateKind templateKind; 7239 CXIdxEntityLanguage lang; 7240 const(char)* name; 7241 const(char)* USR; 7242 CXCursor cursor; 7243 const(CXIdxAttrInfo*)* attributes; 7244 uint numAttributes; 7245 } 7246 7247 struct CXIdxContainerInfo 7248 { 7249 CXCursor cursor; 7250 } 7251 7252 struct CXIdxIBOutletCollectionAttrInfo 7253 { 7254 const(CXIdxAttrInfo)* attrInfo; 7255 const(CXIdxEntityInfo)* objcClass; 7256 CXCursor classCursor; 7257 CXIdxLoc classLoc; 7258 } 7259 7260 enum CXIdxDeclInfoFlags 7261 { 7262 CXIdxDeclFlag_Skipped = 0x1 7263 } 7264 7265 alias CXIdxDeclFlag_Skipped = CXIdxDeclInfoFlags.CXIdxDeclFlag_Skipped; 7266 7267 struct CXIdxDeclInfo 7268 { 7269 const(CXIdxEntityInfo)* entityInfo; 7270 CXCursor cursor; 7271 CXIdxLoc loc; 7272 const(CXIdxContainerInfo)* semanticContainer; 7273 /** 7274 * Generally same as #semanticContainer but can be different in 7275 * cases like out-of-line C++ member functions. 7276 */ 7277 const(CXIdxContainerInfo)* lexicalContainer; 7278 int isRedeclaration; 7279 int isDefinition; 7280 int isContainer; 7281 const(CXIdxContainerInfo)* declAsContainer; 7282 /** 7283 * Whether the declaration exists in code or was created implicitly 7284 * by the compiler, e.g. implicit Objective-C methods for properties. 7285 */ 7286 int isImplicit; 7287 const(CXIdxAttrInfo*)* attributes; 7288 uint numAttributes; 7289 7290 uint flags; 7291 } 7292 7293 enum CXIdxObjCContainerKind 7294 { 7295 CXIdxObjCContainer_ForwardRef = 0, 7296 CXIdxObjCContainer_Interface = 1, 7297 CXIdxObjCContainer_Implementation = 2 7298 } 7299 7300 mixin EnumC!CXIdxObjCContainerKind; 7301 // alias CXIdxObjCContainer_ForwardRef = .CXIdxObjCContainer_ForwardRef; 7302 // alias CXIdxObjCContainer_Interface = .CXIdxObjCContainer_Interface; 7303 // alias CXIdxObjCContainer_Implementation = .CXIdxObjCContainer_Implementation; 7304 7305 struct CXIdxObjCContainerDeclInfo 7306 { 7307 const(CXIdxDeclInfo)* declInfo; 7308 CXIdxObjCContainerKind kind; 7309 } 7310 7311 struct CXIdxBaseClassInfo 7312 { 7313 const(CXIdxEntityInfo)* base; 7314 CXCursor cursor; 7315 CXIdxLoc loc; 7316 } 7317 7318 struct CXIdxObjCProtocolRefInfo 7319 { 7320 const(CXIdxEntityInfo)* protocol; 7321 CXCursor cursor; 7322 CXIdxLoc loc; 7323 } 7324 7325 struct CXIdxObjCProtocolRefListInfo 7326 { 7327 const(CXIdxObjCProtocolRefInfo*)* protocols; 7328 uint numProtocols; 7329 } 7330 7331 struct CXIdxObjCInterfaceDeclInfo 7332 { 7333 const(CXIdxObjCContainerDeclInfo)* containerInfo; 7334 const(CXIdxBaseClassInfo)* superInfo; 7335 const(CXIdxObjCProtocolRefListInfo)* protocols; 7336 } 7337 7338 struct CXIdxObjCCategoryDeclInfo 7339 { 7340 const(CXIdxObjCContainerDeclInfo)* containerInfo; 7341 const(CXIdxEntityInfo)* objcClass; 7342 CXCursor classCursor; 7343 CXIdxLoc classLoc; 7344 const(CXIdxObjCProtocolRefListInfo)* protocols; 7345 } 7346 7347 struct CXIdxObjCPropertyDeclInfo 7348 { 7349 const(CXIdxDeclInfo)* declInfo; 7350 const(CXIdxEntityInfo)* getter; 7351 const(CXIdxEntityInfo)* setter; 7352 } 7353 7354 struct CXIdxCXXClassDeclInfo 7355 { 7356 const(CXIdxDeclInfo)* declInfo; 7357 const(CXIdxBaseClassInfo*)* bases; 7358 uint numBases; 7359 } 7360 7361 /** 7362 * Data for IndexerCallbacks#indexEntityReference. 7363 * 7364 * This may be deprecated in a future version as this duplicates 7365 * the \c CXSymbolRole_Implicit bit in \c CXSymbolRole. 7366 */ 7367 enum CXIdxEntityRefKind 7368 { 7369 /** 7370 * The entity is referenced directly in user's code. 7371 */ 7372 CXIdxEntityRef_Direct = 1, 7373 /** 7374 * An implicit reference, e.g. a reference of an Objective-C method 7375 * via the dot syntax. 7376 */ 7377 CXIdxEntityRef_Implicit = 2 7378 } 7379 7380 mixin EnumC!CXIdxEntityRefKind; 7381 // alias CXIdxEntityRef_Direct = .CXIdxEntityRef_Direct; 7382 // alias CXIdxEntityRef_Implicit = .CXIdxEntityRef_Implicit; 7383 7384 /** 7385 * Roles that are attributed to symbol occurrences. 7386 * 7387 * Internal: this currently mirrors low 9 bits of clang::index::SymbolRole with 7388 * higher bits zeroed. These high bits may be exposed in the future. 7389 */ 7390 enum CXSymbolRole 7391 { 7392 CXSymbolRole_None = 0, 7393 CXSymbolRole_Declaration = 1 << 0, 7394 CXSymbolRole_Definition = 1 << 1, 7395 CXSymbolRole_Reference = 1 << 2, 7396 CXSymbolRole_Read = 1 << 3, 7397 CXSymbolRole_Write = 1 << 4, 7398 CXSymbolRole_Call = 1 << 5, 7399 CXSymbolRole_Dynamic = 1 << 6, 7400 CXSymbolRole_AddressOf = 1 << 7, 7401 CXSymbolRole_Implicit = 1 << 8 7402 } 7403 7404 mixin EnumC!CXSymbolRole; 7405 // alias CXSymbolRole_None = .CXSymbolRole_None; 7406 // alias CXSymbolRole_Declaration = .CXSymbolRole_Declaration; 7407 // alias CXSymbolRole_Definition = .CXSymbolRole_Definition; 7408 // alias CXSymbolRole_Reference = .CXSymbolRole_Reference; 7409 // alias CXSymbolRole_Read = .CXSymbolRole_Read; 7410 // alias CXSymbolRole_Write = .CXSymbolRole_Write; 7411 // alias CXSymbolRole_Call = .CXSymbolRole_Call; 7412 // alias CXSymbolRole_Dynamic = .CXSymbolRole_Dynamic; 7413 // alias CXSymbolRole_AddressOf = .CXSymbolRole_AddressOf; 7414 // alias CXSymbolRole_Implicit = .CXSymbolRole_Implicit; 7415 7416 /** 7417 * Data for IndexerCallbacks#indexEntityReference. 7418 */ 7419 struct CXIdxEntityRefInfo 7420 { 7421 CXIdxEntityRefKind kind; 7422 /** 7423 * Reference cursor. 7424 */ 7425 CXCursor cursor; 7426 CXIdxLoc loc; 7427 /** 7428 * The entity that gets referenced. 7429 */ 7430 const(CXIdxEntityInfo)* referencedEntity; 7431 /** 7432 * Immediate "parent" of the reference. For example: 7433 * 7434 * \code 7435 * Foo *var; 7436 * \endcode 7437 * 7438 * The parent of reference of type 'Foo' is the variable 'var'. 7439 * For references inside statement bodies of functions/methods, 7440 * the parentEntity will be the function/method. 7441 */ 7442 const(CXIdxEntityInfo)* parentEntity; 7443 /** 7444 * Lexical container context of the reference. 7445 */ 7446 const(CXIdxContainerInfo)* container; 7447 /** 7448 * Sets of symbol roles of the reference. 7449 */ 7450 CXSymbolRole role; 7451 } 7452 7453 /** 7454 * A group of callbacks used by #clang_indexSourceFile and 7455 * #clang_indexTranslationUnit. 7456 */ 7457 struct IndexerCallbacks 7458 { 7459 /** 7460 * Called periodically to check whether indexing should be aborted. 7461 * Should return 0 to continue, and non-zero to abort. 7462 */ 7463 int function (const CXClientData client_data, void* reserved) abortQuery; 7464 7465 /** 7466 * Called at the end of indexing; passes the complete diagnostic set. 7467 */ 7468 void function (const CXClientData client_data, CXDiagnosticSet, void* reserved) diagnostic; 7469 7470 CXIdxClientFile function ( 7471 CXClientData client_data, 7472 CXFile mainFile, 7473 void* reserved) enteredMainFile; 7474 7475 /** 7476 * Called when a file gets \#included/\#imported. 7477 */ 7478 CXIdxClientFile function ( 7479 CXClientData client_data, 7480 const(CXIdxIncludedFileInfo)*) ppIncludedFile; 7481 7482 /** 7483 * Called when a AST file (PCH or module) gets imported. 7484 * 7485 * AST files will not get indexed (there will not be callbacks to index all 7486 * the entities in an AST file). The recommended action is that, if the AST 7487 * file is not already indexed, to initiate a new indexing job specific to 7488 * the AST file. 7489 */ 7490 CXIdxClientASTFile function ( 7491 CXClientData client_data, 7492 const(CXIdxImportedASTFileInfo)*) importedASTFile; 7493 7494 /** 7495 * Called at the beginning of indexing a translation unit. 7496 */ 7497 CXIdxClientContainer function ( 7498 CXClientData client_data, 7499 void* reserved) startedTranslationUnit; 7500 7501 void function (const CXClientData client_data, const(CXIdxDeclInfo)*) indexDeclaration; 7502 7503 /** 7504 * Called to index a reference of an entity. 7505 */ 7506 void function ( 7507 CXClientData client_data, 7508 const(CXIdxEntityRefInfo)*) indexEntityReference; 7509 } 7510 7511 int clang_index_isEntityObjCContainerKind (const CXIdxEntityKind); 7512 const(CXIdxObjCContainerDeclInfo)* clang_index_getObjCContainerDeclInfo ( 7513 const(CXIdxDeclInfo)*); 7514 7515 const(CXIdxObjCInterfaceDeclInfo)* clang_index_getObjCInterfaceDeclInfo ( 7516 const(CXIdxDeclInfo)*); 7517 7518 const(CXIdxObjCCategoryDeclInfo)* clang_index_getObjCCategoryDeclInfo ( 7519 const(CXIdxDeclInfo)*); 7520 7521 const(CXIdxObjCProtocolRefListInfo)* clang_index_getObjCProtocolRefListInfo ( 7522 const(CXIdxDeclInfo)*); 7523 7524 const(CXIdxObjCPropertyDeclInfo)* clang_index_getObjCPropertyDeclInfo ( 7525 const(CXIdxDeclInfo)*); 7526 7527 const(CXIdxIBOutletCollectionAttrInfo)* clang_index_getIBOutletCollectionAttrInfo ( 7528 const(CXIdxAttrInfo)*); 7529 7530 const(CXIdxCXXClassDeclInfo)* clang_index_getCXXClassDeclInfo ( 7531 const(CXIdxDeclInfo)*); 7532 7533 /** 7534 * For retrieving a custom CXIdxClientContainer attached to a 7535 * container. 7536 */ 7537 CXIdxClientContainer clang_index_getClientContainer ( 7538 const(CXIdxContainerInfo)*); 7539 7540 /** 7541 * For setting a custom CXIdxClientContainer attached to a 7542 * container. 7543 */ 7544 void clang_index_setClientContainer ( 7545 const(CXIdxContainerInfo)*, 7546 CXIdxClientContainer); 7547 7548 /** 7549 * For retrieving a custom CXIdxClientEntity attached to an entity. 7550 */ 7551 CXIdxClientEntity clang_index_getClientEntity (const(CXIdxEntityInfo)*); 7552 7553 /** 7554 * For setting a custom CXIdxClientEntity attached to an entity. 7555 */ 7556 void clang_index_setClientEntity (const(CXIdxEntityInfo)*, CXIdxClientEntity); 7557 7558 /** 7559 * An indexing action/session, to be applied to one or multiple 7560 * translation units. 7561 */ 7562 alias CXIndexAction = void*; 7563 7564 /** 7565 * An indexing action/session, to be applied to one or multiple 7566 * translation units. 7567 * 7568 * \param CIdx The index object with which the index action will be associated. 7569 */ 7570 CXIndexAction clang_IndexAction_create (const CXIndex CIdx); 7571 7572 /** 7573 * Destroy the given index action. 7574 * 7575 * The index action must not be destroyed until all of the translation units 7576 * created within that index action have been destroyed. 7577 */ 7578 void clang_IndexAction_dispose (const CXIndexAction); 7579 7580 enum CXIndexOptFlags 7581 { 7582 /** 7583 * Used to indicate that no special indexing options are needed. 7584 */ 7585 CXIndexOpt_None = 0x0, 7586 7587 /** 7588 * Used to indicate that IndexerCallbacks#indexEntityReference should 7589 * be invoked for only one reference of an entity per source file that does 7590 * not also include a declaration/definition of the entity. 7591 */ 7592 CXIndexOpt_SuppressRedundantRefs = 0x1, 7593 7594 /** 7595 * Function-local symbols should be indexed. If this is not set 7596 * function-local symbols will be ignored. 7597 */ 7598 CXIndexOpt_IndexFunctionLocalSymbols = 0x2, 7599 7600 /** 7601 * Implicit function/class template instantiations should be indexed. 7602 * If this is not set, implicit instantiations will be ignored. 7603 */ 7604 CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4, 7605 7606 /** 7607 * Suppress all compiler warnings when parsing for indexing. 7608 */ 7609 CXIndexOpt_SuppressWarnings = 0x8, 7610 7611 /** 7612 * Skip a function/method body that was already parsed during an 7613 * indexing session associated with a \c CXIndexAction object. 7614 * Bodies in system headers are always skipped. 7615 */ 7616 CXIndexOpt_SkipParsedBodiesInSession = 0x10 7617 } 7618 7619 mixin EnumC!CXIndexOptFlags; 7620 // alias CXIndexOpt_None = .CXIndexOpt_None; 7621 // alias CXIndexOpt_SuppressRedundantRefs = .CXIndexOpt_SuppressRedundantRefs; 7622 // alias CXIndexOpt_IndexFunctionLocalSymbols = .CXIndexOpt_IndexFunctionLocalSymbols; 7623 // alias CXIndexOpt_IndexImplicitTemplateInstantiations = .CXIndexOpt_IndexImplicitTemplateInstantiations; 7624 // alias CXIndexOpt_SuppressWarnings = .CXIndexOpt_SuppressWarnings; 7625 // alias CXIndexOpt_SkipParsedBodiesInSession = .CXIndexOpt_SkipParsedBodiesInSession; 7626 7627 /** 7628 * Index the given source file and the translation unit corresponding 7629 * to that file via callbacks implemented through #IndexerCallbacks. 7630 * 7631 * \param client_data pointer data supplied by the client, which will 7632 * be passed to the invoked callbacks. 7633 * 7634 * \param index_callbacks Pointer to indexing callbacks that the client 7635 * implements. 7636 * 7637 * \param index_callbacks_size Size of #IndexerCallbacks structure that gets 7638 * passed in index_callbacks. 7639 * 7640 * \param index_options A bitmask of options that affects how indexing is 7641 * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags. 7642 * 7643 * \param[out] out_TU pointer to store a \c CXTranslationUnit that can be 7644 * reused after indexing is finished. Set to \c NULL if you do not require it. 7645 * 7646 * \returns 0 on success or if there were errors from which the compiler could 7647 * recover. If there is a failure from which there is no recovery, returns 7648 * a non-zero \c CXErrorCode. 7649 * 7650 * The rest of the parameters are the same as #clang_parseTranslationUnit. 7651 */ 7652 int clang_indexSourceFile ( 7653 CXIndexAction, 7654 CXClientData client_data, 7655 IndexerCallbacks* index_callbacks, 7656 uint index_callbacks_size, 7657 uint index_options, 7658 const(char)* source_filename, 7659 const(char*)* command_line_args, 7660 int num_command_line_args, 7661 CXUnsavedFile* unsaved_files, 7662 uint num_unsaved_files, 7663 CXTranslationUnit* out_TU, 7664 uint TU_options); 7665 7666 /** 7667 * Same as clang_indexSourceFile but requires a full command line 7668 * for \c command_line_args including argv[0]. This is useful if the standard 7669 * library paths are relative to the binary. 7670 */ 7671 int clang_indexSourceFileFullArgv ( 7672 CXIndexAction, 7673 CXClientData client_data, 7674 IndexerCallbacks* index_callbacks, 7675 uint index_callbacks_size, 7676 uint index_options, 7677 const(char)* source_filename, 7678 const(char*)* command_line_args, 7679 int num_command_line_args, 7680 CXUnsavedFile* unsaved_files, 7681 uint num_unsaved_files, 7682 CXTranslationUnit* out_TU, 7683 uint TU_options); 7684 7685 /** 7686 * Index the given translation unit via callbacks implemented through 7687 * #IndexerCallbacks. 7688 * 7689 * The order of callback invocations is not guaranteed to be the same as 7690 * when indexing a source file. The high level order will be: 7691 * 7692 * -Preprocessor callbacks invocations 7693 * -Declaration/reference callbacks invocations 7694 * -Diagnostic callback invocations 7695 * 7696 * The parameters are the same as #clang_indexSourceFile. 7697 * 7698 * \returns If there is a failure from which there is no recovery, returns 7699 * non-zero, otherwise returns 0. 7700 */ 7701 int clang_indexTranslationUnit ( 7702 CXIndexAction, 7703 CXClientData client_data, 7704 IndexerCallbacks* index_callbacks, 7705 uint index_callbacks_size, 7706 uint index_options, 7707 CXTranslationUnit); 7708 7709 /** 7710 * Retrieve the CXIdxFile, file, line, column, and offset represented by 7711 * the given CXIdxLoc. 7712 * 7713 * If the location refers into a macro expansion, retrieves the 7714 * location of the macro expansion and if it refers into a macro argument 7715 * retrieves the location of the argument. 7716 */ 7717 void clang_indexLoc_getFileLocation ( 7718 CXIdxLoc loc, 7719 CXIdxClientFile* indexFile, 7720 CXFile* file, 7721 uint* line, 7722 uint* column, 7723 uint* offset); 7724 7725 /** 7726 * Retrieve the CXSourceLocation represented by the given CXIdxLoc. 7727 */ 7728 CXSourceLocation clang_indexLoc_getCXSourceLocation (const CXIdxLoc loc); 7729 7730 /** 7731 * Visitor invoked for each field found by a traversal. 7732 * 7733 * This visitor function will be invoked for each field found by 7734 * \c clang_Type_visitFields. Its first argument is the cursor being 7735 * visited, its second argument is the client data provided to 7736 * \c clang_Type_visitFields. 7737 * 7738 * The visitor should return one of the \c CXVisitorResult values 7739 * to direct \c clang_Type_visitFields. 7740 */ 7741 alias CXFieldVisitor = CXVisitorResult function ( 7742 CXCursor C, 7743 CXClientData client_data); 7744 7745 /** 7746 * Visit the fields of a particular type. 7747 * 7748 * This function visits all the direct fields of the given cursor, 7749 * invoking the given \p visitor function with the cursors of each 7750 * visited field. The traversal may be ended prematurely, if 7751 * the visitor returns \c CXFieldVisit_Break. 7752 * 7753 * \param T the record type whose field may be visited. 7754 * 7755 * \param visitor the visitor function that will be invoked for each 7756 * field of \p T. 7757 * 7758 * \param client_data pointer data supplied by the client, which will 7759 * be passed to the visitor each time it is invoked. 7760 * 7761 * \returns a non-zero value if the traversal was terminated 7762 * prematurely by the visitor returning \c CXFieldVisit_Break. 7763 */ 7764 uint clang_Type_visitFields ( 7765 CXType T, 7766 CXFieldVisitor visitor, 7767 CXClientData client_data); 7768 7769 /** 7770 * @} 7771 */ 7772 7773 /** 7774 * @} 7775 */