10b57cec5SDimitry Andric /*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\ 20b57cec5SDimitry Andric |* *| 30b57cec5SDimitry Andric |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| 40b57cec5SDimitry Andric |* Exceptions. *| 50b57cec5SDimitry Andric |* See https://llvm.org/LICENSE.txt for license information. *| 60b57cec5SDimitry Andric |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| 70b57cec5SDimitry Andric |* *| 80b57cec5SDimitry Andric |*===----------------------------------------------------------------------===*| 90b57cec5SDimitry Andric |* *| 100b57cec5SDimitry Andric |* This header provides a public interface to a Clang library for extracting *| 110b57cec5SDimitry Andric |* high-level symbol information from source files without exposing the full *| 120b57cec5SDimitry Andric |* Clang C++ API. *| 130b57cec5SDimitry Andric |* *| 140b57cec5SDimitry Andric \*===----------------------------------------------------------------------===*/ 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric #ifndef LLVM_CLANG_C_INDEX_H 170b57cec5SDimitry Andric #define LLVM_CLANG_C_INDEX_H 180b57cec5SDimitry Andric 19480093f4SDimitry Andric #include "clang-c/BuildSystem.h" 20bdd1243dSDimitry Andric #include "clang-c/CXDiagnostic.h" 210b57cec5SDimitry Andric #include "clang-c/CXErrorCode.h" 22bdd1243dSDimitry Andric #include "clang-c/CXFile.h" 23bdd1243dSDimitry Andric #include "clang-c/CXSourceLocation.h" 240b57cec5SDimitry Andric #include "clang-c/CXString.h" 25480093f4SDimitry Andric #include "clang-c/ExternC.h" 26480093f4SDimitry Andric #include "clang-c/Platform.h" 270b57cec5SDimitry Andric 280b57cec5SDimitry Andric /** 290b57cec5SDimitry Andric * The version constants for the libclang API. 300b57cec5SDimitry Andric * CINDEX_VERSION_MINOR should increase when there are API additions. 310b57cec5SDimitry Andric * CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes. 320b57cec5SDimitry Andric * 330b57cec5SDimitry Andric * The policy about the libclang API was always to keep it source and ABI 340b57cec5SDimitry Andric * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. 350b57cec5SDimitry Andric */ 360b57cec5SDimitry Andric #define CINDEX_VERSION_MAJOR 0 3706c3fb27SDimitry Andric #define CINDEX_VERSION_MINOR 64 380b57cec5SDimitry Andric 395ffd83dbSDimitry Andric #define CINDEX_VERSION_ENCODE(major, minor) (((major)*10000) + ((minor)*1)) 400b57cec5SDimitry Andric 415ffd83dbSDimitry Andric #define CINDEX_VERSION \ 425ffd83dbSDimitry Andric CINDEX_VERSION_ENCODE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR) 430b57cec5SDimitry Andric 445ffd83dbSDimitry Andric #define CINDEX_VERSION_STRINGIZE_(major, minor) #major "." #minor 450b57cec5SDimitry Andric #define CINDEX_VERSION_STRINGIZE(major, minor) \ 460b57cec5SDimitry Andric CINDEX_VERSION_STRINGIZE_(major, minor) 470b57cec5SDimitry Andric 485ffd83dbSDimitry Andric #define CINDEX_VERSION_STRING \ 495ffd83dbSDimitry Andric CINDEX_VERSION_STRINGIZE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR) 500b57cec5SDimitry Andric 5106c3fb27SDimitry Andric #ifndef __has_feature 5206c3fb27SDimitry Andric #define __has_feature(feature) 0 5306c3fb27SDimitry Andric #endif 5406c3fb27SDimitry Andric 55480093f4SDimitry Andric LLVM_CLANG_C_EXTERN_C_BEGIN 560b57cec5SDimitry Andric 570b57cec5SDimitry Andric /** \defgroup CINDEX libclang: C Interface to Clang 580b57cec5SDimitry Andric * 590b57cec5SDimitry Andric * The C Interface to Clang provides a relatively small API that exposes 600b57cec5SDimitry Andric * facilities for parsing source code into an abstract syntax tree (AST), 610b57cec5SDimitry Andric * loading already-parsed ASTs, traversing the AST, associating 620b57cec5SDimitry Andric * physical source locations with elements within the AST, and other 630b57cec5SDimitry Andric * facilities that support Clang-based development tools. 640b57cec5SDimitry Andric * 650b57cec5SDimitry Andric * This C interface to Clang will never provide all of the information 660b57cec5SDimitry Andric * representation stored in Clang's C++ AST, nor should it: the intent is to 670b57cec5SDimitry Andric * maintain an API that is relatively stable from one release to the next, 680b57cec5SDimitry Andric * providing only the basic functionality needed to support development tools. 690b57cec5SDimitry Andric * 700b57cec5SDimitry Andric * To avoid namespace pollution, data types are prefixed with "CX" and 710b57cec5SDimitry Andric * functions are prefixed with "clang_". 720b57cec5SDimitry Andric * 730b57cec5SDimitry Andric * @{ 740b57cec5SDimitry Andric */ 750b57cec5SDimitry Andric 760b57cec5SDimitry Andric /** 770b57cec5SDimitry Andric * An "index" that consists of a set of translation units that would 780b57cec5SDimitry Andric * typically be linked together into an executable or library. 790b57cec5SDimitry Andric */ 800b57cec5SDimitry Andric typedef void *CXIndex; 810b57cec5SDimitry Andric 820b57cec5SDimitry Andric /** 830b57cec5SDimitry Andric * An opaque type representing target information for a given translation 840b57cec5SDimitry Andric * unit. 850b57cec5SDimitry Andric */ 860b57cec5SDimitry Andric typedef struct CXTargetInfoImpl *CXTargetInfo; 870b57cec5SDimitry Andric 880b57cec5SDimitry Andric /** 890b57cec5SDimitry Andric * A single translation unit, which resides in an index. 900b57cec5SDimitry Andric */ 910b57cec5SDimitry Andric typedef struct CXTranslationUnitImpl *CXTranslationUnit; 920b57cec5SDimitry Andric 930b57cec5SDimitry Andric /** 940b57cec5SDimitry Andric * Opaque pointer representing client data that will be passed through 950b57cec5SDimitry Andric * to various callbacks and visitors. 960b57cec5SDimitry Andric */ 970b57cec5SDimitry Andric typedef void *CXClientData; 980b57cec5SDimitry Andric 990b57cec5SDimitry Andric /** 1000b57cec5SDimitry Andric * Provides the contents of a file that has not yet been saved to disk. 1010b57cec5SDimitry Andric * 1020b57cec5SDimitry Andric * Each CXUnsavedFile instance provides the name of a file on the 1030b57cec5SDimitry Andric * system along with the current contents of that file that have not 1040b57cec5SDimitry Andric * yet been saved to disk. 1050b57cec5SDimitry Andric */ 1060b57cec5SDimitry Andric struct CXUnsavedFile { 1070b57cec5SDimitry Andric /** 1080b57cec5SDimitry Andric * The file whose contents have not yet been saved. 1090b57cec5SDimitry Andric * 1100b57cec5SDimitry Andric * This file must already exist in the file system. 1110b57cec5SDimitry Andric */ 1120b57cec5SDimitry Andric const char *Filename; 1130b57cec5SDimitry Andric 1140b57cec5SDimitry Andric /** 1150b57cec5SDimitry Andric * A buffer containing the unsaved contents of this file. 1160b57cec5SDimitry Andric */ 1170b57cec5SDimitry Andric const char *Contents; 1180b57cec5SDimitry Andric 1190b57cec5SDimitry Andric /** 1200b57cec5SDimitry Andric * The length of the unsaved contents of this buffer. 1210b57cec5SDimitry Andric */ 1220b57cec5SDimitry Andric unsigned long Length; 1230b57cec5SDimitry Andric }; 1240b57cec5SDimitry Andric 1250b57cec5SDimitry Andric /** 1260b57cec5SDimitry Andric * Describes the availability of a particular entity, which indicates 1270b57cec5SDimitry Andric * whether the use of this entity will result in a warning or error due to 1280b57cec5SDimitry Andric * it being deprecated or unavailable. 1290b57cec5SDimitry Andric */ 1300b57cec5SDimitry Andric enum CXAvailabilityKind { 1310b57cec5SDimitry Andric /** 1320b57cec5SDimitry Andric * The entity is available. 1330b57cec5SDimitry Andric */ 1340b57cec5SDimitry Andric CXAvailability_Available, 1350b57cec5SDimitry Andric /** 1360b57cec5SDimitry Andric * The entity is available, but has been deprecated (and its use is 1370b57cec5SDimitry Andric * not recommended). 1380b57cec5SDimitry Andric */ 1390b57cec5SDimitry Andric CXAvailability_Deprecated, 1400b57cec5SDimitry Andric /** 1410b57cec5SDimitry Andric * The entity is not available; any use of it will be an error. 1420b57cec5SDimitry Andric */ 1430b57cec5SDimitry Andric CXAvailability_NotAvailable, 1440b57cec5SDimitry Andric /** 1450b57cec5SDimitry Andric * The entity is available, but not accessible; any use of it will be 1460b57cec5SDimitry Andric * an error. 1470b57cec5SDimitry Andric */ 1480b57cec5SDimitry Andric CXAvailability_NotAccessible 1490b57cec5SDimitry Andric }; 1500b57cec5SDimitry Andric 1510b57cec5SDimitry Andric /** 1520b57cec5SDimitry Andric * Describes a version number of the form major.minor.subminor. 1530b57cec5SDimitry Andric */ 1540b57cec5SDimitry Andric typedef struct CXVersion { 1550b57cec5SDimitry Andric /** 1560b57cec5SDimitry Andric * The major version number, e.g., the '10' in '10.7.3'. A negative 1570b57cec5SDimitry Andric * value indicates that there is no version number at all. 1580b57cec5SDimitry Andric */ 1590b57cec5SDimitry Andric int Major; 1600b57cec5SDimitry Andric /** 1610b57cec5SDimitry Andric * The minor version number, e.g., the '7' in '10.7.3'. This value 1620b57cec5SDimitry Andric * will be negative if no minor version number was provided, e.g., for 1630b57cec5SDimitry Andric * version '10'. 1640b57cec5SDimitry Andric */ 1650b57cec5SDimitry Andric int Minor; 1660b57cec5SDimitry Andric /** 1670b57cec5SDimitry Andric * The subminor version number, e.g., the '3' in '10.7.3'. This value 1680b57cec5SDimitry Andric * will be negative if no minor or subminor version number was provided, 1690b57cec5SDimitry Andric * e.g., in version '10' or '10.7'. 1700b57cec5SDimitry Andric */ 1710b57cec5SDimitry Andric int Subminor; 1720b57cec5SDimitry Andric } CXVersion; 1730b57cec5SDimitry Andric 1740b57cec5SDimitry Andric /** 1750b57cec5SDimitry Andric * Describes the exception specification of a cursor. 1760b57cec5SDimitry Andric * 1770b57cec5SDimitry Andric * A negative value indicates that the cursor is not a function declaration. 1780b57cec5SDimitry Andric */ 1790b57cec5SDimitry Andric enum CXCursor_ExceptionSpecificationKind { 1800b57cec5SDimitry Andric /** 1810b57cec5SDimitry Andric * The cursor has no exception specification. 1820b57cec5SDimitry Andric */ 1830b57cec5SDimitry Andric CXCursor_ExceptionSpecificationKind_None, 1840b57cec5SDimitry Andric 1850b57cec5SDimitry Andric /** 1860b57cec5SDimitry Andric * The cursor has exception specification throw() 1870b57cec5SDimitry Andric */ 1880b57cec5SDimitry Andric CXCursor_ExceptionSpecificationKind_DynamicNone, 1890b57cec5SDimitry Andric 1900b57cec5SDimitry Andric /** 1910b57cec5SDimitry Andric * The cursor has exception specification throw(T1, T2) 1920b57cec5SDimitry Andric */ 1930b57cec5SDimitry Andric CXCursor_ExceptionSpecificationKind_Dynamic, 1940b57cec5SDimitry Andric 1950b57cec5SDimitry Andric /** 1960b57cec5SDimitry Andric * The cursor has exception specification throw(...). 1970b57cec5SDimitry Andric */ 1980b57cec5SDimitry Andric CXCursor_ExceptionSpecificationKind_MSAny, 1990b57cec5SDimitry Andric 2000b57cec5SDimitry Andric /** 2010b57cec5SDimitry Andric * The cursor has exception specification basic noexcept. 2020b57cec5SDimitry Andric */ 2030b57cec5SDimitry Andric CXCursor_ExceptionSpecificationKind_BasicNoexcept, 2040b57cec5SDimitry Andric 2050b57cec5SDimitry Andric /** 2060b57cec5SDimitry Andric * The cursor has exception specification computed noexcept. 2070b57cec5SDimitry Andric */ 2080b57cec5SDimitry Andric CXCursor_ExceptionSpecificationKind_ComputedNoexcept, 2090b57cec5SDimitry Andric 2100b57cec5SDimitry Andric /** 2110b57cec5SDimitry Andric * The exception specification has not yet been evaluated. 2120b57cec5SDimitry Andric */ 2130b57cec5SDimitry Andric CXCursor_ExceptionSpecificationKind_Unevaluated, 2140b57cec5SDimitry Andric 2150b57cec5SDimitry Andric /** 2160b57cec5SDimitry Andric * The exception specification has not yet been instantiated. 2170b57cec5SDimitry Andric */ 2180b57cec5SDimitry Andric CXCursor_ExceptionSpecificationKind_Uninstantiated, 2190b57cec5SDimitry Andric 2200b57cec5SDimitry Andric /** 2210b57cec5SDimitry Andric * The exception specification has not been parsed yet. 2220b57cec5SDimitry Andric */ 2230b57cec5SDimitry Andric CXCursor_ExceptionSpecificationKind_Unparsed, 2240b57cec5SDimitry Andric 2250b57cec5SDimitry Andric /** 2260b57cec5SDimitry Andric * The cursor has a __declspec(nothrow) exception specification. 2270b57cec5SDimitry Andric */ 2280b57cec5SDimitry Andric CXCursor_ExceptionSpecificationKind_NoThrow 2290b57cec5SDimitry Andric }; 2300b57cec5SDimitry Andric 2310b57cec5SDimitry Andric /** 2320b57cec5SDimitry Andric * Provides a shared context for creating translation units. 2330b57cec5SDimitry Andric * 2340b57cec5SDimitry Andric * It provides two options: 2350b57cec5SDimitry Andric * 2360b57cec5SDimitry Andric * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local" 2370b57cec5SDimitry Andric * declarations (when loading any new translation units). A "local" declaration 2380b57cec5SDimitry Andric * is one that belongs in the translation unit itself and not in a precompiled 2390b57cec5SDimitry Andric * header that was used by the translation unit. If zero, all declarations 2400b57cec5SDimitry Andric * will be enumerated. 2410b57cec5SDimitry Andric * 2420b57cec5SDimitry Andric * Here is an example: 2430b57cec5SDimitry Andric * 2440b57cec5SDimitry Andric * \code 2450b57cec5SDimitry Andric * // excludeDeclsFromPCH = 1, displayDiagnostics=1 2460b57cec5SDimitry Andric * Idx = clang_createIndex(1, 1); 2470b57cec5SDimitry Andric * 2480b57cec5SDimitry Andric * // IndexTest.pch was produced with the following command: 2490b57cec5SDimitry Andric * // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch" 2500b57cec5SDimitry Andric * TU = clang_createTranslationUnit(Idx, "IndexTest.pch"); 2510b57cec5SDimitry Andric * 2520b57cec5SDimitry Andric * // This will load all the symbols from 'IndexTest.pch' 2530b57cec5SDimitry Andric * clang_visitChildren(clang_getTranslationUnitCursor(TU), 2540b57cec5SDimitry Andric * TranslationUnitVisitor, 0); 2550b57cec5SDimitry Andric * clang_disposeTranslationUnit(TU); 2560b57cec5SDimitry Andric * 2570b57cec5SDimitry Andric * // This will load all the symbols from 'IndexTest.c', excluding symbols 2580b57cec5SDimitry Andric * // from 'IndexTest.pch'. 2590b57cec5SDimitry Andric * char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" }; 2600b57cec5SDimitry Andric * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args, 2610b57cec5SDimitry Andric * 0, 0); 2620b57cec5SDimitry Andric * clang_visitChildren(clang_getTranslationUnitCursor(TU), 2630b57cec5SDimitry Andric * TranslationUnitVisitor, 0); 2640b57cec5SDimitry Andric * clang_disposeTranslationUnit(TU); 2650b57cec5SDimitry Andric * \endcode 2660b57cec5SDimitry Andric * 2670b57cec5SDimitry Andric * This process of creating the 'pch', loading it separately, and using it (via 2680b57cec5SDimitry Andric * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks 2690b57cec5SDimitry Andric * (which gives the indexer the same performance benefit as the compiler). 2700b57cec5SDimitry Andric */ 2710b57cec5SDimitry Andric CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH, 2720b57cec5SDimitry Andric int displayDiagnostics); 2730b57cec5SDimitry Andric 2740b57cec5SDimitry Andric /** 2750b57cec5SDimitry Andric * Destroy the given index. 2760b57cec5SDimitry Andric * 2770b57cec5SDimitry Andric * The index must not be destroyed until all of the translation units created 2780b57cec5SDimitry Andric * within that index have been destroyed. 2790b57cec5SDimitry Andric */ 2800b57cec5SDimitry Andric CINDEX_LINKAGE void clang_disposeIndex(CXIndex index); 2810b57cec5SDimitry Andric 2820b57cec5SDimitry Andric typedef enum { 2830b57cec5SDimitry Andric /** 28406c3fb27SDimitry Andric * Use the default value of an option that may depend on the process 28506c3fb27SDimitry Andric * environment. 28606c3fb27SDimitry Andric */ 28706c3fb27SDimitry Andric CXChoice_Default = 0, 28806c3fb27SDimitry Andric /** 28906c3fb27SDimitry Andric * Enable the option. 29006c3fb27SDimitry Andric */ 29106c3fb27SDimitry Andric CXChoice_Enabled = 1, 29206c3fb27SDimitry Andric /** 29306c3fb27SDimitry Andric * Disable the option. 29406c3fb27SDimitry Andric */ 29506c3fb27SDimitry Andric CXChoice_Disabled = 2 29606c3fb27SDimitry Andric } CXChoice; 29706c3fb27SDimitry Andric 29806c3fb27SDimitry Andric typedef enum { 29906c3fb27SDimitry Andric /** 3000b57cec5SDimitry Andric * Used to indicate that no special CXIndex options are needed. 3010b57cec5SDimitry Andric */ 3020b57cec5SDimitry Andric CXGlobalOpt_None = 0x0, 3030b57cec5SDimitry Andric 3040b57cec5SDimitry Andric /** 3050b57cec5SDimitry Andric * Used to indicate that threads that libclang creates for indexing 3060b57cec5SDimitry Andric * purposes should use background priority. 3070b57cec5SDimitry Andric * 3080b57cec5SDimitry Andric * Affects #clang_indexSourceFile, #clang_indexTranslationUnit, 3090b57cec5SDimitry Andric * #clang_parseTranslationUnit, #clang_saveTranslationUnit. 3100b57cec5SDimitry Andric */ 3110b57cec5SDimitry Andric CXGlobalOpt_ThreadBackgroundPriorityForIndexing = 0x1, 3120b57cec5SDimitry Andric 3130b57cec5SDimitry Andric /** 3140b57cec5SDimitry Andric * Used to indicate that threads that libclang creates for editing 3150b57cec5SDimitry Andric * purposes should use background priority. 3160b57cec5SDimitry Andric * 3170b57cec5SDimitry Andric * Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt, 3180b57cec5SDimitry Andric * #clang_annotateTokens 3190b57cec5SDimitry Andric */ 3200b57cec5SDimitry Andric CXGlobalOpt_ThreadBackgroundPriorityForEditing = 0x2, 3210b57cec5SDimitry Andric 3220b57cec5SDimitry Andric /** 3230b57cec5SDimitry Andric * Used to indicate that all threads that libclang creates should use 3240b57cec5SDimitry Andric * background priority. 3250b57cec5SDimitry Andric */ 3260b57cec5SDimitry Andric CXGlobalOpt_ThreadBackgroundPriorityForAll = 3270b57cec5SDimitry Andric CXGlobalOpt_ThreadBackgroundPriorityForIndexing | 3280b57cec5SDimitry Andric CXGlobalOpt_ThreadBackgroundPriorityForEditing 3290b57cec5SDimitry Andric 3300b57cec5SDimitry Andric } CXGlobalOptFlags; 3310b57cec5SDimitry Andric 3320b57cec5SDimitry Andric /** 33306c3fb27SDimitry Andric * Index initialization options. 33406c3fb27SDimitry Andric * 33506c3fb27SDimitry Andric * 0 is the default value of each member of this struct except for Size. 33606c3fb27SDimitry Andric * Initialize the struct in one of the following three ways to avoid adapting 33706c3fb27SDimitry Andric * code each time a new member is added to it: 33806c3fb27SDimitry Andric * \code 33906c3fb27SDimitry Andric * CXIndexOptions Opts; 34006c3fb27SDimitry Andric * memset(&Opts, 0, sizeof(Opts)); 34106c3fb27SDimitry Andric * Opts.Size = sizeof(CXIndexOptions); 34206c3fb27SDimitry Andric * \endcode 34306c3fb27SDimitry Andric * or explicitly initialize the first data member and zero-initialize the rest: 34406c3fb27SDimitry Andric * \code 34506c3fb27SDimitry Andric * CXIndexOptions Opts = { sizeof(CXIndexOptions) }; 34606c3fb27SDimitry Andric * \endcode 34706c3fb27SDimitry Andric * or to prevent the -Wmissing-field-initializers warning for the above version: 34806c3fb27SDimitry Andric * \code 34906c3fb27SDimitry Andric * CXIndexOptions Opts{}; 35006c3fb27SDimitry Andric * Opts.Size = sizeof(CXIndexOptions); 35106c3fb27SDimitry Andric * \endcode 35206c3fb27SDimitry Andric */ 35306c3fb27SDimitry Andric typedef struct CXIndexOptions { 35406c3fb27SDimitry Andric /** 35506c3fb27SDimitry Andric * The size of struct CXIndexOptions used for option versioning. 35606c3fb27SDimitry Andric * 35706c3fb27SDimitry Andric * Always initialize this member to sizeof(CXIndexOptions), or assign 35806c3fb27SDimitry Andric * sizeof(CXIndexOptions) to it right after creating a CXIndexOptions object. 35906c3fb27SDimitry Andric */ 36006c3fb27SDimitry Andric unsigned Size; 36106c3fb27SDimitry Andric /** 36206c3fb27SDimitry Andric * A CXChoice enumerator that specifies the indexing priority policy. 36306c3fb27SDimitry Andric * \sa CXGlobalOpt_ThreadBackgroundPriorityForIndexing 36406c3fb27SDimitry Andric */ 36506c3fb27SDimitry Andric unsigned char ThreadBackgroundPriorityForIndexing; 36606c3fb27SDimitry Andric /** 36706c3fb27SDimitry Andric * A CXChoice enumerator that specifies the editing priority policy. 36806c3fb27SDimitry Andric * \sa CXGlobalOpt_ThreadBackgroundPriorityForEditing 36906c3fb27SDimitry Andric */ 37006c3fb27SDimitry Andric unsigned char ThreadBackgroundPriorityForEditing; 37106c3fb27SDimitry Andric /** 37206c3fb27SDimitry Andric * \see clang_createIndex() 37306c3fb27SDimitry Andric */ 37406c3fb27SDimitry Andric unsigned ExcludeDeclarationsFromPCH : 1; 37506c3fb27SDimitry Andric /** 37606c3fb27SDimitry Andric * \see clang_createIndex() 37706c3fb27SDimitry Andric */ 37806c3fb27SDimitry Andric unsigned DisplayDiagnostics : 1; 37906c3fb27SDimitry Andric /** 38006c3fb27SDimitry Andric * Store PCH in memory. If zero, PCH are stored in temporary files. 38106c3fb27SDimitry Andric */ 38206c3fb27SDimitry Andric unsigned StorePreamblesInMemory : 1; 38306c3fb27SDimitry Andric unsigned /*Reserved*/ : 13; 38406c3fb27SDimitry Andric 38506c3fb27SDimitry Andric /** 38606c3fb27SDimitry Andric * The path to a directory, in which to store temporary PCH files. If null or 38706c3fb27SDimitry Andric * empty, the default system temporary directory is used. These PCH files are 38806c3fb27SDimitry Andric * deleted on clean exit but stay on disk if the program crashes or is killed. 38906c3fb27SDimitry Andric * 39006c3fb27SDimitry Andric * This option is ignored if \a StorePreamblesInMemory is non-zero. 39106c3fb27SDimitry Andric * 39206c3fb27SDimitry Andric * Libclang does not create the directory at the specified path in the file 39306c3fb27SDimitry Andric * system. Therefore it must exist, or storing PCH files will fail. 39406c3fb27SDimitry Andric */ 39506c3fb27SDimitry Andric const char *PreambleStoragePath; 39606c3fb27SDimitry Andric /** 39706c3fb27SDimitry Andric * Specifies a path which will contain log files for certain libclang 39806c3fb27SDimitry Andric * invocations. A null value implies that libclang invocations are not logged. 39906c3fb27SDimitry Andric */ 40006c3fb27SDimitry Andric const char *InvocationEmissionPath; 40106c3fb27SDimitry Andric } CXIndexOptions; 40206c3fb27SDimitry Andric 40306c3fb27SDimitry Andric /** 40406c3fb27SDimitry Andric * Provides a shared context for creating translation units. 40506c3fb27SDimitry Andric * 40606c3fb27SDimitry Andric * Call this function instead of clang_createIndex() if you need to configure 40706c3fb27SDimitry Andric * the additional options in CXIndexOptions. 40806c3fb27SDimitry Andric * 40906c3fb27SDimitry Andric * \returns The created index or null in case of error, such as an unsupported 41006c3fb27SDimitry Andric * value of options->Size. 41106c3fb27SDimitry Andric * 41206c3fb27SDimitry Andric * For example: 41306c3fb27SDimitry Andric * \code 41406c3fb27SDimitry Andric * CXIndex createIndex(const char *ApplicationTemporaryPath) { 41506c3fb27SDimitry Andric * const int ExcludeDeclarationsFromPCH = 1; 41606c3fb27SDimitry Andric * const int DisplayDiagnostics = 1; 41706c3fb27SDimitry Andric * CXIndex Idx; 41806c3fb27SDimitry Andric * #if CINDEX_VERSION_MINOR >= 64 41906c3fb27SDimitry Andric * CXIndexOptions Opts; 42006c3fb27SDimitry Andric * memset(&Opts, 0, sizeof(Opts)); 42106c3fb27SDimitry Andric * Opts.Size = sizeof(CXIndexOptions); 42206c3fb27SDimitry Andric * Opts.ThreadBackgroundPriorityForIndexing = 1; 42306c3fb27SDimitry Andric * Opts.ExcludeDeclarationsFromPCH = ExcludeDeclarationsFromPCH; 42406c3fb27SDimitry Andric * Opts.DisplayDiagnostics = DisplayDiagnostics; 42506c3fb27SDimitry Andric * Opts.PreambleStoragePath = ApplicationTemporaryPath; 42606c3fb27SDimitry Andric * Idx = clang_createIndexWithOptions(&Opts); 42706c3fb27SDimitry Andric * if (Idx) 42806c3fb27SDimitry Andric * return Idx; 42906c3fb27SDimitry Andric * fprintf(stderr, 43006c3fb27SDimitry Andric * "clang_createIndexWithOptions() failed. " 43106c3fb27SDimitry Andric * "CINDEX_VERSION_MINOR = %d, sizeof(CXIndexOptions) = %u\n", 43206c3fb27SDimitry Andric * CINDEX_VERSION_MINOR, Opts.Size); 43306c3fb27SDimitry Andric * #else 43406c3fb27SDimitry Andric * (void)ApplicationTemporaryPath; 43506c3fb27SDimitry Andric * #endif 43606c3fb27SDimitry Andric * Idx = clang_createIndex(ExcludeDeclarationsFromPCH, DisplayDiagnostics); 43706c3fb27SDimitry Andric * clang_CXIndex_setGlobalOptions( 43806c3fb27SDimitry Andric * Idx, clang_CXIndex_getGlobalOptions(Idx) | 43906c3fb27SDimitry Andric * CXGlobalOpt_ThreadBackgroundPriorityForIndexing); 44006c3fb27SDimitry Andric * return Idx; 44106c3fb27SDimitry Andric * } 44206c3fb27SDimitry Andric * \endcode 44306c3fb27SDimitry Andric * 44406c3fb27SDimitry Andric * \sa clang_createIndex() 44506c3fb27SDimitry Andric */ 44606c3fb27SDimitry Andric CINDEX_LINKAGE CXIndex 44706c3fb27SDimitry Andric clang_createIndexWithOptions(const CXIndexOptions *options); 44806c3fb27SDimitry Andric 44906c3fb27SDimitry Andric /** 4500b57cec5SDimitry Andric * Sets general options associated with a CXIndex. 4510b57cec5SDimitry Andric * 45206c3fb27SDimitry Andric * This function is DEPRECATED. Set 45306c3fb27SDimitry Andric * CXIndexOptions::ThreadBackgroundPriorityForIndexing and/or 45406c3fb27SDimitry Andric * CXIndexOptions::ThreadBackgroundPriorityForEditing and call 45506c3fb27SDimitry Andric * clang_createIndexWithOptions() instead. 45606c3fb27SDimitry Andric * 4570b57cec5SDimitry Andric * For example: 4580b57cec5SDimitry Andric * \code 4590b57cec5SDimitry Andric * CXIndex idx = ...; 4600b57cec5SDimitry Andric * clang_CXIndex_setGlobalOptions(idx, 4610b57cec5SDimitry Andric * clang_CXIndex_getGlobalOptions(idx) | 4620b57cec5SDimitry Andric * CXGlobalOpt_ThreadBackgroundPriorityForIndexing); 4630b57cec5SDimitry Andric * \endcode 4640b57cec5SDimitry Andric * 4650b57cec5SDimitry Andric * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags. 4660b57cec5SDimitry Andric */ 4670b57cec5SDimitry Andric CINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options); 4680b57cec5SDimitry Andric 4690b57cec5SDimitry Andric /** 4700b57cec5SDimitry Andric * Gets the general options associated with a CXIndex. 4710b57cec5SDimitry Andric * 47206c3fb27SDimitry Andric * This function allows to obtain the final option values used by libclang after 47306c3fb27SDimitry Andric * specifying the option policies via CXChoice enumerators. 47406c3fb27SDimitry Andric * 4750b57cec5SDimitry Andric * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that 4760b57cec5SDimitry Andric * are associated with the given CXIndex object. 4770b57cec5SDimitry Andric */ 4780b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXIndex_getGlobalOptions(CXIndex); 4790b57cec5SDimitry Andric 4800b57cec5SDimitry Andric /** 4810b57cec5SDimitry Andric * Sets the invocation emission path option in a CXIndex. 4820b57cec5SDimitry Andric * 48306c3fb27SDimitry Andric * This function is DEPRECATED. Set CXIndexOptions::InvocationEmissionPath and 48406c3fb27SDimitry Andric * call clang_createIndexWithOptions() instead. 48506c3fb27SDimitry Andric * 4860b57cec5SDimitry Andric * The invocation emission path specifies a path which will contain log 4870b57cec5SDimitry Andric * files for certain libclang invocations. A null value (default) implies that 4880b57cec5SDimitry Andric * libclang invocations are not logged.. 4890b57cec5SDimitry Andric */ 4900b57cec5SDimitry Andric CINDEX_LINKAGE void 4910b57cec5SDimitry Andric clang_CXIndex_setInvocationEmissionPathOption(CXIndex, const char *Path); 4920b57cec5SDimitry Andric 4930b57cec5SDimitry Andric /** 4940b57cec5SDimitry Andric * Determine whether the given header is guarded against 4950b57cec5SDimitry Andric * multiple inclusions, either with the conventional 4960b57cec5SDimitry Andric * \#ifndef/\#define/\#endif macro guards or with \#pragma once. 4970b57cec5SDimitry Andric */ 4985ffd83dbSDimitry Andric CINDEX_LINKAGE unsigned clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, 4995ffd83dbSDimitry Andric CXFile file); 5000b57cec5SDimitry Andric 5010b57cec5SDimitry Andric /** 5020b57cec5SDimitry Andric * Retrieve a file handle within the given translation unit. 5030b57cec5SDimitry Andric * 5040b57cec5SDimitry Andric * \param tu the translation unit 5050b57cec5SDimitry Andric * 5060b57cec5SDimitry Andric * \param file_name the name of the file. 5070b57cec5SDimitry Andric * 5080b57cec5SDimitry Andric * \returns the file handle for the named file in the translation unit \p tu, 5090b57cec5SDimitry Andric * or a NULL file handle if the file was not a part of this translation unit. 5100b57cec5SDimitry Andric */ 5110b57cec5SDimitry Andric CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu, 5120b57cec5SDimitry Andric const char *file_name); 5130b57cec5SDimitry Andric 5140b57cec5SDimitry Andric /** 5150b57cec5SDimitry Andric * Retrieve the buffer associated with the given file. 5160b57cec5SDimitry Andric * 5170b57cec5SDimitry Andric * \param tu the translation unit 5180b57cec5SDimitry Andric * 5190b57cec5SDimitry Andric * \param file the file for which to retrieve the buffer. 5200b57cec5SDimitry Andric * 5210b57cec5SDimitry Andric * \param size [out] if non-NULL, will be set to the size of the buffer. 5220b57cec5SDimitry Andric * 5230b57cec5SDimitry Andric * \returns a pointer to the buffer in memory that holds the contents of 5240b57cec5SDimitry Andric * \p file, or a NULL pointer when the file is not loaded. 5250b57cec5SDimitry Andric */ 5260b57cec5SDimitry Andric CINDEX_LINKAGE const char *clang_getFileContents(CXTranslationUnit tu, 5270b57cec5SDimitry Andric CXFile file, size_t *size); 5280b57cec5SDimitry Andric 5290b57cec5SDimitry Andric /** 5300b57cec5SDimitry Andric * Retrieves the source location associated with a given file/line/column 5310b57cec5SDimitry Andric * in a particular translation unit. 5320b57cec5SDimitry Andric */ 5330b57cec5SDimitry Andric CINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu, 5345ffd83dbSDimitry Andric CXFile file, unsigned line, 5350b57cec5SDimitry Andric unsigned column); 5360b57cec5SDimitry Andric /** 5370b57cec5SDimitry Andric * Retrieves the source location associated with a given character offset 5380b57cec5SDimitry Andric * in a particular translation unit. 5390b57cec5SDimitry Andric */ 5400b57cec5SDimitry Andric CINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu, 5410b57cec5SDimitry Andric CXFile file, 5420b57cec5SDimitry Andric unsigned offset); 5430b57cec5SDimitry Andric 5440b57cec5SDimitry Andric /** 5450b57cec5SDimitry Andric * Retrieve all ranges that were skipped by the preprocessor. 5460b57cec5SDimitry Andric * 5470b57cec5SDimitry Andric * The preprocessor will skip lines when they are surrounded by an 5480b57cec5SDimitry Andric * if/ifdef/ifndef directive whose condition does not evaluate to true. 5490b57cec5SDimitry Andric */ 5500b57cec5SDimitry Andric CINDEX_LINKAGE CXSourceRangeList *clang_getSkippedRanges(CXTranslationUnit tu, 5510b57cec5SDimitry Andric CXFile file); 5520b57cec5SDimitry Andric 5530b57cec5SDimitry Andric /** 5540b57cec5SDimitry Andric * Retrieve all ranges from all files that were skipped by the 5550b57cec5SDimitry Andric * preprocessor. 5560b57cec5SDimitry Andric * 5570b57cec5SDimitry Andric * The preprocessor will skip lines when they are surrounded by an 5580b57cec5SDimitry Andric * if/ifdef/ifndef directive whose condition does not evaluate to true. 5590b57cec5SDimitry Andric */ 5605ffd83dbSDimitry Andric CINDEX_LINKAGE CXSourceRangeList * 5615ffd83dbSDimitry Andric clang_getAllSkippedRanges(CXTranslationUnit tu); 5620b57cec5SDimitry Andric 5630b57cec5SDimitry Andric /** 5640b57cec5SDimitry Andric * Determine the number of diagnostics produced for the given 5650b57cec5SDimitry Andric * translation unit. 5660b57cec5SDimitry Andric */ 5670b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit); 5680b57cec5SDimitry Andric 5690b57cec5SDimitry Andric /** 5700b57cec5SDimitry Andric * Retrieve a diagnostic associated with the given translation unit. 5710b57cec5SDimitry Andric * 5720b57cec5SDimitry Andric * \param Unit the translation unit to query. 5730b57cec5SDimitry Andric * \param Index the zero-based diagnostic number to retrieve. 5740b57cec5SDimitry Andric * 5750b57cec5SDimitry Andric * \returns the requested diagnostic. This diagnostic must be freed 5760b57cec5SDimitry Andric * via a call to \c clang_disposeDiagnostic(). 5770b57cec5SDimitry Andric */ 5780b57cec5SDimitry Andric CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, 5790b57cec5SDimitry Andric unsigned Index); 5800b57cec5SDimitry Andric 5810b57cec5SDimitry Andric /** 5820b57cec5SDimitry Andric * Retrieve the complete set of diagnostics associated with a 5830b57cec5SDimitry Andric * translation unit. 5840b57cec5SDimitry Andric * 5850b57cec5SDimitry Andric * \param Unit the translation unit to query. 5860b57cec5SDimitry Andric */ 5870b57cec5SDimitry Andric CINDEX_LINKAGE CXDiagnosticSet 5880b57cec5SDimitry Andric clang_getDiagnosticSetFromTU(CXTranslationUnit Unit); 5890b57cec5SDimitry Andric 5900b57cec5SDimitry Andric /** 5910b57cec5SDimitry Andric * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation 5920b57cec5SDimitry Andric * 5930b57cec5SDimitry Andric * The routines in this group provide the ability to create and destroy 5940b57cec5SDimitry Andric * translation units from files, either by parsing the contents of the files or 5950b57cec5SDimitry Andric * by reading in a serialized representation of a translation unit. 5960b57cec5SDimitry Andric * 5970b57cec5SDimitry Andric * @{ 5980b57cec5SDimitry Andric */ 5990b57cec5SDimitry Andric 6000b57cec5SDimitry Andric /** 6010b57cec5SDimitry Andric * Get the original translation unit source file name. 6020b57cec5SDimitry Andric */ 6030b57cec5SDimitry Andric CINDEX_LINKAGE CXString 6040b57cec5SDimitry Andric clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit); 6050b57cec5SDimitry Andric 6060b57cec5SDimitry Andric /** 6070b57cec5SDimitry Andric * Return the CXTranslationUnit for a given source file and the provided 6080b57cec5SDimitry Andric * command line arguments one would pass to the compiler. 6090b57cec5SDimitry Andric * 6100b57cec5SDimitry Andric * Note: The 'source_filename' argument is optional. If the caller provides a 6110b57cec5SDimitry Andric * NULL pointer, the name of the source file is expected to reside in the 6120b57cec5SDimitry Andric * specified command line arguments. 6130b57cec5SDimitry Andric * 6140b57cec5SDimitry Andric * Note: When encountered in 'clang_command_line_args', the following options 6150b57cec5SDimitry Andric * are ignored: 6160b57cec5SDimitry Andric * 6170b57cec5SDimitry Andric * '-c' 6180b57cec5SDimitry Andric * '-emit-ast' 6190b57cec5SDimitry Andric * '-fsyntax-only' 6200b57cec5SDimitry Andric * '-o \<output file>' (both '-o' and '\<output file>' are ignored) 6210b57cec5SDimitry Andric * 6220b57cec5SDimitry Andric * \param CIdx The index object with which the translation unit will be 6230b57cec5SDimitry Andric * associated. 6240b57cec5SDimitry Andric * 6250b57cec5SDimitry Andric * \param source_filename The name of the source file to load, or NULL if the 6260b57cec5SDimitry Andric * source file is included in \p clang_command_line_args. 6270b57cec5SDimitry Andric * 6280b57cec5SDimitry Andric * \param num_clang_command_line_args The number of command-line arguments in 6290b57cec5SDimitry Andric * \p clang_command_line_args. 6300b57cec5SDimitry Andric * 6310b57cec5SDimitry Andric * \param clang_command_line_args The command-line arguments that would be 6320b57cec5SDimitry Andric * passed to the \c clang executable if it were being invoked out-of-process. 6330b57cec5SDimitry Andric * These command-line options will be parsed and will affect how the translation 6340b57cec5SDimitry Andric * unit is parsed. Note that the following options are ignored: '-c', 6350b57cec5SDimitry Andric * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. 6360b57cec5SDimitry Andric * 6370b57cec5SDimitry Andric * \param num_unsaved_files the number of unsaved file entries in \p 6380b57cec5SDimitry Andric * unsaved_files. 6390b57cec5SDimitry Andric * 6400b57cec5SDimitry Andric * \param unsaved_files the files that have not yet been saved to disk 6410b57cec5SDimitry Andric * but may be required for code completion, including the contents of 6420b57cec5SDimitry Andric * those files. The contents and name of these files (as specified by 6430b57cec5SDimitry Andric * CXUnsavedFile) are copied when necessary, so the client only needs to 6440b57cec5SDimitry Andric * guarantee their validity until the call to this function returns. 6450b57cec5SDimitry Andric */ 6460b57cec5SDimitry Andric CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile( 6475ffd83dbSDimitry Andric CXIndex CIdx, const char *source_filename, int num_clang_command_line_args, 6485ffd83dbSDimitry Andric const char *const *clang_command_line_args, unsigned num_unsaved_files, 6490b57cec5SDimitry Andric struct CXUnsavedFile *unsaved_files); 6500b57cec5SDimitry Andric 6510b57cec5SDimitry Andric /** 6520b57cec5SDimitry Andric * Same as \c clang_createTranslationUnit2, but returns 6530b57cec5SDimitry Andric * the \c CXTranslationUnit instead of an error code. In case of an error this 6540b57cec5SDimitry Andric * routine returns a \c NULL \c CXTranslationUnit, without further detailed 6550b57cec5SDimitry Andric * error codes. 6560b57cec5SDimitry Andric */ 6575ffd83dbSDimitry Andric CINDEX_LINKAGE CXTranslationUnit 6585ffd83dbSDimitry Andric clang_createTranslationUnit(CXIndex CIdx, const char *ast_filename); 6590b57cec5SDimitry Andric 6600b57cec5SDimitry Andric /** 6610b57cec5SDimitry Andric * Create a translation unit from an AST file (\c -emit-ast). 6620b57cec5SDimitry Andric * 6630b57cec5SDimitry Andric * \param[out] out_TU A non-NULL pointer to store the created 6640b57cec5SDimitry Andric * \c CXTranslationUnit. 6650b57cec5SDimitry Andric * 6660b57cec5SDimitry Andric * \returns Zero on success, otherwise returns an error code. 6670b57cec5SDimitry Andric */ 6685ffd83dbSDimitry Andric CINDEX_LINKAGE enum CXErrorCode 6695ffd83dbSDimitry Andric clang_createTranslationUnit2(CXIndex CIdx, const char *ast_filename, 6700b57cec5SDimitry Andric CXTranslationUnit *out_TU); 6710b57cec5SDimitry Andric 6720b57cec5SDimitry Andric /** 6730b57cec5SDimitry Andric * Flags that control the creation of translation units. 6740b57cec5SDimitry Andric * 6750b57cec5SDimitry Andric * The enumerators in this enumeration type are meant to be bitwise 6760b57cec5SDimitry Andric * ORed together to specify which options should be used when 6770b57cec5SDimitry Andric * constructing the translation unit. 6780b57cec5SDimitry Andric */ 6790b57cec5SDimitry Andric enum CXTranslationUnit_Flags { 6800b57cec5SDimitry Andric /** 6810b57cec5SDimitry Andric * Used to indicate that no special translation-unit options are 6820b57cec5SDimitry Andric * needed. 6830b57cec5SDimitry Andric */ 6840b57cec5SDimitry Andric CXTranslationUnit_None = 0x0, 6850b57cec5SDimitry Andric 6860b57cec5SDimitry Andric /** 6870b57cec5SDimitry Andric * Used to indicate that the parser should construct a "detailed" 6880b57cec5SDimitry Andric * preprocessing record, including all macro definitions and instantiations. 6890b57cec5SDimitry Andric * 6900b57cec5SDimitry Andric * Constructing a detailed preprocessing record requires more memory 6910b57cec5SDimitry Andric * and time to parse, since the information contained in the record 6920b57cec5SDimitry Andric * is usually not retained. However, it can be useful for 6930b57cec5SDimitry Andric * applications that require more detailed information about the 6940b57cec5SDimitry Andric * behavior of the preprocessor. 6950b57cec5SDimitry Andric */ 6960b57cec5SDimitry Andric CXTranslationUnit_DetailedPreprocessingRecord = 0x01, 6970b57cec5SDimitry Andric 6980b57cec5SDimitry Andric /** 6990b57cec5SDimitry Andric * Used to indicate that the translation unit is incomplete. 7000b57cec5SDimitry Andric * 7010b57cec5SDimitry Andric * When a translation unit is considered "incomplete", semantic 7020b57cec5SDimitry Andric * analysis that is typically performed at the end of the 7030b57cec5SDimitry Andric * translation unit will be suppressed. For example, this suppresses 7040b57cec5SDimitry Andric * the completion of tentative declarations in C and of 7050b57cec5SDimitry Andric * instantiation of implicitly-instantiation function templates in 7060b57cec5SDimitry Andric * C++. This option is typically used when parsing a header with the 7070b57cec5SDimitry Andric * intent of producing a precompiled header. 7080b57cec5SDimitry Andric */ 7090b57cec5SDimitry Andric CXTranslationUnit_Incomplete = 0x02, 7100b57cec5SDimitry Andric 7110b57cec5SDimitry Andric /** 7120b57cec5SDimitry Andric * Used to indicate that the translation unit should be built with an 7130b57cec5SDimitry Andric * implicit precompiled header for the preamble. 7140b57cec5SDimitry Andric * 7150b57cec5SDimitry Andric * An implicit precompiled header is used as an optimization when a 7160b57cec5SDimitry Andric * particular translation unit is likely to be reparsed many times 7170b57cec5SDimitry Andric * when the sources aren't changing that often. In this case, an 7180b57cec5SDimitry Andric * implicit precompiled header will be built containing all of the 7190b57cec5SDimitry Andric * initial includes at the top of the main file (what we refer to as 7200b57cec5SDimitry Andric * the "preamble" of the file). In subsequent parses, if the 7210b57cec5SDimitry Andric * preamble or the files in it have not changed, \c 7220b57cec5SDimitry Andric * clang_reparseTranslationUnit() will re-use the implicit 7230b57cec5SDimitry Andric * precompiled header to improve parsing performance. 7240b57cec5SDimitry Andric */ 7250b57cec5SDimitry Andric CXTranslationUnit_PrecompiledPreamble = 0x04, 7260b57cec5SDimitry Andric 7270b57cec5SDimitry Andric /** 7280b57cec5SDimitry Andric * Used to indicate that the translation unit should cache some 7290b57cec5SDimitry Andric * code-completion results with each reparse of the source file. 7300b57cec5SDimitry Andric * 7310b57cec5SDimitry Andric * Caching of code-completion results is a performance optimization that 7320b57cec5SDimitry Andric * introduces some overhead to reparsing but improves the performance of 7330b57cec5SDimitry Andric * code-completion operations. 7340b57cec5SDimitry Andric */ 7350b57cec5SDimitry Andric CXTranslationUnit_CacheCompletionResults = 0x08, 7360b57cec5SDimitry Andric 7370b57cec5SDimitry Andric /** 7380b57cec5SDimitry Andric * Used to indicate that the translation unit will be serialized with 7390b57cec5SDimitry Andric * \c clang_saveTranslationUnit. 7400b57cec5SDimitry Andric * 7410b57cec5SDimitry Andric * This option is typically used when parsing a header with the intent of 7420b57cec5SDimitry Andric * producing a precompiled header. 7430b57cec5SDimitry Andric */ 7440b57cec5SDimitry Andric CXTranslationUnit_ForSerialization = 0x10, 7450b57cec5SDimitry Andric 7460b57cec5SDimitry Andric /** 7470b57cec5SDimitry Andric * DEPRECATED: Enabled chained precompiled preambles in C++. 7480b57cec5SDimitry Andric * 7490b57cec5SDimitry Andric * Note: this is a *temporary* option that is available only while 7500b57cec5SDimitry Andric * we are testing C++ precompiled preamble support. It is deprecated. 7510b57cec5SDimitry Andric */ 7520b57cec5SDimitry Andric CXTranslationUnit_CXXChainedPCH = 0x20, 7530b57cec5SDimitry Andric 7540b57cec5SDimitry Andric /** 7550b57cec5SDimitry Andric * Used to indicate that function/method bodies should be skipped while 7560b57cec5SDimitry Andric * parsing. 7570b57cec5SDimitry Andric * 7580b57cec5SDimitry Andric * This option can be used to search for declarations/definitions while 7590b57cec5SDimitry Andric * ignoring the usages. 7600b57cec5SDimitry Andric */ 7610b57cec5SDimitry Andric CXTranslationUnit_SkipFunctionBodies = 0x40, 7620b57cec5SDimitry Andric 7630b57cec5SDimitry Andric /** 7640b57cec5SDimitry Andric * Used to indicate that brief documentation comments should be 7650b57cec5SDimitry Andric * included into the set of code completions returned from this translation 7660b57cec5SDimitry Andric * unit. 7670b57cec5SDimitry Andric */ 7680b57cec5SDimitry Andric CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 0x80, 7690b57cec5SDimitry Andric 7700b57cec5SDimitry Andric /** 7710b57cec5SDimitry Andric * Used to indicate that the precompiled preamble should be created on 7720b57cec5SDimitry Andric * the first parse. Otherwise it will be created on the first reparse. This 7730b57cec5SDimitry Andric * trades runtime on the first parse (serializing the preamble takes time) for 7740b57cec5SDimitry Andric * reduced runtime on the second parse (can now reuse the preamble). 7750b57cec5SDimitry Andric */ 7760b57cec5SDimitry Andric CXTranslationUnit_CreatePreambleOnFirstParse = 0x100, 7770b57cec5SDimitry Andric 7780b57cec5SDimitry Andric /** 7790b57cec5SDimitry Andric * Do not stop processing when fatal errors are encountered. 7800b57cec5SDimitry Andric * 7810b57cec5SDimitry Andric * When fatal errors are encountered while parsing a translation unit, 7820b57cec5SDimitry Andric * semantic analysis is typically stopped early when compiling code. A common 7830b57cec5SDimitry Andric * source for fatal errors are unresolvable include files. For the 7840b57cec5SDimitry Andric * purposes of an IDE, this is undesirable behavior and as much information 7850b57cec5SDimitry Andric * as possible should be reported. Use this flag to enable this behavior. 7860b57cec5SDimitry Andric */ 7870b57cec5SDimitry Andric CXTranslationUnit_KeepGoing = 0x200, 7880b57cec5SDimitry Andric 7890b57cec5SDimitry Andric /** 7900b57cec5SDimitry Andric * Sets the preprocessor in a mode for parsing a single file only. 7910b57cec5SDimitry Andric */ 7920b57cec5SDimitry Andric CXTranslationUnit_SingleFileParse = 0x400, 7930b57cec5SDimitry Andric 7940b57cec5SDimitry Andric /** 7950b57cec5SDimitry Andric * Used in combination with CXTranslationUnit_SkipFunctionBodies to 7960b57cec5SDimitry Andric * constrain the skipping of function bodies to the preamble. 7970b57cec5SDimitry Andric * 7980b57cec5SDimitry Andric * The function bodies of the main file are not skipped. 7990b57cec5SDimitry Andric */ 8000b57cec5SDimitry Andric CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 0x800, 8010b57cec5SDimitry Andric 8020b57cec5SDimitry Andric /** 8030b57cec5SDimitry Andric * Used to indicate that attributed types should be included in CXType. 8040b57cec5SDimitry Andric */ 8050b57cec5SDimitry Andric CXTranslationUnit_IncludeAttributedTypes = 0x1000, 8060b57cec5SDimitry Andric 8070b57cec5SDimitry Andric /** 8080b57cec5SDimitry Andric * Used to indicate that implicit attributes should be visited. 8090b57cec5SDimitry Andric */ 8100b57cec5SDimitry Andric CXTranslationUnit_VisitImplicitAttributes = 0x2000, 8110b57cec5SDimitry Andric 8120b57cec5SDimitry Andric /** 8130b57cec5SDimitry Andric * Used to indicate that non-errors from included files should be ignored. 8140b57cec5SDimitry Andric * 8150b57cec5SDimitry Andric * If set, clang_getDiagnosticSetFromTU() will not report e.g. warnings from 8160b57cec5SDimitry Andric * included files anymore. This speeds up clang_getDiagnosticSetFromTU() for 8170b57cec5SDimitry Andric * the case where these warnings are not of interest, as for an IDE for 8180b57cec5SDimitry Andric * example, which typically shows only the diagnostics in the main file. 8190b57cec5SDimitry Andric */ 820a7dea167SDimitry Andric CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000, 821a7dea167SDimitry Andric 822a7dea167SDimitry Andric /** 823a7dea167SDimitry Andric * Tells the preprocessor not to skip excluded conditional blocks. 824a7dea167SDimitry Andric */ 825a7dea167SDimitry Andric CXTranslationUnit_RetainExcludedConditionalBlocks = 0x8000 8260b57cec5SDimitry Andric }; 8270b57cec5SDimitry Andric 8280b57cec5SDimitry Andric /** 8290b57cec5SDimitry Andric * Returns the set of flags that is suitable for parsing a translation 8300b57cec5SDimitry Andric * unit that is being edited. 8310b57cec5SDimitry Andric * 8320b57cec5SDimitry Andric * The set of flags returned provide options for \c clang_parseTranslationUnit() 8330b57cec5SDimitry Andric * to indicate that the translation unit is likely to be reparsed many times, 8340b57cec5SDimitry Andric * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly 8350b57cec5SDimitry Andric * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag 8360b57cec5SDimitry Andric * set contains an unspecified set of optimizations (e.g., the precompiled 8370b57cec5SDimitry Andric * preamble) geared toward improving the performance of these routines. The 8380b57cec5SDimitry Andric * set of optimizations enabled may change from one version to the next. 8390b57cec5SDimitry Andric */ 8400b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void); 8410b57cec5SDimitry Andric 8420b57cec5SDimitry Andric /** 8430b57cec5SDimitry Andric * Same as \c clang_parseTranslationUnit2, but returns 8440b57cec5SDimitry Andric * the \c CXTranslationUnit instead of an error code. In case of an error this 8450b57cec5SDimitry Andric * routine returns a \c NULL \c CXTranslationUnit, without further detailed 8460b57cec5SDimitry Andric * error codes. 8470b57cec5SDimitry Andric */ 8485ffd83dbSDimitry Andric CINDEX_LINKAGE CXTranslationUnit clang_parseTranslationUnit( 8495ffd83dbSDimitry Andric CXIndex CIdx, const char *source_filename, 8505ffd83dbSDimitry Andric const char *const *command_line_args, int num_command_line_args, 8515ffd83dbSDimitry Andric struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files, 8520b57cec5SDimitry Andric unsigned options); 8530b57cec5SDimitry Andric 8540b57cec5SDimitry Andric /** 8550b57cec5SDimitry Andric * Parse the given source file and the translation unit corresponding 8560b57cec5SDimitry Andric * to that file. 8570b57cec5SDimitry Andric * 8580b57cec5SDimitry Andric * This routine is the main entry point for the Clang C API, providing the 8590b57cec5SDimitry Andric * ability to parse a source file into a translation unit that can then be 8600b57cec5SDimitry Andric * queried by other functions in the API. This routine accepts a set of 8610b57cec5SDimitry Andric * command-line arguments so that the compilation can be configured in the same 8620b57cec5SDimitry Andric * way that the compiler is configured on the command line. 8630b57cec5SDimitry Andric * 8640b57cec5SDimitry Andric * \param CIdx The index object with which the translation unit will be 8650b57cec5SDimitry Andric * associated. 8660b57cec5SDimitry Andric * 8670b57cec5SDimitry Andric * \param source_filename The name of the source file to load, or NULL if the 8680b57cec5SDimitry Andric * source file is included in \c command_line_args. 8690b57cec5SDimitry Andric * 8700b57cec5SDimitry Andric * \param command_line_args The command-line arguments that would be 8710b57cec5SDimitry Andric * passed to the \c clang executable if it were being invoked out-of-process. 8720b57cec5SDimitry Andric * These command-line options will be parsed and will affect how the translation 8730b57cec5SDimitry Andric * unit is parsed. Note that the following options are ignored: '-c', 8740b57cec5SDimitry Andric * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. 8750b57cec5SDimitry Andric * 8760b57cec5SDimitry Andric * \param num_command_line_args The number of command-line arguments in 8770b57cec5SDimitry Andric * \c command_line_args. 8780b57cec5SDimitry Andric * 8790b57cec5SDimitry Andric * \param unsaved_files the files that have not yet been saved to disk 8800b57cec5SDimitry Andric * but may be required for parsing, including the contents of 8810b57cec5SDimitry Andric * those files. The contents and name of these files (as specified by 8820b57cec5SDimitry Andric * CXUnsavedFile) are copied when necessary, so the client only needs to 8830b57cec5SDimitry Andric * guarantee their validity until the call to this function returns. 8840b57cec5SDimitry Andric * 8850b57cec5SDimitry Andric * \param num_unsaved_files the number of unsaved file entries in \p 8860b57cec5SDimitry Andric * unsaved_files. 8870b57cec5SDimitry Andric * 8880b57cec5SDimitry Andric * \param options A bitmask of options that affects how the translation unit 8890b57cec5SDimitry Andric * is managed but not its compilation. This should be a bitwise OR of the 8900b57cec5SDimitry Andric * CXTranslationUnit_XXX flags. 8910b57cec5SDimitry Andric * 8920b57cec5SDimitry Andric * \param[out] out_TU A non-NULL pointer to store the created 8930b57cec5SDimitry Andric * \c CXTranslationUnit, describing the parsed code and containing any 8940b57cec5SDimitry Andric * diagnostics produced by the compiler. 8950b57cec5SDimitry Andric * 8960b57cec5SDimitry Andric * \returns Zero on success, otherwise returns an error code. 8970b57cec5SDimitry Andric */ 8985ffd83dbSDimitry Andric CINDEX_LINKAGE enum CXErrorCode clang_parseTranslationUnit2( 8995ffd83dbSDimitry Andric CXIndex CIdx, const char *source_filename, 9005ffd83dbSDimitry Andric const char *const *command_line_args, int num_command_line_args, 9015ffd83dbSDimitry Andric struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files, 9025ffd83dbSDimitry Andric unsigned options, CXTranslationUnit *out_TU); 9030b57cec5SDimitry Andric 9040b57cec5SDimitry Andric /** 9050b57cec5SDimitry Andric * Same as clang_parseTranslationUnit2 but requires a full command line 9060b57cec5SDimitry Andric * for \c command_line_args including argv[0]. This is useful if the standard 9070b57cec5SDimitry Andric * library paths are relative to the binary. 9080b57cec5SDimitry Andric */ 9090b57cec5SDimitry Andric CINDEX_LINKAGE enum CXErrorCode clang_parseTranslationUnit2FullArgv( 9100b57cec5SDimitry Andric CXIndex CIdx, const char *source_filename, 9110b57cec5SDimitry Andric const char *const *command_line_args, int num_command_line_args, 9120b57cec5SDimitry Andric struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files, 9130b57cec5SDimitry Andric unsigned options, CXTranslationUnit *out_TU); 9140b57cec5SDimitry Andric 9150b57cec5SDimitry Andric /** 9160b57cec5SDimitry Andric * Flags that control how translation units are saved. 9170b57cec5SDimitry Andric * 9180b57cec5SDimitry Andric * The enumerators in this enumeration type are meant to be bitwise 9190b57cec5SDimitry Andric * ORed together to specify which options should be used when 9200b57cec5SDimitry Andric * saving the translation unit. 9210b57cec5SDimitry Andric */ 9220b57cec5SDimitry Andric enum CXSaveTranslationUnit_Flags { 9230b57cec5SDimitry Andric /** 9240b57cec5SDimitry Andric * Used to indicate that no special saving options are needed. 9250b57cec5SDimitry Andric */ 9260b57cec5SDimitry Andric CXSaveTranslationUnit_None = 0x0 9270b57cec5SDimitry Andric }; 9280b57cec5SDimitry Andric 9290b57cec5SDimitry Andric /** 9300b57cec5SDimitry Andric * Returns the set of flags that is suitable for saving a translation 9310b57cec5SDimitry Andric * unit. 9320b57cec5SDimitry Andric * 9330b57cec5SDimitry Andric * The set of flags returned provide options for 9340b57cec5SDimitry Andric * \c clang_saveTranslationUnit() by default. The returned flag 9350b57cec5SDimitry Andric * set contains an unspecified set of options that save translation units with 9360b57cec5SDimitry Andric * the most commonly-requested data. 9370b57cec5SDimitry Andric */ 9380b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU); 9390b57cec5SDimitry Andric 9400b57cec5SDimitry Andric /** 9410b57cec5SDimitry Andric * Describes the kind of error that occurred (if any) in a call to 9420b57cec5SDimitry Andric * \c clang_saveTranslationUnit(). 9430b57cec5SDimitry Andric */ 9440b57cec5SDimitry Andric enum CXSaveError { 9450b57cec5SDimitry Andric /** 9460b57cec5SDimitry Andric * Indicates that no error occurred while saving a translation unit. 9470b57cec5SDimitry Andric */ 9480b57cec5SDimitry Andric CXSaveError_None = 0, 9490b57cec5SDimitry Andric 9500b57cec5SDimitry Andric /** 9510b57cec5SDimitry Andric * Indicates that an unknown error occurred while attempting to save 9520b57cec5SDimitry Andric * the file. 9530b57cec5SDimitry Andric * 9540b57cec5SDimitry Andric * This error typically indicates that file I/O failed when attempting to 9550b57cec5SDimitry Andric * write the file. 9560b57cec5SDimitry Andric */ 9570b57cec5SDimitry Andric CXSaveError_Unknown = 1, 9580b57cec5SDimitry Andric 9590b57cec5SDimitry Andric /** 9600b57cec5SDimitry Andric * Indicates that errors during translation prevented this attempt 9610b57cec5SDimitry Andric * to save the translation unit. 9620b57cec5SDimitry Andric * 9630b57cec5SDimitry Andric * Errors that prevent the translation unit from being saved can be 9640b57cec5SDimitry Andric * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic(). 9650b57cec5SDimitry Andric */ 9660b57cec5SDimitry Andric CXSaveError_TranslationErrors = 2, 9670b57cec5SDimitry Andric 9680b57cec5SDimitry Andric /** 9690b57cec5SDimitry Andric * Indicates that the translation unit to be saved was somehow 9700b57cec5SDimitry Andric * invalid (e.g., NULL). 9710b57cec5SDimitry Andric */ 9720b57cec5SDimitry Andric CXSaveError_InvalidTU = 3 9730b57cec5SDimitry Andric }; 9740b57cec5SDimitry Andric 9750b57cec5SDimitry Andric /** 9760b57cec5SDimitry Andric * Saves a translation unit into a serialized representation of 9770b57cec5SDimitry Andric * that translation unit on disk. 9780b57cec5SDimitry Andric * 9790b57cec5SDimitry Andric * Any translation unit that was parsed without error can be saved 9800b57cec5SDimitry Andric * into a file. The translation unit can then be deserialized into a 9810b57cec5SDimitry Andric * new \c CXTranslationUnit with \c clang_createTranslationUnit() or, 9820b57cec5SDimitry Andric * if it is an incomplete translation unit that corresponds to a 9830b57cec5SDimitry Andric * header, used as a precompiled header when parsing other translation 9840b57cec5SDimitry Andric * units. 9850b57cec5SDimitry Andric * 9860b57cec5SDimitry Andric * \param TU The translation unit to save. 9870b57cec5SDimitry Andric * 9880b57cec5SDimitry Andric * \param FileName The file to which the translation unit will be saved. 9890b57cec5SDimitry Andric * 9900b57cec5SDimitry Andric * \param options A bitmask of options that affects how the translation unit 9910b57cec5SDimitry Andric * is saved. This should be a bitwise OR of the 9920b57cec5SDimitry Andric * CXSaveTranslationUnit_XXX flags. 9930b57cec5SDimitry Andric * 9940b57cec5SDimitry Andric * \returns A value that will match one of the enumerators of the CXSaveError 9950b57cec5SDimitry Andric * enumeration. Zero (CXSaveError_None) indicates that the translation unit was 9960b57cec5SDimitry Andric * saved successfully, while a non-zero value indicates that a problem occurred. 9970b57cec5SDimitry Andric */ 9980b57cec5SDimitry Andric CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU, 9990b57cec5SDimitry Andric const char *FileName, 10000b57cec5SDimitry Andric unsigned options); 10010b57cec5SDimitry Andric 10020b57cec5SDimitry Andric /** 10030b57cec5SDimitry Andric * Suspend a translation unit in order to free memory associated with it. 10040b57cec5SDimitry Andric * 10050b57cec5SDimitry Andric * A suspended translation unit uses significantly less memory but on the other 10060b57cec5SDimitry Andric * side does not support any other calls than \c clang_reparseTranslationUnit 10070b57cec5SDimitry Andric * to resume it or \c clang_disposeTranslationUnit to dispose it completely. 10080b57cec5SDimitry Andric */ 10090b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_suspendTranslationUnit(CXTranslationUnit); 10100b57cec5SDimitry Andric 10110b57cec5SDimitry Andric /** 10120b57cec5SDimitry Andric * Destroy the specified CXTranslationUnit object. 10130b57cec5SDimitry Andric */ 10140b57cec5SDimitry Andric CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit); 10150b57cec5SDimitry Andric 10160b57cec5SDimitry Andric /** 10170b57cec5SDimitry Andric * Flags that control the reparsing of translation units. 10180b57cec5SDimitry Andric * 10190b57cec5SDimitry Andric * The enumerators in this enumeration type are meant to be bitwise 10200b57cec5SDimitry Andric * ORed together to specify which options should be used when 10210b57cec5SDimitry Andric * reparsing the translation unit. 10220b57cec5SDimitry Andric */ 10230b57cec5SDimitry Andric enum CXReparse_Flags { 10240b57cec5SDimitry Andric /** 10250b57cec5SDimitry Andric * Used to indicate that no special reparsing options are needed. 10260b57cec5SDimitry Andric */ 10270b57cec5SDimitry Andric CXReparse_None = 0x0 10280b57cec5SDimitry Andric }; 10290b57cec5SDimitry Andric 10300b57cec5SDimitry Andric /** 10310b57cec5SDimitry Andric * Returns the set of flags that is suitable for reparsing a translation 10320b57cec5SDimitry Andric * unit. 10330b57cec5SDimitry Andric * 10340b57cec5SDimitry Andric * The set of flags returned provide options for 10350b57cec5SDimitry Andric * \c clang_reparseTranslationUnit() by default. The returned flag 10360b57cec5SDimitry Andric * set contains an unspecified set of optimizations geared toward common uses 10370b57cec5SDimitry Andric * of reparsing. The set of optimizations enabled may change from one version 10380b57cec5SDimitry Andric * to the next. 10390b57cec5SDimitry Andric */ 10400b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU); 10410b57cec5SDimitry Andric 10420b57cec5SDimitry Andric /** 10430b57cec5SDimitry Andric * Reparse the source files that produced this translation unit. 10440b57cec5SDimitry Andric * 10450b57cec5SDimitry Andric * This routine can be used to re-parse the source files that originally 10460b57cec5SDimitry Andric * created the given translation unit, for example because those source files 10470b57cec5SDimitry Andric * have changed (either on disk or as passed via \p unsaved_files). The 10480b57cec5SDimitry Andric * source code will be reparsed with the same command-line options as it 10490b57cec5SDimitry Andric * was originally parsed. 10500b57cec5SDimitry Andric * 10510b57cec5SDimitry Andric * Reparsing a translation unit invalidates all cursors and source locations 10520b57cec5SDimitry Andric * that refer into that translation unit. This makes reparsing a translation 10530b57cec5SDimitry Andric * unit semantically equivalent to destroying the translation unit and then 10540b57cec5SDimitry Andric * creating a new translation unit with the same command-line arguments. 10550b57cec5SDimitry Andric * However, it may be more efficient to reparse a translation 10560b57cec5SDimitry Andric * unit using this routine. 10570b57cec5SDimitry Andric * 10580b57cec5SDimitry Andric * \param TU The translation unit whose contents will be re-parsed. The 10590b57cec5SDimitry Andric * translation unit must originally have been built with 10600b57cec5SDimitry Andric * \c clang_createTranslationUnitFromSourceFile(). 10610b57cec5SDimitry Andric * 10620b57cec5SDimitry Andric * \param num_unsaved_files The number of unsaved file entries in \p 10630b57cec5SDimitry Andric * unsaved_files. 10640b57cec5SDimitry Andric * 10650b57cec5SDimitry Andric * \param unsaved_files The files that have not yet been saved to disk 10660b57cec5SDimitry Andric * but may be required for parsing, including the contents of 10670b57cec5SDimitry Andric * those files. The contents and name of these files (as specified by 10680b57cec5SDimitry Andric * CXUnsavedFile) are copied when necessary, so the client only needs to 10690b57cec5SDimitry Andric * guarantee their validity until the call to this function returns. 10700b57cec5SDimitry Andric * 10710b57cec5SDimitry Andric * \param options A bitset of options composed of the flags in CXReparse_Flags. 10720b57cec5SDimitry Andric * The function \c clang_defaultReparseOptions() produces a default set of 10730b57cec5SDimitry Andric * options recommended for most uses, based on the translation unit. 10740b57cec5SDimitry Andric * 10750b57cec5SDimitry Andric * \returns 0 if the sources could be reparsed. A non-zero error code will be 10760b57cec5SDimitry Andric * returned if reparsing was impossible, such that the translation unit is 10770b57cec5SDimitry Andric * invalid. In such cases, the only valid call for \c TU is 10780b57cec5SDimitry Andric * \c clang_disposeTranslationUnit(TU). The error codes returned by this 10790b57cec5SDimitry Andric * routine are described by the \c CXErrorCode enum. 10800b57cec5SDimitry Andric */ 10815ffd83dbSDimitry Andric CINDEX_LINKAGE int 10825ffd83dbSDimitry Andric clang_reparseTranslationUnit(CXTranslationUnit TU, unsigned num_unsaved_files, 10830b57cec5SDimitry Andric struct CXUnsavedFile *unsaved_files, 10840b57cec5SDimitry Andric unsigned options); 10850b57cec5SDimitry Andric 10860b57cec5SDimitry Andric /** 10870b57cec5SDimitry Andric * Categorizes how memory is being used by a translation unit. 10880b57cec5SDimitry Andric */ 10890b57cec5SDimitry Andric enum CXTUResourceUsageKind { 10900b57cec5SDimitry Andric CXTUResourceUsage_AST = 1, 10910b57cec5SDimitry Andric CXTUResourceUsage_Identifiers = 2, 10920b57cec5SDimitry Andric CXTUResourceUsage_Selectors = 3, 10930b57cec5SDimitry Andric CXTUResourceUsage_GlobalCompletionResults = 4, 10940b57cec5SDimitry Andric CXTUResourceUsage_SourceManagerContentCache = 5, 10950b57cec5SDimitry Andric CXTUResourceUsage_AST_SideTables = 6, 10960b57cec5SDimitry Andric CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7, 10970b57cec5SDimitry Andric CXTUResourceUsage_SourceManager_Membuffer_MMap = 8, 10980b57cec5SDimitry Andric CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9, 10990b57cec5SDimitry Andric CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10, 11000b57cec5SDimitry Andric CXTUResourceUsage_Preprocessor = 11, 11010b57cec5SDimitry Andric CXTUResourceUsage_PreprocessingRecord = 12, 11020b57cec5SDimitry Andric CXTUResourceUsage_SourceManager_DataStructures = 13, 11030b57cec5SDimitry Andric CXTUResourceUsage_Preprocessor_HeaderSearch = 14, 11040b57cec5SDimitry Andric CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST, 11050b57cec5SDimitry Andric CXTUResourceUsage_MEMORY_IN_BYTES_END = 11060b57cec5SDimitry Andric CXTUResourceUsage_Preprocessor_HeaderSearch, 11070b57cec5SDimitry Andric 11080b57cec5SDimitry Andric CXTUResourceUsage_First = CXTUResourceUsage_AST, 11090b57cec5SDimitry Andric CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch 11100b57cec5SDimitry Andric }; 11110b57cec5SDimitry Andric 11120b57cec5SDimitry Andric /** 11130b57cec5SDimitry Andric * Returns the human-readable null-terminated C string that represents 11140b57cec5SDimitry Andric * the name of the memory category. This string should never be freed. 11150b57cec5SDimitry Andric */ 11160b57cec5SDimitry Andric CINDEX_LINKAGE 11170b57cec5SDimitry Andric const char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind); 11180b57cec5SDimitry Andric 11190b57cec5SDimitry Andric typedef struct CXTUResourceUsageEntry { 11200b57cec5SDimitry Andric /* The memory usage category. */ 11210b57cec5SDimitry Andric enum CXTUResourceUsageKind kind; 11220b57cec5SDimitry Andric /* Amount of resources used. 11230b57cec5SDimitry Andric The units will depend on the resource kind. */ 11240b57cec5SDimitry Andric unsigned long amount; 11250b57cec5SDimitry Andric } CXTUResourceUsageEntry; 11260b57cec5SDimitry Andric 11270b57cec5SDimitry Andric /** 11280b57cec5SDimitry Andric * The memory usage of a CXTranslationUnit, broken into categories. 11290b57cec5SDimitry Andric */ 11300b57cec5SDimitry Andric typedef struct CXTUResourceUsage { 11310b57cec5SDimitry Andric /* Private data member, used for queries. */ 11320b57cec5SDimitry Andric void *data; 11330b57cec5SDimitry Andric 11340b57cec5SDimitry Andric /* The number of entries in the 'entries' array. */ 11350b57cec5SDimitry Andric unsigned numEntries; 11360b57cec5SDimitry Andric 11370b57cec5SDimitry Andric /* An array of key-value pairs, representing the breakdown of memory 11380b57cec5SDimitry Andric usage. */ 11390b57cec5SDimitry Andric CXTUResourceUsageEntry *entries; 11400b57cec5SDimitry Andric 11410b57cec5SDimitry Andric } CXTUResourceUsage; 11420b57cec5SDimitry Andric 11430b57cec5SDimitry Andric /** 11440b57cec5SDimitry Andric * Return the memory usage of a translation unit. This object 11450b57cec5SDimitry Andric * should be released with clang_disposeCXTUResourceUsage(). 11460b57cec5SDimitry Andric */ 11475ffd83dbSDimitry Andric CINDEX_LINKAGE CXTUResourceUsage 11485ffd83dbSDimitry Andric clang_getCXTUResourceUsage(CXTranslationUnit TU); 11490b57cec5SDimitry Andric 11500b57cec5SDimitry Andric CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage); 11510b57cec5SDimitry Andric 11520b57cec5SDimitry Andric /** 11530b57cec5SDimitry Andric * Get target information for this translation unit. 11540b57cec5SDimitry Andric * 11550b57cec5SDimitry Andric * The CXTargetInfo object cannot outlive the CXTranslationUnit object. 11560b57cec5SDimitry Andric */ 11570b57cec5SDimitry Andric CINDEX_LINKAGE CXTargetInfo 11580b57cec5SDimitry Andric clang_getTranslationUnitTargetInfo(CXTranslationUnit CTUnit); 11590b57cec5SDimitry Andric 11600b57cec5SDimitry Andric /** 11610b57cec5SDimitry Andric * Destroy the CXTargetInfo object. 11620b57cec5SDimitry Andric */ 11635ffd83dbSDimitry Andric CINDEX_LINKAGE void clang_TargetInfo_dispose(CXTargetInfo Info); 11640b57cec5SDimitry Andric 11650b57cec5SDimitry Andric /** 11660b57cec5SDimitry Andric * Get the normalized target triple as a string. 11670b57cec5SDimitry Andric * 11680b57cec5SDimitry Andric * Returns the empty string in case of any error. 11690b57cec5SDimitry Andric */ 11705ffd83dbSDimitry Andric CINDEX_LINKAGE CXString clang_TargetInfo_getTriple(CXTargetInfo Info); 11710b57cec5SDimitry Andric 11720b57cec5SDimitry Andric /** 11730b57cec5SDimitry Andric * Get the pointer width of the target in bits. 11740b57cec5SDimitry Andric * 11750b57cec5SDimitry Andric * Returns -1 in case of error. 11760b57cec5SDimitry Andric */ 11775ffd83dbSDimitry Andric CINDEX_LINKAGE int clang_TargetInfo_getPointerWidth(CXTargetInfo Info); 11780b57cec5SDimitry Andric 11790b57cec5SDimitry Andric /** 11800b57cec5SDimitry Andric * @} 11810b57cec5SDimitry Andric */ 11820b57cec5SDimitry Andric 11830b57cec5SDimitry Andric /** 11840b57cec5SDimitry Andric * Describes the kind of entity that a cursor refers to. 11850b57cec5SDimitry Andric */ 11860b57cec5SDimitry Andric enum CXCursorKind { 11870b57cec5SDimitry Andric /* Declarations */ 11880b57cec5SDimitry Andric /** 11890b57cec5SDimitry Andric * A declaration whose specific kind is not exposed via this 11900b57cec5SDimitry Andric * interface. 11910b57cec5SDimitry Andric * 11920b57cec5SDimitry Andric * Unexposed declarations have the same operations as any other kind 11930b57cec5SDimitry Andric * of declaration; one can extract their location information, 11940b57cec5SDimitry Andric * spelling, find their definitions, etc. However, the specific kind 11950b57cec5SDimitry Andric * of the declaration is not reported. 11960b57cec5SDimitry Andric */ 11970b57cec5SDimitry Andric CXCursor_UnexposedDecl = 1, 11980b57cec5SDimitry Andric /** A C or C++ struct. */ 11990b57cec5SDimitry Andric CXCursor_StructDecl = 2, 12000b57cec5SDimitry Andric /** A C or C++ union. */ 12010b57cec5SDimitry Andric CXCursor_UnionDecl = 3, 12020b57cec5SDimitry Andric /** A C++ class. */ 12030b57cec5SDimitry Andric CXCursor_ClassDecl = 4, 12040b57cec5SDimitry Andric /** An enumeration. */ 12050b57cec5SDimitry Andric CXCursor_EnumDecl = 5, 12060b57cec5SDimitry Andric /** 12070b57cec5SDimitry Andric * A field (in C) or non-static data member (in C++) in a 12080b57cec5SDimitry Andric * struct, union, or C++ class. 12090b57cec5SDimitry Andric */ 12100b57cec5SDimitry Andric CXCursor_FieldDecl = 6, 12110b57cec5SDimitry Andric /** An enumerator constant. */ 12120b57cec5SDimitry Andric CXCursor_EnumConstantDecl = 7, 12130b57cec5SDimitry Andric /** A function. */ 12140b57cec5SDimitry Andric CXCursor_FunctionDecl = 8, 12150b57cec5SDimitry Andric /** A variable. */ 12160b57cec5SDimitry Andric CXCursor_VarDecl = 9, 12170b57cec5SDimitry Andric /** A function or method parameter. */ 12180b57cec5SDimitry Andric CXCursor_ParmDecl = 10, 12190b57cec5SDimitry Andric /** An Objective-C \@interface. */ 12200b57cec5SDimitry Andric CXCursor_ObjCInterfaceDecl = 11, 12210b57cec5SDimitry Andric /** An Objective-C \@interface for a category. */ 12220b57cec5SDimitry Andric CXCursor_ObjCCategoryDecl = 12, 12230b57cec5SDimitry Andric /** An Objective-C \@protocol declaration. */ 12240b57cec5SDimitry Andric CXCursor_ObjCProtocolDecl = 13, 12250b57cec5SDimitry Andric /** An Objective-C \@property declaration. */ 12260b57cec5SDimitry Andric CXCursor_ObjCPropertyDecl = 14, 12270b57cec5SDimitry Andric /** An Objective-C instance variable. */ 12280b57cec5SDimitry Andric CXCursor_ObjCIvarDecl = 15, 12290b57cec5SDimitry Andric /** An Objective-C instance method. */ 12300b57cec5SDimitry Andric CXCursor_ObjCInstanceMethodDecl = 16, 12310b57cec5SDimitry Andric /** An Objective-C class method. */ 12320b57cec5SDimitry Andric CXCursor_ObjCClassMethodDecl = 17, 12330b57cec5SDimitry Andric /** An Objective-C \@implementation. */ 12340b57cec5SDimitry Andric CXCursor_ObjCImplementationDecl = 18, 12350b57cec5SDimitry Andric /** An Objective-C \@implementation for a category. */ 12360b57cec5SDimitry Andric CXCursor_ObjCCategoryImplDecl = 19, 12370b57cec5SDimitry Andric /** A typedef. */ 12380b57cec5SDimitry Andric CXCursor_TypedefDecl = 20, 12390b57cec5SDimitry Andric /** A C++ class method. */ 12400b57cec5SDimitry Andric CXCursor_CXXMethod = 21, 12410b57cec5SDimitry Andric /** A C++ namespace. */ 12420b57cec5SDimitry Andric CXCursor_Namespace = 22, 12430b57cec5SDimitry Andric /** A linkage specification, e.g. 'extern "C"'. */ 12440b57cec5SDimitry Andric CXCursor_LinkageSpec = 23, 12450b57cec5SDimitry Andric /** A C++ constructor. */ 12460b57cec5SDimitry Andric CXCursor_Constructor = 24, 12470b57cec5SDimitry Andric /** A C++ destructor. */ 12480b57cec5SDimitry Andric CXCursor_Destructor = 25, 12490b57cec5SDimitry Andric /** A C++ conversion function. */ 12500b57cec5SDimitry Andric CXCursor_ConversionFunction = 26, 12510b57cec5SDimitry Andric /** A C++ template type parameter. */ 12520b57cec5SDimitry Andric CXCursor_TemplateTypeParameter = 27, 12530b57cec5SDimitry Andric /** A C++ non-type template parameter. */ 12540b57cec5SDimitry Andric CXCursor_NonTypeTemplateParameter = 28, 12550b57cec5SDimitry Andric /** A C++ template template parameter. */ 12560b57cec5SDimitry Andric CXCursor_TemplateTemplateParameter = 29, 12570b57cec5SDimitry Andric /** A C++ function template. */ 12580b57cec5SDimitry Andric CXCursor_FunctionTemplate = 30, 12590b57cec5SDimitry Andric /** A C++ class template. */ 12600b57cec5SDimitry Andric CXCursor_ClassTemplate = 31, 12610b57cec5SDimitry Andric /** A C++ class template partial specialization. */ 12620b57cec5SDimitry Andric CXCursor_ClassTemplatePartialSpecialization = 32, 12630b57cec5SDimitry Andric /** A C++ namespace alias declaration. */ 12640b57cec5SDimitry Andric CXCursor_NamespaceAlias = 33, 12650b57cec5SDimitry Andric /** A C++ using directive. */ 12660b57cec5SDimitry Andric CXCursor_UsingDirective = 34, 12670b57cec5SDimitry Andric /** A C++ using declaration. */ 12680b57cec5SDimitry Andric CXCursor_UsingDeclaration = 35, 12690b57cec5SDimitry Andric /** A C++ alias declaration */ 12700b57cec5SDimitry Andric CXCursor_TypeAliasDecl = 36, 12710b57cec5SDimitry Andric /** An Objective-C \@synthesize definition. */ 12720b57cec5SDimitry Andric CXCursor_ObjCSynthesizeDecl = 37, 12730b57cec5SDimitry Andric /** An Objective-C \@dynamic definition. */ 12740b57cec5SDimitry Andric CXCursor_ObjCDynamicDecl = 38, 12750b57cec5SDimitry Andric /** An access specifier. */ 12760b57cec5SDimitry Andric CXCursor_CXXAccessSpecifier = 39, 12770b57cec5SDimitry Andric 12780b57cec5SDimitry Andric CXCursor_FirstDecl = CXCursor_UnexposedDecl, 12790b57cec5SDimitry Andric CXCursor_LastDecl = CXCursor_CXXAccessSpecifier, 12800b57cec5SDimitry Andric 12810b57cec5SDimitry Andric /* References */ 12820b57cec5SDimitry Andric CXCursor_FirstRef = 40, /* Decl references */ 12830b57cec5SDimitry Andric CXCursor_ObjCSuperClassRef = 40, 12840b57cec5SDimitry Andric CXCursor_ObjCProtocolRef = 41, 12850b57cec5SDimitry Andric CXCursor_ObjCClassRef = 42, 12860b57cec5SDimitry Andric /** 12870b57cec5SDimitry Andric * A reference to a type declaration. 12880b57cec5SDimitry Andric * 12890b57cec5SDimitry Andric * A type reference occurs anywhere where a type is named but not 12900b57cec5SDimitry Andric * declared. For example, given: 12910b57cec5SDimitry Andric * 12920b57cec5SDimitry Andric * \code 12930b57cec5SDimitry Andric * typedef unsigned size_type; 12940b57cec5SDimitry Andric * size_type size; 12950b57cec5SDimitry Andric * \endcode 12960b57cec5SDimitry Andric * 12970b57cec5SDimitry Andric * The typedef is a declaration of size_type (CXCursor_TypedefDecl), 12980b57cec5SDimitry Andric * while the type of the variable "size" is referenced. The cursor 12990b57cec5SDimitry Andric * referenced by the type of size is the typedef for size_type. 13000b57cec5SDimitry Andric */ 13010b57cec5SDimitry Andric CXCursor_TypeRef = 43, 13020b57cec5SDimitry Andric CXCursor_CXXBaseSpecifier = 44, 13030b57cec5SDimitry Andric /** 13040b57cec5SDimitry Andric * A reference to a class template, function template, template 13050b57cec5SDimitry Andric * template parameter, or class template partial specialization. 13060b57cec5SDimitry Andric */ 13070b57cec5SDimitry Andric CXCursor_TemplateRef = 45, 13080b57cec5SDimitry Andric /** 13090b57cec5SDimitry Andric * A reference to a namespace or namespace alias. 13100b57cec5SDimitry Andric */ 13110b57cec5SDimitry Andric CXCursor_NamespaceRef = 46, 13120b57cec5SDimitry Andric /** 13130b57cec5SDimitry Andric * A reference to a member of a struct, union, or class that occurs in 13140b57cec5SDimitry Andric * some non-expression context, e.g., a designated initializer. 13150b57cec5SDimitry Andric */ 13160b57cec5SDimitry Andric CXCursor_MemberRef = 47, 13170b57cec5SDimitry Andric /** 13180b57cec5SDimitry Andric * A reference to a labeled statement. 13190b57cec5SDimitry Andric * 13200b57cec5SDimitry Andric * This cursor kind is used to describe the jump to "start_over" in the 13210b57cec5SDimitry Andric * goto statement in the following example: 13220b57cec5SDimitry Andric * 13230b57cec5SDimitry Andric * \code 13240b57cec5SDimitry Andric * start_over: 13250b57cec5SDimitry Andric * ++counter; 13260b57cec5SDimitry Andric * 13270b57cec5SDimitry Andric * goto start_over; 13280b57cec5SDimitry Andric * \endcode 13290b57cec5SDimitry Andric * 13300b57cec5SDimitry Andric * A label reference cursor refers to a label statement. 13310b57cec5SDimitry Andric */ 13320b57cec5SDimitry Andric CXCursor_LabelRef = 48, 13330b57cec5SDimitry Andric 13340b57cec5SDimitry Andric /** 13350b57cec5SDimitry Andric * A reference to a set of overloaded functions or function templates 13360b57cec5SDimitry Andric * that has not yet been resolved to a specific function or function template. 13370b57cec5SDimitry Andric * 13380b57cec5SDimitry Andric * An overloaded declaration reference cursor occurs in C++ templates where 13390b57cec5SDimitry Andric * a dependent name refers to a function. For example: 13400b57cec5SDimitry Andric * 13410b57cec5SDimitry Andric * \code 13420b57cec5SDimitry Andric * template<typename T> void swap(T&, T&); 13430b57cec5SDimitry Andric * 13440b57cec5SDimitry Andric * struct X { ... }; 13450b57cec5SDimitry Andric * void swap(X&, X&); 13460b57cec5SDimitry Andric * 13470b57cec5SDimitry Andric * template<typename T> 13480b57cec5SDimitry Andric * void reverse(T* first, T* last) { 13490b57cec5SDimitry Andric * while (first < last - 1) { 13500b57cec5SDimitry Andric * swap(*first, *--last); 13510b57cec5SDimitry Andric * ++first; 13520b57cec5SDimitry Andric * } 13530b57cec5SDimitry Andric * } 13540b57cec5SDimitry Andric * 13550b57cec5SDimitry Andric * struct Y { }; 13560b57cec5SDimitry Andric * void swap(Y&, Y&); 13570b57cec5SDimitry Andric * \endcode 13580b57cec5SDimitry Andric * 13590b57cec5SDimitry Andric * Here, the identifier "swap" is associated with an overloaded declaration 13600b57cec5SDimitry Andric * reference. In the template definition, "swap" refers to either of the two 13610b57cec5SDimitry Andric * "swap" functions declared above, so both results will be available. At 13620b57cec5SDimitry Andric * instantiation time, "swap" may also refer to other functions found via 13630b57cec5SDimitry Andric * argument-dependent lookup (e.g., the "swap" function at the end of the 13640b57cec5SDimitry Andric * example). 13650b57cec5SDimitry Andric * 13660b57cec5SDimitry Andric * The functions \c clang_getNumOverloadedDecls() and 13670b57cec5SDimitry Andric * \c clang_getOverloadedDecl() can be used to retrieve the definitions 13680b57cec5SDimitry Andric * referenced by this cursor. 13690b57cec5SDimitry Andric */ 13700b57cec5SDimitry Andric CXCursor_OverloadedDeclRef = 49, 13710b57cec5SDimitry Andric 13720b57cec5SDimitry Andric /** 13730b57cec5SDimitry Andric * A reference to a variable that occurs in some non-expression 13740b57cec5SDimitry Andric * context, e.g., a C++ lambda capture list. 13750b57cec5SDimitry Andric */ 13760b57cec5SDimitry Andric CXCursor_VariableRef = 50, 13770b57cec5SDimitry Andric 13780b57cec5SDimitry Andric CXCursor_LastRef = CXCursor_VariableRef, 13790b57cec5SDimitry Andric 13800b57cec5SDimitry Andric /* Error conditions */ 13810b57cec5SDimitry Andric CXCursor_FirstInvalid = 70, 13820b57cec5SDimitry Andric CXCursor_InvalidFile = 70, 13830b57cec5SDimitry Andric CXCursor_NoDeclFound = 71, 13840b57cec5SDimitry Andric CXCursor_NotImplemented = 72, 13850b57cec5SDimitry Andric CXCursor_InvalidCode = 73, 13860b57cec5SDimitry Andric CXCursor_LastInvalid = CXCursor_InvalidCode, 13870b57cec5SDimitry Andric 13880b57cec5SDimitry Andric /* Expressions */ 13890b57cec5SDimitry Andric CXCursor_FirstExpr = 100, 13900b57cec5SDimitry Andric 13910b57cec5SDimitry Andric /** 13920b57cec5SDimitry Andric * An expression whose specific kind is not exposed via this 13930b57cec5SDimitry Andric * interface. 13940b57cec5SDimitry Andric * 13950b57cec5SDimitry Andric * Unexposed expressions have the same operations as any other kind 13960b57cec5SDimitry Andric * of expression; one can extract their location information, 13970b57cec5SDimitry Andric * spelling, children, etc. However, the specific kind of the 13980b57cec5SDimitry Andric * expression is not reported. 13990b57cec5SDimitry Andric */ 14000b57cec5SDimitry Andric CXCursor_UnexposedExpr = 100, 14010b57cec5SDimitry Andric 14020b57cec5SDimitry Andric /** 14030b57cec5SDimitry Andric * An expression that refers to some value declaration, such 14040b57cec5SDimitry Andric * as a function, variable, or enumerator. 14050b57cec5SDimitry Andric */ 14060b57cec5SDimitry Andric CXCursor_DeclRefExpr = 101, 14070b57cec5SDimitry Andric 14080b57cec5SDimitry Andric /** 14090b57cec5SDimitry Andric * An expression that refers to a member of a struct, union, 14100b57cec5SDimitry Andric * class, Objective-C class, etc. 14110b57cec5SDimitry Andric */ 14120b57cec5SDimitry Andric CXCursor_MemberRefExpr = 102, 14130b57cec5SDimitry Andric 14140b57cec5SDimitry Andric /** An expression that calls a function. */ 14150b57cec5SDimitry Andric CXCursor_CallExpr = 103, 14160b57cec5SDimitry Andric 14170b57cec5SDimitry Andric /** An expression that sends a message to an Objective-C 14180b57cec5SDimitry Andric object or class. */ 14190b57cec5SDimitry Andric CXCursor_ObjCMessageExpr = 104, 14200b57cec5SDimitry Andric 14210b57cec5SDimitry Andric /** An expression that represents a block literal. */ 14220b57cec5SDimitry Andric CXCursor_BlockExpr = 105, 14230b57cec5SDimitry Andric 14240b57cec5SDimitry Andric /** An integer literal. 14250b57cec5SDimitry Andric */ 14260b57cec5SDimitry Andric CXCursor_IntegerLiteral = 106, 14270b57cec5SDimitry Andric 14280b57cec5SDimitry Andric /** A floating point number literal. 14290b57cec5SDimitry Andric */ 14300b57cec5SDimitry Andric CXCursor_FloatingLiteral = 107, 14310b57cec5SDimitry Andric 14320b57cec5SDimitry Andric /** An imaginary number literal. 14330b57cec5SDimitry Andric */ 14340b57cec5SDimitry Andric CXCursor_ImaginaryLiteral = 108, 14350b57cec5SDimitry Andric 14360b57cec5SDimitry Andric /** A string literal. 14370b57cec5SDimitry Andric */ 14380b57cec5SDimitry Andric CXCursor_StringLiteral = 109, 14390b57cec5SDimitry Andric 14400b57cec5SDimitry Andric /** A character literal. 14410b57cec5SDimitry Andric */ 14420b57cec5SDimitry Andric CXCursor_CharacterLiteral = 110, 14430b57cec5SDimitry Andric 14440b57cec5SDimitry Andric /** A parenthesized expression, e.g. "(1)". 14450b57cec5SDimitry Andric * 14460b57cec5SDimitry Andric * This AST node is only formed if full location information is requested. 14470b57cec5SDimitry Andric */ 14480b57cec5SDimitry Andric CXCursor_ParenExpr = 111, 14490b57cec5SDimitry Andric 14500b57cec5SDimitry Andric /** This represents the unary-expression's (except sizeof and 14510b57cec5SDimitry Andric * alignof). 14520b57cec5SDimitry Andric */ 14530b57cec5SDimitry Andric CXCursor_UnaryOperator = 112, 14540b57cec5SDimitry Andric 14550b57cec5SDimitry Andric /** [C99 6.5.2.1] Array Subscripting. 14560b57cec5SDimitry Andric */ 14570b57cec5SDimitry Andric CXCursor_ArraySubscriptExpr = 113, 14580b57cec5SDimitry Andric 14590b57cec5SDimitry Andric /** A builtin binary operation expression such as "x + y" or 14600b57cec5SDimitry Andric * "x <= y". 14610b57cec5SDimitry Andric */ 14620b57cec5SDimitry Andric CXCursor_BinaryOperator = 114, 14630b57cec5SDimitry Andric 14640b57cec5SDimitry Andric /** Compound assignment such as "+=". 14650b57cec5SDimitry Andric */ 14660b57cec5SDimitry Andric CXCursor_CompoundAssignOperator = 115, 14670b57cec5SDimitry Andric 14680b57cec5SDimitry Andric /** The ?: ternary operator. 14690b57cec5SDimitry Andric */ 14700b57cec5SDimitry Andric CXCursor_ConditionalOperator = 116, 14710b57cec5SDimitry Andric 14720b57cec5SDimitry Andric /** An explicit cast in C (C99 6.5.4) or a C-style cast in C++ 14730b57cec5SDimitry Andric * (C++ [expr.cast]), which uses the syntax (Type)expr. 14740b57cec5SDimitry Andric * 14750b57cec5SDimitry Andric * For example: (int)f. 14760b57cec5SDimitry Andric */ 14770b57cec5SDimitry Andric CXCursor_CStyleCastExpr = 117, 14780b57cec5SDimitry Andric 14790b57cec5SDimitry Andric /** [C99 6.5.2.5] 14800b57cec5SDimitry Andric */ 14810b57cec5SDimitry Andric CXCursor_CompoundLiteralExpr = 118, 14820b57cec5SDimitry Andric 14830b57cec5SDimitry Andric /** Describes an C or C++ initializer list. 14840b57cec5SDimitry Andric */ 14850b57cec5SDimitry Andric CXCursor_InitListExpr = 119, 14860b57cec5SDimitry Andric 14870b57cec5SDimitry Andric /** The GNU address of label extension, representing &&label. 14880b57cec5SDimitry Andric */ 14890b57cec5SDimitry Andric CXCursor_AddrLabelExpr = 120, 14900b57cec5SDimitry Andric 14910b57cec5SDimitry Andric /** This is the GNU Statement Expression extension: ({int X=4; X;}) 14920b57cec5SDimitry Andric */ 14930b57cec5SDimitry Andric CXCursor_StmtExpr = 121, 14940b57cec5SDimitry Andric 14950b57cec5SDimitry Andric /** Represents a C11 generic selection. 14960b57cec5SDimitry Andric */ 14970b57cec5SDimitry Andric CXCursor_GenericSelectionExpr = 122, 14980b57cec5SDimitry Andric 14990b57cec5SDimitry Andric /** Implements the GNU __null extension, which is a name for a null 15000b57cec5SDimitry Andric * pointer constant that has integral type (e.g., int or long) and is the same 15010b57cec5SDimitry Andric * size and alignment as a pointer. 15020b57cec5SDimitry Andric * 15030b57cec5SDimitry Andric * The __null extension is typically only used by system headers, which define 15040b57cec5SDimitry Andric * NULL as __null in C++ rather than using 0 (which is an integer that may not 15050b57cec5SDimitry Andric * match the size of a pointer). 15060b57cec5SDimitry Andric */ 15070b57cec5SDimitry Andric CXCursor_GNUNullExpr = 123, 15080b57cec5SDimitry Andric 15090b57cec5SDimitry Andric /** C++'s static_cast<> expression. 15100b57cec5SDimitry Andric */ 15110b57cec5SDimitry Andric CXCursor_CXXStaticCastExpr = 124, 15120b57cec5SDimitry Andric 15130b57cec5SDimitry Andric /** C++'s dynamic_cast<> expression. 15140b57cec5SDimitry Andric */ 15150b57cec5SDimitry Andric CXCursor_CXXDynamicCastExpr = 125, 15160b57cec5SDimitry Andric 15170b57cec5SDimitry Andric /** C++'s reinterpret_cast<> expression. 15180b57cec5SDimitry Andric */ 15190b57cec5SDimitry Andric CXCursor_CXXReinterpretCastExpr = 126, 15200b57cec5SDimitry Andric 15210b57cec5SDimitry Andric /** C++'s const_cast<> expression. 15220b57cec5SDimitry Andric */ 15230b57cec5SDimitry Andric CXCursor_CXXConstCastExpr = 127, 15240b57cec5SDimitry Andric 15250b57cec5SDimitry Andric /** Represents an explicit C++ type conversion that uses "functional" 15260b57cec5SDimitry Andric * notion (C++ [expr.type.conv]). 15270b57cec5SDimitry Andric * 15280b57cec5SDimitry Andric * Example: 15290b57cec5SDimitry Andric * \code 15300b57cec5SDimitry Andric * x = int(0.5); 15310b57cec5SDimitry Andric * \endcode 15320b57cec5SDimitry Andric */ 15330b57cec5SDimitry Andric CXCursor_CXXFunctionalCastExpr = 128, 15340b57cec5SDimitry Andric 15350b57cec5SDimitry Andric /** A C++ typeid expression (C++ [expr.typeid]). 15360b57cec5SDimitry Andric */ 1537e8d8bef9SDimitry Andric CXCursor_CXXTypeidExpr = 129, 15380b57cec5SDimitry Andric 15390b57cec5SDimitry Andric /** [C++ 2.13.5] C++ Boolean Literal. 15400b57cec5SDimitry Andric */ 1541e8d8bef9SDimitry Andric CXCursor_CXXBoolLiteralExpr = 130, 15420b57cec5SDimitry Andric 15430b57cec5SDimitry Andric /** [C++0x 2.14.7] C++ Pointer Literal. 15440b57cec5SDimitry Andric */ 1545e8d8bef9SDimitry Andric CXCursor_CXXNullPtrLiteralExpr = 131, 15460b57cec5SDimitry Andric 15470b57cec5SDimitry Andric /** Represents the "this" expression in C++ 15480b57cec5SDimitry Andric */ 1549e8d8bef9SDimitry Andric CXCursor_CXXThisExpr = 132, 15500b57cec5SDimitry Andric 15510b57cec5SDimitry Andric /** [C++ 15] C++ Throw Expression. 15520b57cec5SDimitry Andric * 15530b57cec5SDimitry Andric * This handles 'throw' and 'throw' assignment-expression. When 15540b57cec5SDimitry Andric * assignment-expression isn't present, Op will be null. 15550b57cec5SDimitry Andric */ 1556e8d8bef9SDimitry Andric CXCursor_CXXThrowExpr = 133, 15570b57cec5SDimitry Andric 15580b57cec5SDimitry Andric /** A new expression for memory allocation and constructor calls, e.g: 15590b57cec5SDimitry Andric * "new CXXNewExpr(foo)". 15600b57cec5SDimitry Andric */ 1561e8d8bef9SDimitry Andric CXCursor_CXXNewExpr = 134, 15620b57cec5SDimitry Andric 15630b57cec5SDimitry Andric /** A delete expression for memory deallocation and destructor calls, 15640b57cec5SDimitry Andric * e.g. "delete[] pArray". 15650b57cec5SDimitry Andric */ 1566e8d8bef9SDimitry Andric CXCursor_CXXDeleteExpr = 135, 15670b57cec5SDimitry Andric 15680b57cec5SDimitry Andric /** A unary expression. (noexcept, sizeof, or other traits) 15690b57cec5SDimitry Andric */ 1570e8d8bef9SDimitry Andric CXCursor_UnaryExpr = 136, 15710b57cec5SDimitry Andric 15720b57cec5SDimitry Andric /** An Objective-C string literal i.e. @"foo". 15730b57cec5SDimitry Andric */ 1574e8d8bef9SDimitry Andric CXCursor_ObjCStringLiteral = 137, 15750b57cec5SDimitry Andric 15760b57cec5SDimitry Andric /** An Objective-C \@encode expression. 15770b57cec5SDimitry Andric */ 1578e8d8bef9SDimitry Andric CXCursor_ObjCEncodeExpr = 138, 15790b57cec5SDimitry Andric 15800b57cec5SDimitry Andric /** An Objective-C \@selector expression. 15810b57cec5SDimitry Andric */ 1582e8d8bef9SDimitry Andric CXCursor_ObjCSelectorExpr = 139, 15830b57cec5SDimitry Andric 15840b57cec5SDimitry Andric /** An Objective-C \@protocol expression. 15850b57cec5SDimitry Andric */ 1586e8d8bef9SDimitry Andric CXCursor_ObjCProtocolExpr = 140, 15870b57cec5SDimitry Andric 15880b57cec5SDimitry Andric /** An Objective-C "bridged" cast expression, which casts between 15890b57cec5SDimitry Andric * Objective-C pointers and C pointers, transferring ownership in the process. 15900b57cec5SDimitry Andric * 15910b57cec5SDimitry Andric * \code 15920b57cec5SDimitry Andric * NSString *str = (__bridge_transfer NSString *)CFCreateString(); 15930b57cec5SDimitry Andric * \endcode 15940b57cec5SDimitry Andric */ 1595e8d8bef9SDimitry Andric CXCursor_ObjCBridgedCastExpr = 141, 15960b57cec5SDimitry Andric 15970b57cec5SDimitry Andric /** Represents a C++0x pack expansion that produces a sequence of 15980b57cec5SDimitry Andric * expressions. 15990b57cec5SDimitry Andric * 16000b57cec5SDimitry Andric * A pack expansion expression contains a pattern (which itself is an 16010b57cec5SDimitry Andric * expression) followed by an ellipsis. For example: 16020b57cec5SDimitry Andric * 16030b57cec5SDimitry Andric * \code 16040b57cec5SDimitry Andric * template<typename F, typename ...Types> 16050b57cec5SDimitry Andric * void forward(F f, Types &&...args) { 16060b57cec5SDimitry Andric * f(static_cast<Types&&>(args)...); 16070b57cec5SDimitry Andric * } 16080b57cec5SDimitry Andric * \endcode 16090b57cec5SDimitry Andric */ 1610e8d8bef9SDimitry Andric CXCursor_PackExpansionExpr = 142, 16110b57cec5SDimitry Andric 16120b57cec5SDimitry Andric /** Represents an expression that computes the length of a parameter 16130b57cec5SDimitry Andric * pack. 16140b57cec5SDimitry Andric * 16150b57cec5SDimitry Andric * \code 16160b57cec5SDimitry Andric * template<typename ...Types> 16170b57cec5SDimitry Andric * struct count { 16180b57cec5SDimitry Andric * static const unsigned value = sizeof...(Types); 16190b57cec5SDimitry Andric * }; 16200b57cec5SDimitry Andric * \endcode 16210b57cec5SDimitry Andric */ 1622e8d8bef9SDimitry Andric CXCursor_SizeOfPackExpr = 143, 16230b57cec5SDimitry Andric 16240b57cec5SDimitry Andric /* Represents a C++ lambda expression that produces a local function 16250b57cec5SDimitry Andric * object. 16260b57cec5SDimitry Andric * 16270b57cec5SDimitry Andric * \code 16280b57cec5SDimitry Andric * void abssort(float *x, unsigned N) { 16290b57cec5SDimitry Andric * std::sort(x, x + N, 16300b57cec5SDimitry Andric * [](float a, float b) { 16310b57cec5SDimitry Andric * return std::abs(a) < std::abs(b); 16320b57cec5SDimitry Andric * }); 16330b57cec5SDimitry Andric * } 16340b57cec5SDimitry Andric * \endcode 16350b57cec5SDimitry Andric */ 1636e8d8bef9SDimitry Andric CXCursor_LambdaExpr = 144, 16370b57cec5SDimitry Andric 16380b57cec5SDimitry Andric /** Objective-c Boolean Literal. 16390b57cec5SDimitry Andric */ 1640e8d8bef9SDimitry Andric CXCursor_ObjCBoolLiteralExpr = 145, 16410b57cec5SDimitry Andric 16420b57cec5SDimitry Andric /** Represents the "self" expression in an Objective-C method. 16430b57cec5SDimitry Andric */ 1644e8d8bef9SDimitry Andric CXCursor_ObjCSelfExpr = 146, 16450b57cec5SDimitry Andric 16465ffd83dbSDimitry Andric /** OpenMP 5.0 [2.1.5, Array Section]. 16470b57cec5SDimitry Andric */ 1648e8d8bef9SDimitry Andric CXCursor_OMPArraySectionExpr = 147, 16490b57cec5SDimitry Andric 16500b57cec5SDimitry Andric /** Represents an @available(...) check. 16510b57cec5SDimitry Andric */ 1652e8d8bef9SDimitry Andric CXCursor_ObjCAvailabilityCheckExpr = 148, 16530b57cec5SDimitry Andric 16540b57cec5SDimitry Andric /** 16550b57cec5SDimitry Andric * Fixed point literal 16560b57cec5SDimitry Andric */ 1657e8d8bef9SDimitry Andric CXCursor_FixedPointLiteral = 149, 16580b57cec5SDimitry Andric 16595ffd83dbSDimitry Andric /** OpenMP 5.0 [2.1.4, Array Shaping]. 16605ffd83dbSDimitry Andric */ 1661e8d8bef9SDimitry Andric CXCursor_OMPArrayShapingExpr = 150, 16625ffd83dbSDimitry Andric 16635ffd83dbSDimitry Andric /** 16645ffd83dbSDimitry Andric * OpenMP 5.0 [2.1.6 Iterators] 16655ffd83dbSDimitry Andric */ 1666e8d8bef9SDimitry Andric CXCursor_OMPIteratorExpr = 151, 16675ffd83dbSDimitry Andric 1668e8d8bef9SDimitry Andric /** OpenCL's addrspace_cast<> expression. 1669e8d8bef9SDimitry Andric */ 1670e8d8bef9SDimitry Andric CXCursor_CXXAddrspaceCastExpr = 152, 1671e8d8bef9SDimitry Andric 167281ad6265SDimitry Andric /** 167381ad6265SDimitry Andric * Expression that references a C++20 concept. 167481ad6265SDimitry Andric */ 167581ad6265SDimitry Andric CXCursor_ConceptSpecializationExpr = 153, 167681ad6265SDimitry Andric 167781ad6265SDimitry Andric /** 167881ad6265SDimitry Andric * Expression that references a C++20 concept. 167981ad6265SDimitry Andric */ 168081ad6265SDimitry Andric CXCursor_RequiresExpr = 154, 168181ad6265SDimitry Andric 1682bdd1243dSDimitry Andric /** 1683bdd1243dSDimitry Andric * Expression that references a C++20 parenthesized list aggregate 1684bdd1243dSDimitry Andric * initializer. 1685bdd1243dSDimitry Andric */ 1686bdd1243dSDimitry Andric CXCursor_CXXParenListInitExpr = 155, 1687bdd1243dSDimitry Andric 1688bdd1243dSDimitry Andric CXCursor_LastExpr = CXCursor_CXXParenListInitExpr, 16890b57cec5SDimitry Andric 16900b57cec5SDimitry Andric /* Statements */ 16910b57cec5SDimitry Andric CXCursor_FirstStmt = 200, 16920b57cec5SDimitry Andric /** 16930b57cec5SDimitry Andric * A statement whose specific kind is not exposed via this 16940b57cec5SDimitry Andric * interface. 16950b57cec5SDimitry Andric * 16960b57cec5SDimitry Andric * Unexposed statements have the same operations as any other kind of 16970b57cec5SDimitry Andric * statement; one can extract their location information, spelling, 16980b57cec5SDimitry Andric * children, etc. However, the specific kind of the statement is not 16990b57cec5SDimitry Andric * reported. 17000b57cec5SDimitry Andric */ 17010b57cec5SDimitry Andric CXCursor_UnexposedStmt = 200, 17020b57cec5SDimitry Andric 17030b57cec5SDimitry Andric /** A labelled statement in a function. 17040b57cec5SDimitry Andric * 17050b57cec5SDimitry Andric * This cursor kind is used to describe the "start_over:" label statement in 17060b57cec5SDimitry Andric * the following example: 17070b57cec5SDimitry Andric * 17080b57cec5SDimitry Andric * \code 17090b57cec5SDimitry Andric * start_over: 17100b57cec5SDimitry Andric * ++counter; 17110b57cec5SDimitry Andric * \endcode 17120b57cec5SDimitry Andric * 17130b57cec5SDimitry Andric */ 17140b57cec5SDimitry Andric CXCursor_LabelStmt = 201, 17150b57cec5SDimitry Andric 17160b57cec5SDimitry Andric /** A group of statements like { stmt stmt }. 17170b57cec5SDimitry Andric * 17180b57cec5SDimitry Andric * This cursor kind is used to describe compound statements, e.g. function 17190b57cec5SDimitry Andric * bodies. 17200b57cec5SDimitry Andric */ 17210b57cec5SDimitry Andric CXCursor_CompoundStmt = 202, 17220b57cec5SDimitry Andric 17230b57cec5SDimitry Andric /** A case statement. 17240b57cec5SDimitry Andric */ 17250b57cec5SDimitry Andric CXCursor_CaseStmt = 203, 17260b57cec5SDimitry Andric 17270b57cec5SDimitry Andric /** A default statement. 17280b57cec5SDimitry Andric */ 17290b57cec5SDimitry Andric CXCursor_DefaultStmt = 204, 17300b57cec5SDimitry Andric 17310b57cec5SDimitry Andric /** An if statement 17320b57cec5SDimitry Andric */ 17330b57cec5SDimitry Andric CXCursor_IfStmt = 205, 17340b57cec5SDimitry Andric 17350b57cec5SDimitry Andric /** A switch statement. 17360b57cec5SDimitry Andric */ 17370b57cec5SDimitry Andric CXCursor_SwitchStmt = 206, 17380b57cec5SDimitry Andric 17390b57cec5SDimitry Andric /** A while statement. 17400b57cec5SDimitry Andric */ 17410b57cec5SDimitry Andric CXCursor_WhileStmt = 207, 17420b57cec5SDimitry Andric 17430b57cec5SDimitry Andric /** A do statement. 17440b57cec5SDimitry Andric */ 17450b57cec5SDimitry Andric CXCursor_DoStmt = 208, 17460b57cec5SDimitry Andric 17470b57cec5SDimitry Andric /** A for statement. 17480b57cec5SDimitry Andric */ 17490b57cec5SDimitry Andric CXCursor_ForStmt = 209, 17500b57cec5SDimitry Andric 17510b57cec5SDimitry Andric /** A goto statement. 17520b57cec5SDimitry Andric */ 17530b57cec5SDimitry Andric CXCursor_GotoStmt = 210, 17540b57cec5SDimitry Andric 17550b57cec5SDimitry Andric /** An indirect goto statement. 17560b57cec5SDimitry Andric */ 17570b57cec5SDimitry Andric CXCursor_IndirectGotoStmt = 211, 17580b57cec5SDimitry Andric 17590b57cec5SDimitry Andric /** A continue statement. 17600b57cec5SDimitry Andric */ 17610b57cec5SDimitry Andric CXCursor_ContinueStmt = 212, 17620b57cec5SDimitry Andric 17630b57cec5SDimitry Andric /** A break statement. 17640b57cec5SDimitry Andric */ 17650b57cec5SDimitry Andric CXCursor_BreakStmt = 213, 17660b57cec5SDimitry Andric 17670b57cec5SDimitry Andric /** A return statement. 17680b57cec5SDimitry Andric */ 17690b57cec5SDimitry Andric CXCursor_ReturnStmt = 214, 17700b57cec5SDimitry Andric 17710b57cec5SDimitry Andric /** A GCC inline assembly statement extension. 17720b57cec5SDimitry Andric */ 17730b57cec5SDimitry Andric CXCursor_GCCAsmStmt = 215, 17740b57cec5SDimitry Andric CXCursor_AsmStmt = CXCursor_GCCAsmStmt, 17750b57cec5SDimitry Andric 17760b57cec5SDimitry Andric /** Objective-C's overall \@try-\@catch-\@finally statement. 17770b57cec5SDimitry Andric */ 17780b57cec5SDimitry Andric CXCursor_ObjCAtTryStmt = 216, 17790b57cec5SDimitry Andric 17800b57cec5SDimitry Andric /** Objective-C's \@catch statement. 17810b57cec5SDimitry Andric */ 17820b57cec5SDimitry Andric CXCursor_ObjCAtCatchStmt = 217, 17830b57cec5SDimitry Andric 17840b57cec5SDimitry Andric /** Objective-C's \@finally statement. 17850b57cec5SDimitry Andric */ 17860b57cec5SDimitry Andric CXCursor_ObjCAtFinallyStmt = 218, 17870b57cec5SDimitry Andric 17880b57cec5SDimitry Andric /** Objective-C's \@throw statement. 17890b57cec5SDimitry Andric */ 17900b57cec5SDimitry Andric CXCursor_ObjCAtThrowStmt = 219, 17910b57cec5SDimitry Andric 17920b57cec5SDimitry Andric /** Objective-C's \@synchronized statement. 17930b57cec5SDimitry Andric */ 17940b57cec5SDimitry Andric CXCursor_ObjCAtSynchronizedStmt = 220, 17950b57cec5SDimitry Andric 17960b57cec5SDimitry Andric /** Objective-C's autorelease pool statement. 17970b57cec5SDimitry Andric */ 17980b57cec5SDimitry Andric CXCursor_ObjCAutoreleasePoolStmt = 221, 17990b57cec5SDimitry Andric 18000b57cec5SDimitry Andric /** Objective-C's collection statement. 18010b57cec5SDimitry Andric */ 18020b57cec5SDimitry Andric CXCursor_ObjCForCollectionStmt = 222, 18030b57cec5SDimitry Andric 18040b57cec5SDimitry Andric /** C++'s catch statement. 18050b57cec5SDimitry Andric */ 18060b57cec5SDimitry Andric CXCursor_CXXCatchStmt = 223, 18070b57cec5SDimitry Andric 18080b57cec5SDimitry Andric /** C++'s try statement. 18090b57cec5SDimitry Andric */ 18100b57cec5SDimitry Andric CXCursor_CXXTryStmt = 224, 18110b57cec5SDimitry Andric 18120b57cec5SDimitry Andric /** C++'s for (* : *) statement. 18130b57cec5SDimitry Andric */ 18140b57cec5SDimitry Andric CXCursor_CXXForRangeStmt = 225, 18150b57cec5SDimitry Andric 18160b57cec5SDimitry Andric /** Windows Structured Exception Handling's try statement. 18170b57cec5SDimitry Andric */ 18180b57cec5SDimitry Andric CXCursor_SEHTryStmt = 226, 18190b57cec5SDimitry Andric 18200b57cec5SDimitry Andric /** Windows Structured Exception Handling's except statement. 18210b57cec5SDimitry Andric */ 18220b57cec5SDimitry Andric CXCursor_SEHExceptStmt = 227, 18230b57cec5SDimitry Andric 18240b57cec5SDimitry Andric /** Windows Structured Exception Handling's finally statement. 18250b57cec5SDimitry Andric */ 18260b57cec5SDimitry Andric CXCursor_SEHFinallyStmt = 228, 18270b57cec5SDimitry Andric 18280b57cec5SDimitry Andric /** A MS inline assembly statement extension. 18290b57cec5SDimitry Andric */ 18300b57cec5SDimitry Andric CXCursor_MSAsmStmt = 229, 18310b57cec5SDimitry Andric 18320b57cec5SDimitry Andric /** The null statement ";": C99 6.8.3p3. 18330b57cec5SDimitry Andric * 18340b57cec5SDimitry Andric * This cursor kind is used to describe the null statement. 18350b57cec5SDimitry Andric */ 18360b57cec5SDimitry Andric CXCursor_NullStmt = 230, 18370b57cec5SDimitry Andric 18380b57cec5SDimitry Andric /** Adaptor class for mixing declarations with statements and 18390b57cec5SDimitry Andric * expressions. 18400b57cec5SDimitry Andric */ 18410b57cec5SDimitry Andric CXCursor_DeclStmt = 231, 18420b57cec5SDimitry Andric 18430b57cec5SDimitry Andric /** OpenMP parallel directive. 18440b57cec5SDimitry Andric */ 18450b57cec5SDimitry Andric CXCursor_OMPParallelDirective = 232, 18460b57cec5SDimitry Andric 18470b57cec5SDimitry Andric /** OpenMP SIMD directive. 18480b57cec5SDimitry Andric */ 18490b57cec5SDimitry Andric CXCursor_OMPSimdDirective = 233, 18500b57cec5SDimitry Andric 18510b57cec5SDimitry Andric /** OpenMP for directive. 18520b57cec5SDimitry Andric */ 18530b57cec5SDimitry Andric CXCursor_OMPForDirective = 234, 18540b57cec5SDimitry Andric 18550b57cec5SDimitry Andric /** OpenMP sections directive. 18560b57cec5SDimitry Andric */ 18570b57cec5SDimitry Andric CXCursor_OMPSectionsDirective = 235, 18580b57cec5SDimitry Andric 18590b57cec5SDimitry Andric /** OpenMP section directive. 18600b57cec5SDimitry Andric */ 18610b57cec5SDimitry Andric CXCursor_OMPSectionDirective = 236, 18620b57cec5SDimitry Andric 18630b57cec5SDimitry Andric /** OpenMP single directive. 18640b57cec5SDimitry Andric */ 18650b57cec5SDimitry Andric CXCursor_OMPSingleDirective = 237, 18660b57cec5SDimitry Andric 18670b57cec5SDimitry Andric /** OpenMP parallel for directive. 18680b57cec5SDimitry Andric */ 18690b57cec5SDimitry Andric CXCursor_OMPParallelForDirective = 238, 18700b57cec5SDimitry Andric 18710b57cec5SDimitry Andric /** OpenMP parallel sections directive. 18720b57cec5SDimitry Andric */ 18730b57cec5SDimitry Andric CXCursor_OMPParallelSectionsDirective = 239, 18740b57cec5SDimitry Andric 18750b57cec5SDimitry Andric /** OpenMP task directive. 18760b57cec5SDimitry Andric */ 18770b57cec5SDimitry Andric CXCursor_OMPTaskDirective = 240, 18780b57cec5SDimitry Andric 18790b57cec5SDimitry Andric /** OpenMP master directive. 18800b57cec5SDimitry Andric */ 18810b57cec5SDimitry Andric CXCursor_OMPMasterDirective = 241, 18820b57cec5SDimitry Andric 18830b57cec5SDimitry Andric /** OpenMP critical directive. 18840b57cec5SDimitry Andric */ 18850b57cec5SDimitry Andric CXCursor_OMPCriticalDirective = 242, 18860b57cec5SDimitry Andric 18870b57cec5SDimitry Andric /** OpenMP taskyield directive. 18880b57cec5SDimitry Andric */ 18890b57cec5SDimitry Andric CXCursor_OMPTaskyieldDirective = 243, 18900b57cec5SDimitry Andric 18910b57cec5SDimitry Andric /** OpenMP barrier directive. 18920b57cec5SDimitry Andric */ 18930b57cec5SDimitry Andric CXCursor_OMPBarrierDirective = 244, 18940b57cec5SDimitry Andric 18950b57cec5SDimitry Andric /** OpenMP taskwait directive. 18960b57cec5SDimitry Andric */ 18970b57cec5SDimitry Andric CXCursor_OMPTaskwaitDirective = 245, 18980b57cec5SDimitry Andric 18990b57cec5SDimitry Andric /** OpenMP flush directive. 19000b57cec5SDimitry Andric */ 19010b57cec5SDimitry Andric CXCursor_OMPFlushDirective = 246, 19020b57cec5SDimitry Andric 19030b57cec5SDimitry Andric /** Windows Structured Exception Handling's leave statement. 19040b57cec5SDimitry Andric */ 19050b57cec5SDimitry Andric CXCursor_SEHLeaveStmt = 247, 19060b57cec5SDimitry Andric 19070b57cec5SDimitry Andric /** OpenMP ordered directive. 19080b57cec5SDimitry Andric */ 19090b57cec5SDimitry Andric CXCursor_OMPOrderedDirective = 248, 19100b57cec5SDimitry Andric 19110b57cec5SDimitry Andric /** OpenMP atomic directive. 19120b57cec5SDimitry Andric */ 19130b57cec5SDimitry Andric CXCursor_OMPAtomicDirective = 249, 19140b57cec5SDimitry Andric 19150b57cec5SDimitry Andric /** OpenMP for SIMD directive. 19160b57cec5SDimitry Andric */ 19170b57cec5SDimitry Andric CXCursor_OMPForSimdDirective = 250, 19180b57cec5SDimitry Andric 19190b57cec5SDimitry Andric /** OpenMP parallel for SIMD directive. 19200b57cec5SDimitry Andric */ 19210b57cec5SDimitry Andric CXCursor_OMPParallelForSimdDirective = 251, 19220b57cec5SDimitry Andric 19230b57cec5SDimitry Andric /** OpenMP target directive. 19240b57cec5SDimitry Andric */ 19250b57cec5SDimitry Andric CXCursor_OMPTargetDirective = 252, 19260b57cec5SDimitry Andric 19270b57cec5SDimitry Andric /** OpenMP teams directive. 19280b57cec5SDimitry Andric */ 19290b57cec5SDimitry Andric CXCursor_OMPTeamsDirective = 253, 19300b57cec5SDimitry Andric 19310b57cec5SDimitry Andric /** OpenMP taskgroup directive. 19320b57cec5SDimitry Andric */ 19330b57cec5SDimitry Andric CXCursor_OMPTaskgroupDirective = 254, 19340b57cec5SDimitry Andric 19350b57cec5SDimitry Andric /** OpenMP cancellation point directive. 19360b57cec5SDimitry Andric */ 19370b57cec5SDimitry Andric CXCursor_OMPCancellationPointDirective = 255, 19380b57cec5SDimitry Andric 19390b57cec5SDimitry Andric /** OpenMP cancel directive. 19400b57cec5SDimitry Andric */ 19410b57cec5SDimitry Andric CXCursor_OMPCancelDirective = 256, 19420b57cec5SDimitry Andric 19430b57cec5SDimitry Andric /** OpenMP target data directive. 19440b57cec5SDimitry Andric */ 19450b57cec5SDimitry Andric CXCursor_OMPTargetDataDirective = 257, 19460b57cec5SDimitry Andric 19470b57cec5SDimitry Andric /** OpenMP taskloop directive. 19480b57cec5SDimitry Andric */ 19490b57cec5SDimitry Andric CXCursor_OMPTaskLoopDirective = 258, 19500b57cec5SDimitry Andric 19510b57cec5SDimitry Andric /** OpenMP taskloop simd directive. 19520b57cec5SDimitry Andric */ 19530b57cec5SDimitry Andric CXCursor_OMPTaskLoopSimdDirective = 259, 19540b57cec5SDimitry Andric 19550b57cec5SDimitry Andric /** OpenMP distribute directive. 19560b57cec5SDimitry Andric */ 19570b57cec5SDimitry Andric CXCursor_OMPDistributeDirective = 260, 19580b57cec5SDimitry Andric 19590b57cec5SDimitry Andric /** OpenMP target enter data directive. 19600b57cec5SDimitry Andric */ 19610b57cec5SDimitry Andric CXCursor_OMPTargetEnterDataDirective = 261, 19620b57cec5SDimitry Andric 19630b57cec5SDimitry Andric /** OpenMP target exit data directive. 19640b57cec5SDimitry Andric */ 19650b57cec5SDimitry Andric CXCursor_OMPTargetExitDataDirective = 262, 19660b57cec5SDimitry Andric 19670b57cec5SDimitry Andric /** OpenMP target parallel directive. 19680b57cec5SDimitry Andric */ 19690b57cec5SDimitry Andric CXCursor_OMPTargetParallelDirective = 263, 19700b57cec5SDimitry Andric 19710b57cec5SDimitry Andric /** OpenMP target parallel for directive. 19720b57cec5SDimitry Andric */ 19730b57cec5SDimitry Andric CXCursor_OMPTargetParallelForDirective = 264, 19740b57cec5SDimitry Andric 19750b57cec5SDimitry Andric /** OpenMP target update directive. 19760b57cec5SDimitry Andric */ 19770b57cec5SDimitry Andric CXCursor_OMPTargetUpdateDirective = 265, 19780b57cec5SDimitry Andric 19790b57cec5SDimitry Andric /** OpenMP distribute parallel for directive. 19800b57cec5SDimitry Andric */ 19810b57cec5SDimitry Andric CXCursor_OMPDistributeParallelForDirective = 266, 19820b57cec5SDimitry Andric 19830b57cec5SDimitry Andric /** OpenMP distribute parallel for simd directive. 19840b57cec5SDimitry Andric */ 19850b57cec5SDimitry Andric CXCursor_OMPDistributeParallelForSimdDirective = 267, 19860b57cec5SDimitry Andric 19870b57cec5SDimitry Andric /** OpenMP distribute simd directive. 19880b57cec5SDimitry Andric */ 19890b57cec5SDimitry Andric CXCursor_OMPDistributeSimdDirective = 268, 19900b57cec5SDimitry Andric 19910b57cec5SDimitry Andric /** OpenMP target parallel for simd directive. 19920b57cec5SDimitry Andric */ 19930b57cec5SDimitry Andric CXCursor_OMPTargetParallelForSimdDirective = 269, 19940b57cec5SDimitry Andric 19950b57cec5SDimitry Andric /** OpenMP target simd directive. 19960b57cec5SDimitry Andric */ 19970b57cec5SDimitry Andric CXCursor_OMPTargetSimdDirective = 270, 19980b57cec5SDimitry Andric 19990b57cec5SDimitry Andric /** OpenMP teams distribute directive. 20000b57cec5SDimitry Andric */ 20010b57cec5SDimitry Andric CXCursor_OMPTeamsDistributeDirective = 271, 20020b57cec5SDimitry Andric 20030b57cec5SDimitry Andric /** OpenMP teams distribute simd directive. 20040b57cec5SDimitry Andric */ 20050b57cec5SDimitry Andric CXCursor_OMPTeamsDistributeSimdDirective = 272, 20060b57cec5SDimitry Andric 20070b57cec5SDimitry Andric /** OpenMP teams distribute parallel for simd directive. 20080b57cec5SDimitry Andric */ 20090b57cec5SDimitry Andric CXCursor_OMPTeamsDistributeParallelForSimdDirective = 273, 20100b57cec5SDimitry Andric 20110b57cec5SDimitry Andric /** OpenMP teams distribute parallel for directive. 20120b57cec5SDimitry Andric */ 20130b57cec5SDimitry Andric CXCursor_OMPTeamsDistributeParallelForDirective = 274, 20140b57cec5SDimitry Andric 20150b57cec5SDimitry Andric /** OpenMP target teams directive. 20160b57cec5SDimitry Andric */ 20170b57cec5SDimitry Andric CXCursor_OMPTargetTeamsDirective = 275, 20180b57cec5SDimitry Andric 20190b57cec5SDimitry Andric /** OpenMP target teams distribute directive. 20200b57cec5SDimitry Andric */ 20210b57cec5SDimitry Andric CXCursor_OMPTargetTeamsDistributeDirective = 276, 20220b57cec5SDimitry Andric 20230b57cec5SDimitry Andric /** OpenMP target teams distribute parallel for directive. 20240b57cec5SDimitry Andric */ 20250b57cec5SDimitry Andric CXCursor_OMPTargetTeamsDistributeParallelForDirective = 277, 20260b57cec5SDimitry Andric 20270b57cec5SDimitry Andric /** OpenMP target teams distribute parallel for simd directive. 20280b57cec5SDimitry Andric */ 20290b57cec5SDimitry Andric CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective = 278, 20300b57cec5SDimitry Andric 20310b57cec5SDimitry Andric /** OpenMP target teams distribute simd directive. 20320b57cec5SDimitry Andric */ 20330b57cec5SDimitry Andric CXCursor_OMPTargetTeamsDistributeSimdDirective = 279, 20340b57cec5SDimitry Andric 20350b57cec5SDimitry Andric /** C++2a std::bit_cast expression. 20360b57cec5SDimitry Andric */ 20370b57cec5SDimitry Andric CXCursor_BuiltinBitCastExpr = 280, 20380b57cec5SDimitry Andric 2039a7dea167SDimitry Andric /** OpenMP master taskloop directive. 2040a7dea167SDimitry Andric */ 2041a7dea167SDimitry Andric CXCursor_OMPMasterTaskLoopDirective = 281, 2042a7dea167SDimitry Andric 2043a7dea167SDimitry Andric /** OpenMP parallel master taskloop directive. 2044a7dea167SDimitry Andric */ 2045a7dea167SDimitry Andric CXCursor_OMPParallelMasterTaskLoopDirective = 282, 2046a7dea167SDimitry Andric 2047a7dea167SDimitry Andric /** OpenMP master taskloop simd directive. 2048a7dea167SDimitry Andric */ 2049a7dea167SDimitry Andric CXCursor_OMPMasterTaskLoopSimdDirective = 283, 2050a7dea167SDimitry Andric 2051480093f4SDimitry Andric /** OpenMP parallel master taskloop simd directive. 2052480093f4SDimitry Andric */ 2053480093f4SDimitry Andric CXCursor_OMPParallelMasterTaskLoopSimdDirective = 284, 2054a7dea167SDimitry Andric 2055480093f4SDimitry Andric /** OpenMP parallel master directive. 2056480093f4SDimitry Andric */ 2057480093f4SDimitry Andric CXCursor_OMPParallelMasterDirective = 285, 2058480093f4SDimitry Andric 20595ffd83dbSDimitry Andric /** OpenMP depobj directive. 20605ffd83dbSDimitry Andric */ 20615ffd83dbSDimitry Andric CXCursor_OMPDepobjDirective = 286, 20625ffd83dbSDimitry Andric 20635ffd83dbSDimitry Andric /** OpenMP scan directive. 20645ffd83dbSDimitry Andric */ 20655ffd83dbSDimitry Andric CXCursor_OMPScanDirective = 287, 20665ffd83dbSDimitry Andric 2067fe6060f1SDimitry Andric /** OpenMP tile directive. 2068fe6060f1SDimitry Andric */ 2069fe6060f1SDimitry Andric CXCursor_OMPTileDirective = 288, 2070fe6060f1SDimitry Andric 2071fe6060f1SDimitry Andric /** OpenMP canonical loop. 2072fe6060f1SDimitry Andric */ 2073fe6060f1SDimitry Andric CXCursor_OMPCanonicalLoop = 289, 2074fe6060f1SDimitry Andric 2075fe6060f1SDimitry Andric /** OpenMP interop directive. 2076fe6060f1SDimitry Andric */ 2077fe6060f1SDimitry Andric CXCursor_OMPInteropDirective = 290, 2078fe6060f1SDimitry Andric 2079fe6060f1SDimitry Andric /** OpenMP dispatch directive. 2080fe6060f1SDimitry Andric */ 2081fe6060f1SDimitry Andric CXCursor_OMPDispatchDirective = 291, 2082fe6060f1SDimitry Andric 2083fe6060f1SDimitry Andric /** OpenMP masked directive. 2084fe6060f1SDimitry Andric */ 2085fe6060f1SDimitry Andric CXCursor_OMPMaskedDirective = 292, 2086fe6060f1SDimitry Andric 2087fe6060f1SDimitry Andric /** OpenMP unroll directive. 2088fe6060f1SDimitry Andric */ 2089fe6060f1SDimitry Andric CXCursor_OMPUnrollDirective = 293, 2090fe6060f1SDimitry Andric 2091349cc55cSDimitry Andric /** OpenMP metadirective directive. 2092349cc55cSDimitry Andric */ 2093349cc55cSDimitry Andric CXCursor_OMPMetaDirective = 294, 2094349cc55cSDimitry Andric 2095349cc55cSDimitry Andric /** OpenMP loop directive. 2096349cc55cSDimitry Andric */ 2097349cc55cSDimitry Andric CXCursor_OMPGenericLoopDirective = 295, 2098349cc55cSDimitry Andric 209981ad6265SDimitry Andric /** OpenMP teams loop directive. 210081ad6265SDimitry Andric */ 210181ad6265SDimitry Andric CXCursor_OMPTeamsGenericLoopDirective = 296, 210281ad6265SDimitry Andric 210381ad6265SDimitry Andric /** OpenMP target teams loop directive. 210481ad6265SDimitry Andric */ 210581ad6265SDimitry Andric CXCursor_OMPTargetTeamsGenericLoopDirective = 297, 210681ad6265SDimitry Andric 210781ad6265SDimitry Andric /** OpenMP parallel loop directive. 210881ad6265SDimitry Andric */ 210981ad6265SDimitry Andric CXCursor_OMPParallelGenericLoopDirective = 298, 211081ad6265SDimitry Andric 211181ad6265SDimitry Andric /** OpenMP target parallel loop directive. 211281ad6265SDimitry Andric */ 211381ad6265SDimitry Andric CXCursor_OMPTargetParallelGenericLoopDirective = 299, 211481ad6265SDimitry Andric 211581ad6265SDimitry Andric /** OpenMP parallel masked directive. 211681ad6265SDimitry Andric */ 211781ad6265SDimitry Andric CXCursor_OMPParallelMaskedDirective = 300, 211881ad6265SDimitry Andric 211981ad6265SDimitry Andric /** OpenMP masked taskloop directive. 212081ad6265SDimitry Andric */ 212181ad6265SDimitry Andric CXCursor_OMPMaskedTaskLoopDirective = 301, 212281ad6265SDimitry Andric 212381ad6265SDimitry Andric /** OpenMP masked taskloop simd directive. 212481ad6265SDimitry Andric */ 212581ad6265SDimitry Andric CXCursor_OMPMaskedTaskLoopSimdDirective = 302, 212681ad6265SDimitry Andric 212781ad6265SDimitry Andric /** OpenMP parallel masked taskloop directive. 212881ad6265SDimitry Andric */ 212981ad6265SDimitry Andric CXCursor_OMPParallelMaskedTaskLoopDirective = 303, 213081ad6265SDimitry Andric 213181ad6265SDimitry Andric /** OpenMP parallel masked taskloop simd directive. 213281ad6265SDimitry Andric */ 213381ad6265SDimitry Andric CXCursor_OMPParallelMaskedTaskLoopSimdDirective = 304, 213481ad6265SDimitry Andric 2135bdd1243dSDimitry Andric /** OpenMP error directive. 2136bdd1243dSDimitry Andric */ 2137bdd1243dSDimitry Andric CXCursor_OMPErrorDirective = 305, 2138bdd1243dSDimitry Andric 21395f757f3fSDimitry Andric /** OpenMP scope directive. 21405f757f3fSDimitry Andric */ 21415f757f3fSDimitry Andric CXCursor_OMPScopeDirective = 306, 21425f757f3fSDimitry Andric 21435f757f3fSDimitry Andric CXCursor_LastStmt = CXCursor_OMPScopeDirective, 21440b57cec5SDimitry Andric 21450b57cec5SDimitry Andric /** 21460b57cec5SDimitry Andric * Cursor that represents the translation unit itself. 21470b57cec5SDimitry Andric * 21480b57cec5SDimitry Andric * The translation unit cursor exists primarily to act as the root 21490b57cec5SDimitry Andric * cursor for traversing the contents of a translation unit. 21500b57cec5SDimitry Andric */ 215181ad6265SDimitry Andric CXCursor_TranslationUnit = 350, 21520b57cec5SDimitry Andric 21530b57cec5SDimitry Andric /* Attributes */ 21540b57cec5SDimitry Andric CXCursor_FirstAttr = 400, 21550b57cec5SDimitry Andric /** 21560b57cec5SDimitry Andric * An attribute whose specific kind is not exposed via this 21570b57cec5SDimitry Andric * interface. 21580b57cec5SDimitry Andric */ 21590b57cec5SDimitry Andric CXCursor_UnexposedAttr = 400, 21600b57cec5SDimitry Andric 21610b57cec5SDimitry Andric CXCursor_IBActionAttr = 401, 21620b57cec5SDimitry Andric CXCursor_IBOutletAttr = 402, 21630b57cec5SDimitry Andric CXCursor_IBOutletCollectionAttr = 403, 21640b57cec5SDimitry Andric CXCursor_CXXFinalAttr = 404, 21650b57cec5SDimitry Andric CXCursor_CXXOverrideAttr = 405, 21660b57cec5SDimitry Andric CXCursor_AnnotateAttr = 406, 21670b57cec5SDimitry Andric CXCursor_AsmLabelAttr = 407, 21680b57cec5SDimitry Andric CXCursor_PackedAttr = 408, 21690b57cec5SDimitry Andric CXCursor_PureAttr = 409, 21700b57cec5SDimitry Andric CXCursor_ConstAttr = 410, 21710b57cec5SDimitry Andric CXCursor_NoDuplicateAttr = 411, 21720b57cec5SDimitry Andric CXCursor_CUDAConstantAttr = 412, 21730b57cec5SDimitry Andric CXCursor_CUDADeviceAttr = 413, 21740b57cec5SDimitry Andric CXCursor_CUDAGlobalAttr = 414, 21750b57cec5SDimitry Andric CXCursor_CUDAHostAttr = 415, 21760b57cec5SDimitry Andric CXCursor_CUDASharedAttr = 416, 21770b57cec5SDimitry Andric CXCursor_VisibilityAttr = 417, 21780b57cec5SDimitry Andric CXCursor_DLLExport = 418, 21790b57cec5SDimitry Andric CXCursor_DLLImport = 419, 21800b57cec5SDimitry Andric CXCursor_NSReturnsRetained = 420, 21810b57cec5SDimitry Andric CXCursor_NSReturnsNotRetained = 421, 21820b57cec5SDimitry Andric CXCursor_NSReturnsAutoreleased = 422, 21830b57cec5SDimitry Andric CXCursor_NSConsumesSelf = 423, 21840b57cec5SDimitry Andric CXCursor_NSConsumed = 424, 21850b57cec5SDimitry Andric CXCursor_ObjCException = 425, 21860b57cec5SDimitry Andric CXCursor_ObjCNSObject = 426, 21870b57cec5SDimitry Andric CXCursor_ObjCIndependentClass = 427, 21880b57cec5SDimitry Andric CXCursor_ObjCPreciseLifetime = 428, 21890b57cec5SDimitry Andric CXCursor_ObjCReturnsInnerPointer = 429, 21900b57cec5SDimitry Andric CXCursor_ObjCRequiresSuper = 430, 21910b57cec5SDimitry Andric CXCursor_ObjCRootClass = 431, 21920b57cec5SDimitry Andric CXCursor_ObjCSubclassingRestricted = 432, 21930b57cec5SDimitry Andric CXCursor_ObjCExplicitProtocolImpl = 433, 21940b57cec5SDimitry Andric CXCursor_ObjCDesignatedInitializer = 434, 21950b57cec5SDimitry Andric CXCursor_ObjCRuntimeVisible = 435, 21960b57cec5SDimitry Andric CXCursor_ObjCBoxable = 436, 21970b57cec5SDimitry Andric CXCursor_FlagEnum = 437, 21980b57cec5SDimitry Andric CXCursor_ConvergentAttr = 438, 21990b57cec5SDimitry Andric CXCursor_WarnUnusedAttr = 439, 22000b57cec5SDimitry Andric CXCursor_WarnUnusedResultAttr = 440, 22010b57cec5SDimitry Andric CXCursor_AlignedAttr = 441, 22020b57cec5SDimitry Andric CXCursor_LastAttr = CXCursor_AlignedAttr, 22030b57cec5SDimitry Andric 22040b57cec5SDimitry Andric /* Preprocessing */ 22050b57cec5SDimitry Andric CXCursor_PreprocessingDirective = 500, 22060b57cec5SDimitry Andric CXCursor_MacroDefinition = 501, 22070b57cec5SDimitry Andric CXCursor_MacroExpansion = 502, 22080b57cec5SDimitry Andric CXCursor_MacroInstantiation = CXCursor_MacroExpansion, 22090b57cec5SDimitry Andric CXCursor_InclusionDirective = 503, 22100b57cec5SDimitry Andric CXCursor_FirstPreprocessing = CXCursor_PreprocessingDirective, 22110b57cec5SDimitry Andric CXCursor_LastPreprocessing = CXCursor_InclusionDirective, 22120b57cec5SDimitry Andric 22130b57cec5SDimitry Andric /* Extra Declarations */ 22140b57cec5SDimitry Andric /** 22150b57cec5SDimitry Andric * A module import declaration. 22160b57cec5SDimitry Andric */ 22170b57cec5SDimitry Andric CXCursor_ModuleImportDecl = 600, 22180b57cec5SDimitry Andric CXCursor_TypeAliasTemplateDecl = 601, 22190b57cec5SDimitry Andric /** 22200b57cec5SDimitry Andric * A static_assert or _Static_assert node 22210b57cec5SDimitry Andric */ 22220b57cec5SDimitry Andric CXCursor_StaticAssert = 602, 22230b57cec5SDimitry Andric /** 22240b57cec5SDimitry Andric * a friend declaration. 22250b57cec5SDimitry Andric */ 22260b57cec5SDimitry Andric CXCursor_FriendDecl = 603, 222781ad6265SDimitry Andric /** 222881ad6265SDimitry Andric * a concept declaration. 222981ad6265SDimitry Andric */ 223081ad6265SDimitry Andric CXCursor_ConceptDecl = 604, 223181ad6265SDimitry Andric 22320b57cec5SDimitry Andric CXCursor_FirstExtraDecl = CXCursor_ModuleImportDecl, 223381ad6265SDimitry Andric CXCursor_LastExtraDecl = CXCursor_ConceptDecl, 22340b57cec5SDimitry Andric 22350b57cec5SDimitry Andric /** 22360b57cec5SDimitry Andric * A code completion overload candidate. 22370b57cec5SDimitry Andric */ 22380b57cec5SDimitry Andric CXCursor_OverloadCandidate = 700 22390b57cec5SDimitry Andric }; 22400b57cec5SDimitry Andric 22410b57cec5SDimitry Andric /** 22420b57cec5SDimitry Andric * A cursor representing some element in the abstract syntax tree for 22430b57cec5SDimitry Andric * a translation unit. 22440b57cec5SDimitry Andric * 22450b57cec5SDimitry Andric * The cursor abstraction unifies the different kinds of entities in a 22460b57cec5SDimitry Andric * program--declaration, statements, expressions, references to declarations, 22470b57cec5SDimitry Andric * etc.--under a single "cursor" abstraction with a common set of operations. 22480b57cec5SDimitry Andric * Common operation for a cursor include: getting the physical location in 22490b57cec5SDimitry Andric * a source file where the cursor points, getting the name associated with a 22500b57cec5SDimitry Andric * cursor, and retrieving cursors for any child nodes of a particular cursor. 22510b57cec5SDimitry Andric * 22520b57cec5SDimitry Andric * Cursors can be produced in two specific ways. 22530b57cec5SDimitry Andric * clang_getTranslationUnitCursor() produces a cursor for a translation unit, 22540b57cec5SDimitry Andric * from which one can use clang_visitChildren() to explore the rest of the 22550b57cec5SDimitry Andric * translation unit. clang_getCursor() maps from a physical source location 22560b57cec5SDimitry Andric * to the entity that resides at that location, allowing one to map from the 22570b57cec5SDimitry Andric * source code into the AST. 22580b57cec5SDimitry Andric */ 22590b57cec5SDimitry Andric typedef struct { 22600b57cec5SDimitry Andric enum CXCursorKind kind; 22610b57cec5SDimitry Andric int xdata; 22620b57cec5SDimitry Andric const void *data[3]; 22630b57cec5SDimitry Andric } CXCursor; 22640b57cec5SDimitry Andric 22650b57cec5SDimitry Andric /** 22660b57cec5SDimitry Andric * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations 22670b57cec5SDimitry Andric * 22680b57cec5SDimitry Andric * @{ 22690b57cec5SDimitry Andric */ 22700b57cec5SDimitry Andric 22710b57cec5SDimitry Andric /** 22720b57cec5SDimitry Andric * Retrieve the NULL cursor, which represents no entity. 22730b57cec5SDimitry Andric */ 22740b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_getNullCursor(void); 22750b57cec5SDimitry Andric 22760b57cec5SDimitry Andric /** 22770b57cec5SDimitry Andric * Retrieve the cursor that represents the given translation unit. 22780b57cec5SDimitry Andric * 22790b57cec5SDimitry Andric * The translation unit cursor can be used to start traversing the 22800b57cec5SDimitry Andric * various declarations within the given translation unit. 22810b57cec5SDimitry Andric */ 22820b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit); 22830b57cec5SDimitry Andric 22840b57cec5SDimitry Andric /** 22850b57cec5SDimitry Andric * Determine whether two cursors are equivalent. 22860b57cec5SDimitry Andric */ 22870b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor); 22880b57cec5SDimitry Andric 22890b57cec5SDimitry Andric /** 22900b57cec5SDimitry Andric * Returns non-zero if \p cursor is null. 22910b57cec5SDimitry Andric */ 22920b57cec5SDimitry Andric CINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor); 22930b57cec5SDimitry Andric 22940b57cec5SDimitry Andric /** 22950b57cec5SDimitry Andric * Compute a hash value for the given cursor. 22960b57cec5SDimitry Andric */ 22970b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor); 22980b57cec5SDimitry Andric 22990b57cec5SDimitry Andric /** 23000b57cec5SDimitry Andric * Retrieve the kind of the given cursor. 23010b57cec5SDimitry Andric */ 23020b57cec5SDimitry Andric CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor); 23030b57cec5SDimitry Andric 23040b57cec5SDimitry Andric /** 23050b57cec5SDimitry Andric * Determine whether the given cursor kind represents a declaration. 23060b57cec5SDimitry Andric */ 23070b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind); 23080b57cec5SDimitry Andric 23090b57cec5SDimitry Andric /** 23100b57cec5SDimitry Andric * Determine whether the given declaration is invalid. 23110b57cec5SDimitry Andric * 23120b57cec5SDimitry Andric * A declaration is invalid if it could not be parsed successfully. 23130b57cec5SDimitry Andric * 23140b57cec5SDimitry Andric * \returns non-zero if the cursor represents a declaration and it is 23150b57cec5SDimitry Andric * invalid, otherwise NULL. 23160b57cec5SDimitry Andric */ 23170b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isInvalidDeclaration(CXCursor); 23180b57cec5SDimitry Andric 23190b57cec5SDimitry Andric /** 23200b57cec5SDimitry Andric * Determine whether the given cursor kind represents a simple 23210b57cec5SDimitry Andric * reference. 23220b57cec5SDimitry Andric * 23230b57cec5SDimitry Andric * Note that other kinds of cursors (such as expressions) can also refer to 23240b57cec5SDimitry Andric * other cursors. Use clang_getCursorReferenced() to determine whether a 23250b57cec5SDimitry Andric * particular cursor refers to another entity. 23260b57cec5SDimitry Andric */ 23270b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind); 23280b57cec5SDimitry Andric 23290b57cec5SDimitry Andric /** 23300b57cec5SDimitry Andric * Determine whether the given cursor kind represents an expression. 23310b57cec5SDimitry Andric */ 23320b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind); 23330b57cec5SDimitry Andric 23340b57cec5SDimitry Andric /** 23350b57cec5SDimitry Andric * Determine whether the given cursor kind represents a statement. 23360b57cec5SDimitry Andric */ 23370b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind); 23380b57cec5SDimitry Andric 23390b57cec5SDimitry Andric /** 23400b57cec5SDimitry Andric * Determine whether the given cursor kind represents an attribute. 23410b57cec5SDimitry Andric */ 23420b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind); 23430b57cec5SDimitry Andric 23440b57cec5SDimitry Andric /** 23450b57cec5SDimitry Andric * Determine whether the given cursor has any attributes. 23460b57cec5SDimitry Andric */ 23470b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_hasAttrs(CXCursor C); 23480b57cec5SDimitry Andric 23490b57cec5SDimitry Andric /** 23500b57cec5SDimitry Andric * Determine whether the given cursor kind represents an invalid 23510b57cec5SDimitry Andric * cursor. 23520b57cec5SDimitry Andric */ 23530b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind); 23540b57cec5SDimitry Andric 23550b57cec5SDimitry Andric /** 23560b57cec5SDimitry Andric * Determine whether the given cursor kind represents a translation 23570b57cec5SDimitry Andric * unit. 23580b57cec5SDimitry Andric */ 23590b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind); 23600b57cec5SDimitry Andric 23610b57cec5SDimitry Andric /*** 23620b57cec5SDimitry Andric * Determine whether the given cursor represents a preprocessing 23630b57cec5SDimitry Andric * element, such as a preprocessor directive or macro instantiation. 23640b57cec5SDimitry Andric */ 23650b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind); 23660b57cec5SDimitry Andric 23670b57cec5SDimitry Andric /*** 23680b57cec5SDimitry Andric * Determine whether the given cursor represents a currently 23690b57cec5SDimitry Andric * unexposed piece of the AST (e.g., CXCursor_UnexposedStmt). 23700b57cec5SDimitry Andric */ 23710b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind); 23720b57cec5SDimitry Andric 23730b57cec5SDimitry Andric /** 23740b57cec5SDimitry Andric * Describe the linkage of the entity referred to by a cursor. 23750b57cec5SDimitry Andric */ 23760b57cec5SDimitry Andric enum CXLinkageKind { 23770b57cec5SDimitry Andric /** This value indicates that no linkage information is available 23780b57cec5SDimitry Andric * for a provided CXCursor. */ 23790b57cec5SDimitry Andric CXLinkage_Invalid, 23800b57cec5SDimitry Andric /** 23810b57cec5SDimitry Andric * This is the linkage for variables, parameters, and so on that 23820b57cec5SDimitry Andric * have automatic storage. This covers normal (non-extern) local variables. 23830b57cec5SDimitry Andric */ 23840b57cec5SDimitry Andric CXLinkage_NoLinkage, 23850b57cec5SDimitry Andric /** This is the linkage for static variables and static functions. */ 23860b57cec5SDimitry Andric CXLinkage_Internal, 23870b57cec5SDimitry Andric /** This is the linkage for entities with external linkage that live 23880b57cec5SDimitry Andric * in C++ anonymous namespaces.*/ 23890b57cec5SDimitry Andric CXLinkage_UniqueExternal, 23900b57cec5SDimitry Andric /** This is the linkage for entities with true, external linkage. */ 23910b57cec5SDimitry Andric CXLinkage_External 23920b57cec5SDimitry Andric }; 23930b57cec5SDimitry Andric 23940b57cec5SDimitry Andric /** 23950b57cec5SDimitry Andric * Determine the linkage of the entity referred to by a given cursor. 23960b57cec5SDimitry Andric */ 23970b57cec5SDimitry Andric CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor); 23980b57cec5SDimitry Andric 23990b57cec5SDimitry Andric enum CXVisibilityKind { 24000b57cec5SDimitry Andric /** This value indicates that no visibility information is available 24010b57cec5SDimitry Andric * for a provided CXCursor. */ 24020b57cec5SDimitry Andric CXVisibility_Invalid, 24030b57cec5SDimitry Andric 24040b57cec5SDimitry Andric /** Symbol not seen by the linker. */ 24050b57cec5SDimitry Andric CXVisibility_Hidden, 24060b57cec5SDimitry Andric /** Symbol seen by the linker but resolves to a symbol inside this object. */ 24070b57cec5SDimitry Andric CXVisibility_Protected, 24080b57cec5SDimitry Andric /** Symbol seen by the linker and acts like a normal symbol. */ 24090b57cec5SDimitry Andric CXVisibility_Default 24100b57cec5SDimitry Andric }; 24110b57cec5SDimitry Andric 24120b57cec5SDimitry Andric /** 24130b57cec5SDimitry Andric * Describe the visibility of the entity referred to by a cursor. 24140b57cec5SDimitry Andric * 24150b57cec5SDimitry Andric * This returns the default visibility if not explicitly specified by 24160b57cec5SDimitry Andric * a visibility attribute. The default visibility may be changed by 24170b57cec5SDimitry Andric * commandline arguments. 24180b57cec5SDimitry Andric * 24190b57cec5SDimitry Andric * \param cursor The cursor to query. 24200b57cec5SDimitry Andric * 24210b57cec5SDimitry Andric * \returns The visibility of the cursor. 24220b57cec5SDimitry Andric */ 24230b57cec5SDimitry Andric CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor cursor); 24240b57cec5SDimitry Andric 24250b57cec5SDimitry Andric /** 24260b57cec5SDimitry Andric * Determine the availability of the entity that this cursor refers to, 24270b57cec5SDimitry Andric * taking the current target platform into account. 24280b57cec5SDimitry Andric * 24290b57cec5SDimitry Andric * \param cursor The cursor to query. 24300b57cec5SDimitry Andric * 24310b57cec5SDimitry Andric * \returns The availability of the cursor. 24320b57cec5SDimitry Andric */ 24330b57cec5SDimitry Andric CINDEX_LINKAGE enum CXAvailabilityKind 24340b57cec5SDimitry Andric clang_getCursorAvailability(CXCursor cursor); 24350b57cec5SDimitry Andric 24360b57cec5SDimitry Andric /** 24370b57cec5SDimitry Andric * Describes the availability of a given entity on a particular platform, e.g., 24380b57cec5SDimitry Andric * a particular class might only be available on Mac OS 10.7 or newer. 24390b57cec5SDimitry Andric */ 24400b57cec5SDimitry Andric typedef struct CXPlatformAvailability { 24410b57cec5SDimitry Andric /** 24420b57cec5SDimitry Andric * A string that describes the platform for which this structure 24430b57cec5SDimitry Andric * provides availability information. 24440b57cec5SDimitry Andric * 24450b57cec5SDimitry Andric * Possible values are "ios" or "macos". 24460b57cec5SDimitry Andric */ 24470b57cec5SDimitry Andric CXString Platform; 24480b57cec5SDimitry Andric /** 24490b57cec5SDimitry Andric * The version number in which this entity was introduced. 24500b57cec5SDimitry Andric */ 24510b57cec5SDimitry Andric CXVersion Introduced; 24520b57cec5SDimitry Andric /** 24530b57cec5SDimitry Andric * The version number in which this entity was deprecated (but is 24540b57cec5SDimitry Andric * still available). 24550b57cec5SDimitry Andric */ 24560b57cec5SDimitry Andric CXVersion Deprecated; 24570b57cec5SDimitry Andric /** 24580b57cec5SDimitry Andric * The version number in which this entity was obsoleted, and therefore 24590b57cec5SDimitry Andric * is no longer available. 24600b57cec5SDimitry Andric */ 24610b57cec5SDimitry Andric CXVersion Obsoleted; 24620b57cec5SDimitry Andric /** 24630b57cec5SDimitry Andric * Whether the entity is unconditionally unavailable on this platform. 24640b57cec5SDimitry Andric */ 24650b57cec5SDimitry Andric int Unavailable; 24660b57cec5SDimitry Andric /** 24670b57cec5SDimitry Andric * An optional message to provide to a user of this API, e.g., to 24680b57cec5SDimitry Andric * suggest replacement APIs. 24690b57cec5SDimitry Andric */ 24700b57cec5SDimitry Andric CXString Message; 24710b57cec5SDimitry Andric } CXPlatformAvailability; 24720b57cec5SDimitry Andric 24730b57cec5SDimitry Andric /** 24740b57cec5SDimitry Andric * Determine the availability of the entity that this cursor refers to 24750b57cec5SDimitry Andric * on any platforms for which availability information is known. 24760b57cec5SDimitry Andric * 24770b57cec5SDimitry Andric * \param cursor The cursor to query. 24780b57cec5SDimitry Andric * 24790b57cec5SDimitry Andric * \param always_deprecated If non-NULL, will be set to indicate whether the 24800b57cec5SDimitry Andric * entity is deprecated on all platforms. 24810b57cec5SDimitry Andric * 24820b57cec5SDimitry Andric * \param deprecated_message If non-NULL, will be set to the message text 24830b57cec5SDimitry Andric * provided along with the unconditional deprecation of this entity. The client 24840b57cec5SDimitry Andric * is responsible for deallocating this string. 24850b57cec5SDimitry Andric * 24860b57cec5SDimitry Andric * \param always_unavailable If non-NULL, will be set to indicate whether the 24870b57cec5SDimitry Andric * entity is unavailable on all platforms. 24880b57cec5SDimitry Andric * 24890b57cec5SDimitry Andric * \param unavailable_message If non-NULL, will be set to the message text 24900b57cec5SDimitry Andric * provided along with the unconditional unavailability of this entity. The 24910b57cec5SDimitry Andric * client is responsible for deallocating this string. 24920b57cec5SDimitry Andric * 24930b57cec5SDimitry Andric * \param availability If non-NULL, an array of CXPlatformAvailability instances 24940b57cec5SDimitry Andric * that will be populated with platform availability information, up to either 24950b57cec5SDimitry Andric * the number of platforms for which availability information is available (as 24960b57cec5SDimitry Andric * returned by this function) or \c availability_size, whichever is smaller. 24970b57cec5SDimitry Andric * 24980b57cec5SDimitry Andric * \param availability_size The number of elements available in the 24990b57cec5SDimitry Andric * \c availability array. 25000b57cec5SDimitry Andric * 25010b57cec5SDimitry Andric * \returns The number of platforms (N) for which availability information is 25020b57cec5SDimitry Andric * available (which is unrelated to \c availability_size). 25030b57cec5SDimitry Andric * 25040b57cec5SDimitry Andric * Note that the client is responsible for calling 25050b57cec5SDimitry Andric * \c clang_disposeCXPlatformAvailability to free each of the 25060b57cec5SDimitry Andric * platform-availability structures returned. There are 25070b57cec5SDimitry Andric * \c min(N, availability_size) such structures. 25080b57cec5SDimitry Andric */ 25095ffd83dbSDimitry Andric CINDEX_LINKAGE int clang_getCursorPlatformAvailability( 25105ffd83dbSDimitry Andric CXCursor cursor, int *always_deprecated, CXString *deprecated_message, 25115ffd83dbSDimitry Andric int *always_unavailable, CXString *unavailable_message, 25125ffd83dbSDimitry Andric CXPlatformAvailability *availability, int availability_size); 25130b57cec5SDimitry Andric 25140b57cec5SDimitry Andric /** 25150b57cec5SDimitry Andric * Free the memory associated with a \c CXPlatformAvailability structure. 25160b57cec5SDimitry Andric */ 25170b57cec5SDimitry Andric CINDEX_LINKAGE void 25180b57cec5SDimitry Andric clang_disposeCXPlatformAvailability(CXPlatformAvailability *availability); 25190b57cec5SDimitry Andric 25200b57cec5SDimitry Andric /** 2521e8d8bef9SDimitry Andric * If cursor refers to a variable declaration and it has initializer returns 2522e8d8bef9SDimitry Andric * cursor referring to the initializer otherwise return null cursor. 2523e8d8bef9SDimitry Andric */ 2524e8d8bef9SDimitry Andric CINDEX_LINKAGE CXCursor clang_Cursor_getVarDeclInitializer(CXCursor cursor); 2525e8d8bef9SDimitry Andric 2526e8d8bef9SDimitry Andric /** 2527e8d8bef9SDimitry Andric * If cursor refers to a variable declaration that has global storage returns 1. 2528e8d8bef9SDimitry Andric * If cursor refers to a variable declaration that doesn't have global storage 2529e8d8bef9SDimitry Andric * returns 0. Otherwise returns -1. 2530e8d8bef9SDimitry Andric */ 2531e8d8bef9SDimitry Andric CINDEX_LINKAGE int clang_Cursor_hasVarDeclGlobalStorage(CXCursor cursor); 2532e8d8bef9SDimitry Andric 2533e8d8bef9SDimitry Andric /** 2534e8d8bef9SDimitry Andric * If cursor refers to a variable declaration that has external storage 2535e8d8bef9SDimitry Andric * returns 1. If cursor refers to a variable declaration that doesn't have 2536e8d8bef9SDimitry Andric * external storage returns 0. Otherwise returns -1. 2537e8d8bef9SDimitry Andric */ 2538e8d8bef9SDimitry Andric CINDEX_LINKAGE int clang_Cursor_hasVarDeclExternalStorage(CXCursor cursor); 2539e8d8bef9SDimitry Andric 2540e8d8bef9SDimitry Andric /** 25410b57cec5SDimitry Andric * Describe the "language" of the entity referred to by a cursor. 25420b57cec5SDimitry Andric */ 25430b57cec5SDimitry Andric enum CXLanguageKind { 25440b57cec5SDimitry Andric CXLanguage_Invalid = 0, 25450b57cec5SDimitry Andric CXLanguage_C, 25460b57cec5SDimitry Andric CXLanguage_ObjC, 25470b57cec5SDimitry Andric CXLanguage_CPlusPlus 25480b57cec5SDimitry Andric }; 25490b57cec5SDimitry Andric 25500b57cec5SDimitry Andric /** 25510b57cec5SDimitry Andric * Determine the "language" of the entity referred to by a given cursor. 25520b57cec5SDimitry Andric */ 25530b57cec5SDimitry Andric CINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor); 25540b57cec5SDimitry Andric 25550b57cec5SDimitry Andric /** 25560b57cec5SDimitry Andric * Describe the "thread-local storage (TLS) kind" of the declaration 25570b57cec5SDimitry Andric * referred to by a cursor. 25580b57cec5SDimitry Andric */ 25595ffd83dbSDimitry Andric enum CXTLSKind { CXTLS_None = 0, CXTLS_Dynamic, CXTLS_Static }; 25600b57cec5SDimitry Andric 25610b57cec5SDimitry Andric /** 25620b57cec5SDimitry Andric * Determine the "thread-local storage (TLS) kind" of the declaration 25630b57cec5SDimitry Andric * referred to by a cursor. 25640b57cec5SDimitry Andric */ 25650b57cec5SDimitry Andric CINDEX_LINKAGE enum CXTLSKind clang_getCursorTLSKind(CXCursor cursor); 25660b57cec5SDimitry Andric 25670b57cec5SDimitry Andric /** 25680b57cec5SDimitry Andric * Returns the translation unit that a cursor originated from. 25690b57cec5SDimitry Andric */ 25700b57cec5SDimitry Andric CINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor); 25710b57cec5SDimitry Andric 25720b57cec5SDimitry Andric /** 25730b57cec5SDimitry Andric * A fast container representing a set of CXCursors. 25740b57cec5SDimitry Andric */ 25750b57cec5SDimitry Andric typedef struct CXCursorSetImpl *CXCursorSet; 25760b57cec5SDimitry Andric 25770b57cec5SDimitry Andric /** 25780b57cec5SDimitry Andric * Creates an empty CXCursorSet. 25790b57cec5SDimitry Andric */ 25800b57cec5SDimitry Andric CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void); 25810b57cec5SDimitry Andric 25820b57cec5SDimitry Andric /** 25830b57cec5SDimitry Andric * Disposes a CXCursorSet and releases its associated memory. 25840b57cec5SDimitry Andric */ 25850b57cec5SDimitry Andric CINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset); 25860b57cec5SDimitry Andric 25870b57cec5SDimitry Andric /** 25880b57cec5SDimitry Andric * Queries a CXCursorSet to see if it contains a specific CXCursor. 25890b57cec5SDimitry Andric * 25900b57cec5SDimitry Andric * \returns non-zero if the set contains the specified cursor. 25910b57cec5SDimitry Andric */ 25920b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset, 25930b57cec5SDimitry Andric CXCursor cursor); 25940b57cec5SDimitry Andric 25950b57cec5SDimitry Andric /** 25960b57cec5SDimitry Andric * Inserts a CXCursor into a CXCursorSet. 25970b57cec5SDimitry Andric * 25980b57cec5SDimitry Andric * \returns zero if the CXCursor was already in the set, and non-zero otherwise. 25990b57cec5SDimitry Andric */ 26000b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset, 26010b57cec5SDimitry Andric CXCursor cursor); 26020b57cec5SDimitry Andric 26030b57cec5SDimitry Andric /** 26040b57cec5SDimitry Andric * Determine the semantic parent of the given cursor. 26050b57cec5SDimitry Andric * 26060b57cec5SDimitry Andric * The semantic parent of a cursor is the cursor that semantically contains 26070b57cec5SDimitry Andric * the given \p cursor. For many declarations, the lexical and semantic parents 26080b57cec5SDimitry Andric * are equivalent (the lexical parent is returned by 26090b57cec5SDimitry Andric * \c clang_getCursorLexicalParent()). They diverge when declarations or 26100b57cec5SDimitry Andric * definitions are provided out-of-line. For example: 26110b57cec5SDimitry Andric * 26120b57cec5SDimitry Andric * \code 26130b57cec5SDimitry Andric * class C { 26140b57cec5SDimitry Andric * void f(); 26150b57cec5SDimitry Andric * }; 26160b57cec5SDimitry Andric * 26170b57cec5SDimitry Andric * void C::f() { } 26180b57cec5SDimitry Andric * \endcode 26190b57cec5SDimitry Andric * 26200b57cec5SDimitry Andric * In the out-of-line definition of \c C::f, the semantic parent is 26210b57cec5SDimitry Andric * the class \c C, of which this function is a member. The lexical parent is 26220b57cec5SDimitry Andric * the place where the declaration actually occurs in the source code; in this 26230b57cec5SDimitry Andric * case, the definition occurs in the translation unit. In general, the 26240b57cec5SDimitry Andric * lexical parent for a given entity can change without affecting the semantics 26250b57cec5SDimitry Andric * of the program, and the lexical parent of different declarations of the 26260b57cec5SDimitry Andric * same entity may be different. Changing the semantic parent of a declaration, 26270b57cec5SDimitry Andric * on the other hand, can have a major impact on semantics, and redeclarations 26280b57cec5SDimitry Andric * of a particular entity should all have the same semantic context. 26290b57cec5SDimitry Andric * 26300b57cec5SDimitry Andric * In the example above, both declarations of \c C::f have \c C as their 26310b57cec5SDimitry Andric * semantic context, while the lexical context of the first \c C::f is \c C 26320b57cec5SDimitry Andric * and the lexical context of the second \c C::f is the translation unit. 26330b57cec5SDimitry Andric * 26340b57cec5SDimitry Andric * For global declarations, the semantic parent is the translation unit. 26350b57cec5SDimitry Andric */ 26360b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor); 26370b57cec5SDimitry Andric 26380b57cec5SDimitry Andric /** 26390b57cec5SDimitry Andric * Determine the lexical parent of the given cursor. 26400b57cec5SDimitry Andric * 26410b57cec5SDimitry Andric * The lexical parent of a cursor is the cursor in which the given \p cursor 26420b57cec5SDimitry Andric * was actually written. For many declarations, the lexical and semantic parents 26430b57cec5SDimitry Andric * are equivalent (the semantic parent is returned by 26440b57cec5SDimitry Andric * \c clang_getCursorSemanticParent()). They diverge when declarations or 26450b57cec5SDimitry Andric * definitions are provided out-of-line. For example: 26460b57cec5SDimitry Andric * 26470b57cec5SDimitry Andric * \code 26480b57cec5SDimitry Andric * class C { 26490b57cec5SDimitry Andric * void f(); 26500b57cec5SDimitry Andric * }; 26510b57cec5SDimitry Andric * 26520b57cec5SDimitry Andric * void C::f() { } 26530b57cec5SDimitry Andric * \endcode 26540b57cec5SDimitry Andric * 26550b57cec5SDimitry Andric * In the out-of-line definition of \c C::f, the semantic parent is 26560b57cec5SDimitry Andric * the class \c C, of which this function is a member. The lexical parent is 26570b57cec5SDimitry Andric * the place where the declaration actually occurs in the source code; in this 26580b57cec5SDimitry Andric * case, the definition occurs in the translation unit. In general, the 26590b57cec5SDimitry Andric * lexical parent for a given entity can change without affecting the semantics 26600b57cec5SDimitry Andric * of the program, and the lexical parent of different declarations of the 26610b57cec5SDimitry Andric * same entity may be different. Changing the semantic parent of a declaration, 26620b57cec5SDimitry Andric * on the other hand, can have a major impact on semantics, and redeclarations 26630b57cec5SDimitry Andric * of a particular entity should all have the same semantic context. 26640b57cec5SDimitry Andric * 26650b57cec5SDimitry Andric * In the example above, both declarations of \c C::f have \c C as their 26660b57cec5SDimitry Andric * semantic context, while the lexical context of the first \c C::f is \c C 26670b57cec5SDimitry Andric * and the lexical context of the second \c C::f is the translation unit. 26680b57cec5SDimitry Andric * 26690b57cec5SDimitry Andric * For declarations written in the global scope, the lexical parent is 26700b57cec5SDimitry Andric * the translation unit. 26710b57cec5SDimitry Andric */ 26720b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor); 26730b57cec5SDimitry Andric 26740b57cec5SDimitry Andric /** 26750b57cec5SDimitry Andric * Determine the set of methods that are overridden by the given 26760b57cec5SDimitry Andric * method. 26770b57cec5SDimitry Andric * 26780b57cec5SDimitry Andric * In both Objective-C and C++, a method (aka virtual member function, 26790b57cec5SDimitry Andric * in C++) can override a virtual method in a base class. For 26800b57cec5SDimitry Andric * Objective-C, a method is said to override any method in the class's 26810b57cec5SDimitry Andric * base class, its protocols, or its categories' protocols, that has the same 26820b57cec5SDimitry Andric * selector and is of the same kind (class or instance). 26830b57cec5SDimitry Andric * If no such method exists, the search continues to the class's superclass, 26840b57cec5SDimitry Andric * its protocols, and its categories, and so on. A method from an Objective-C 26850b57cec5SDimitry Andric * implementation is considered to override the same methods as its 26860b57cec5SDimitry Andric * corresponding method in the interface. 26870b57cec5SDimitry Andric * 26880b57cec5SDimitry Andric * For C++, a virtual member function overrides any virtual member 26890b57cec5SDimitry Andric * function with the same signature that occurs in its base 26900b57cec5SDimitry Andric * classes. With multiple inheritance, a virtual member function can 26910b57cec5SDimitry Andric * override several virtual member functions coming from different 26920b57cec5SDimitry Andric * base classes. 26930b57cec5SDimitry Andric * 26940b57cec5SDimitry Andric * In all cases, this function determines the immediate overridden 26950b57cec5SDimitry Andric * method, rather than all of the overridden methods. For example, if 26960b57cec5SDimitry Andric * a method is originally declared in a class A, then overridden in B 26970b57cec5SDimitry Andric * (which in inherits from A) and also in C (which inherited from B), 26980b57cec5SDimitry Andric * then the only overridden method returned from this function when 26990b57cec5SDimitry Andric * invoked on C's method will be B's method. The client may then 27000b57cec5SDimitry Andric * invoke this function again, given the previously-found overridden 27010b57cec5SDimitry Andric * methods, to map out the complete method-override set. 27020b57cec5SDimitry Andric * 27030b57cec5SDimitry Andric * \param cursor A cursor representing an Objective-C or C++ 27040b57cec5SDimitry Andric * method. This routine will compute the set of methods that this 27050b57cec5SDimitry Andric * method overrides. 27060b57cec5SDimitry Andric * 27070b57cec5SDimitry Andric * \param overridden A pointer whose pointee will be replaced with a 27080b57cec5SDimitry Andric * pointer to an array of cursors, representing the set of overridden 27090b57cec5SDimitry Andric * methods. If there are no overridden methods, the pointee will be 27100b57cec5SDimitry Andric * set to NULL. The pointee must be freed via a call to 27110b57cec5SDimitry Andric * \c clang_disposeOverriddenCursors(). 27120b57cec5SDimitry Andric * 27130b57cec5SDimitry Andric * \param num_overridden A pointer to the number of overridden 27140b57cec5SDimitry Andric * functions, will be set to the number of overridden functions in the 27150b57cec5SDimitry Andric * array pointed to by \p overridden. 27160b57cec5SDimitry Andric */ 27170b57cec5SDimitry Andric CINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor, 27180b57cec5SDimitry Andric CXCursor **overridden, 27190b57cec5SDimitry Andric unsigned *num_overridden); 27200b57cec5SDimitry Andric 27210b57cec5SDimitry Andric /** 27220b57cec5SDimitry Andric * Free the set of overridden cursors returned by \c 27230b57cec5SDimitry Andric * clang_getOverriddenCursors(). 27240b57cec5SDimitry Andric */ 27250b57cec5SDimitry Andric CINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden); 27260b57cec5SDimitry Andric 27270b57cec5SDimitry Andric /** 27280b57cec5SDimitry Andric * Retrieve the file that is included by the given inclusion directive 27290b57cec5SDimitry Andric * cursor. 27300b57cec5SDimitry Andric */ 27310b57cec5SDimitry Andric CINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor); 27320b57cec5SDimitry Andric 27330b57cec5SDimitry Andric /** 27340b57cec5SDimitry Andric * @} 27350b57cec5SDimitry Andric */ 27360b57cec5SDimitry Andric 27370b57cec5SDimitry Andric /** 27380b57cec5SDimitry Andric * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code 27390b57cec5SDimitry Andric * 27400b57cec5SDimitry Andric * Cursors represent a location within the Abstract Syntax Tree (AST). These 27410b57cec5SDimitry Andric * routines help map between cursors and the physical locations where the 27420b57cec5SDimitry Andric * described entities occur in the source code. The mapping is provided in 27430b57cec5SDimitry Andric * both directions, so one can map from source code to the AST and back. 27440b57cec5SDimitry Andric * 27450b57cec5SDimitry Andric * @{ 27460b57cec5SDimitry Andric */ 27470b57cec5SDimitry Andric 27480b57cec5SDimitry Andric /** 27490b57cec5SDimitry Andric * Map a source location to the cursor that describes the entity at that 27500b57cec5SDimitry Andric * location in the source code. 27510b57cec5SDimitry Andric * 27520b57cec5SDimitry Andric * clang_getCursor() maps an arbitrary source location within a translation 27530b57cec5SDimitry Andric * unit down to the most specific cursor that describes the entity at that 27540b57cec5SDimitry Andric * location. For example, given an expression \c x + y, invoking 27550b57cec5SDimitry Andric * clang_getCursor() with a source location pointing to "x" will return the 27560b57cec5SDimitry Andric * cursor for "x"; similarly for "y". If the cursor points anywhere between 27570b57cec5SDimitry Andric * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor() 27580b57cec5SDimitry Andric * will return a cursor referring to the "+" expression. 27590b57cec5SDimitry Andric * 27600b57cec5SDimitry Andric * \returns a cursor representing the entity at the given source location, or 27610b57cec5SDimitry Andric * a NULL cursor if no such entity can be found. 27620b57cec5SDimitry Andric */ 27630b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation); 27640b57cec5SDimitry Andric 27650b57cec5SDimitry Andric /** 27660b57cec5SDimitry Andric * Retrieve the physical location of the source constructor referenced 27670b57cec5SDimitry Andric * by the given cursor. 27680b57cec5SDimitry Andric * 27690b57cec5SDimitry Andric * The location of a declaration is typically the location of the name of that 27700b57cec5SDimitry Andric * declaration, where the name of that declaration would occur if it is 27710b57cec5SDimitry Andric * unnamed, or some keyword that introduces that particular declaration. 27720b57cec5SDimitry Andric * The location of a reference is where that reference occurs within the 27730b57cec5SDimitry Andric * source code. 27740b57cec5SDimitry Andric */ 27750b57cec5SDimitry Andric CINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor); 27760b57cec5SDimitry Andric 27770b57cec5SDimitry Andric /** 27780b57cec5SDimitry Andric * Retrieve the physical extent of the source construct referenced by 27790b57cec5SDimitry Andric * the given cursor. 27800b57cec5SDimitry Andric * 27810b57cec5SDimitry Andric * The extent of a cursor starts with the file/line/column pointing at the 27820b57cec5SDimitry Andric * first character within the source construct that the cursor refers to and 27830b57cec5SDimitry Andric * ends with the last character within that source construct. For a 27840b57cec5SDimitry Andric * declaration, the extent covers the declaration itself. For a reference, 27850b57cec5SDimitry Andric * the extent covers the location of the reference (e.g., where the referenced 27860b57cec5SDimitry Andric * entity was actually used). 27870b57cec5SDimitry Andric */ 27880b57cec5SDimitry Andric CINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor); 27890b57cec5SDimitry Andric 27900b57cec5SDimitry Andric /** 27910b57cec5SDimitry Andric * @} 27920b57cec5SDimitry Andric */ 27930b57cec5SDimitry Andric 27940b57cec5SDimitry Andric /** 27950b57cec5SDimitry Andric * \defgroup CINDEX_TYPES Type information for CXCursors 27960b57cec5SDimitry Andric * 27970b57cec5SDimitry Andric * @{ 27980b57cec5SDimitry Andric */ 27990b57cec5SDimitry Andric 28000b57cec5SDimitry Andric /** 28010b57cec5SDimitry Andric * Describes the kind of type 28020b57cec5SDimitry Andric */ 28030b57cec5SDimitry Andric enum CXTypeKind { 28040b57cec5SDimitry Andric /** 28050b57cec5SDimitry Andric * Represents an invalid type (e.g., where no type is available). 28060b57cec5SDimitry Andric */ 28070b57cec5SDimitry Andric CXType_Invalid = 0, 28080b57cec5SDimitry Andric 28090b57cec5SDimitry Andric /** 28100b57cec5SDimitry Andric * A type whose specific kind is not exposed via this 28110b57cec5SDimitry Andric * interface. 28120b57cec5SDimitry Andric */ 28130b57cec5SDimitry Andric CXType_Unexposed = 1, 28140b57cec5SDimitry Andric 28150b57cec5SDimitry Andric /* Builtin types */ 28160b57cec5SDimitry Andric CXType_Void = 2, 28170b57cec5SDimitry Andric CXType_Bool = 3, 28180b57cec5SDimitry Andric CXType_Char_U = 4, 28190b57cec5SDimitry Andric CXType_UChar = 5, 28200b57cec5SDimitry Andric CXType_Char16 = 6, 28210b57cec5SDimitry Andric CXType_Char32 = 7, 28220b57cec5SDimitry Andric CXType_UShort = 8, 28230b57cec5SDimitry Andric CXType_UInt = 9, 28240b57cec5SDimitry Andric CXType_ULong = 10, 28250b57cec5SDimitry Andric CXType_ULongLong = 11, 28260b57cec5SDimitry Andric CXType_UInt128 = 12, 28270b57cec5SDimitry Andric CXType_Char_S = 13, 28280b57cec5SDimitry Andric CXType_SChar = 14, 28290b57cec5SDimitry Andric CXType_WChar = 15, 28300b57cec5SDimitry Andric CXType_Short = 16, 28310b57cec5SDimitry Andric CXType_Int = 17, 28320b57cec5SDimitry Andric CXType_Long = 18, 28330b57cec5SDimitry Andric CXType_LongLong = 19, 28340b57cec5SDimitry Andric CXType_Int128 = 20, 28350b57cec5SDimitry Andric CXType_Float = 21, 28360b57cec5SDimitry Andric CXType_Double = 22, 28370b57cec5SDimitry Andric CXType_LongDouble = 23, 28380b57cec5SDimitry Andric CXType_NullPtr = 24, 28390b57cec5SDimitry Andric CXType_Overload = 25, 28400b57cec5SDimitry Andric CXType_Dependent = 26, 28410b57cec5SDimitry Andric CXType_ObjCId = 27, 28420b57cec5SDimitry Andric CXType_ObjCClass = 28, 28430b57cec5SDimitry Andric CXType_ObjCSel = 29, 28440b57cec5SDimitry Andric CXType_Float128 = 30, 28450b57cec5SDimitry Andric CXType_Half = 31, 28460b57cec5SDimitry Andric CXType_Float16 = 32, 28470b57cec5SDimitry Andric CXType_ShortAccum = 33, 28480b57cec5SDimitry Andric CXType_Accum = 34, 28490b57cec5SDimitry Andric CXType_LongAccum = 35, 28500b57cec5SDimitry Andric CXType_UShortAccum = 36, 28510b57cec5SDimitry Andric CXType_UAccum = 37, 28520b57cec5SDimitry Andric CXType_ULongAccum = 38, 28535ffd83dbSDimitry Andric CXType_BFloat16 = 39, 2854349cc55cSDimitry Andric CXType_Ibm128 = 40, 28550b57cec5SDimitry Andric CXType_FirstBuiltin = CXType_Void, 2856349cc55cSDimitry Andric CXType_LastBuiltin = CXType_Ibm128, 28570b57cec5SDimitry Andric 28580b57cec5SDimitry Andric CXType_Complex = 100, 28590b57cec5SDimitry Andric CXType_Pointer = 101, 28600b57cec5SDimitry Andric CXType_BlockPointer = 102, 28610b57cec5SDimitry Andric CXType_LValueReference = 103, 28620b57cec5SDimitry Andric CXType_RValueReference = 104, 28630b57cec5SDimitry Andric CXType_Record = 105, 28640b57cec5SDimitry Andric CXType_Enum = 106, 28650b57cec5SDimitry Andric CXType_Typedef = 107, 28660b57cec5SDimitry Andric CXType_ObjCInterface = 108, 28670b57cec5SDimitry Andric CXType_ObjCObjectPointer = 109, 28680b57cec5SDimitry Andric CXType_FunctionNoProto = 110, 28690b57cec5SDimitry Andric CXType_FunctionProto = 111, 28700b57cec5SDimitry Andric CXType_ConstantArray = 112, 28710b57cec5SDimitry Andric CXType_Vector = 113, 28720b57cec5SDimitry Andric CXType_IncompleteArray = 114, 28730b57cec5SDimitry Andric CXType_VariableArray = 115, 28740b57cec5SDimitry Andric CXType_DependentSizedArray = 116, 28750b57cec5SDimitry Andric CXType_MemberPointer = 117, 28760b57cec5SDimitry Andric CXType_Auto = 118, 28770b57cec5SDimitry Andric 28780b57cec5SDimitry Andric /** 28790b57cec5SDimitry Andric * Represents a type that was referred to using an elaborated type keyword. 28800b57cec5SDimitry Andric * 28810b57cec5SDimitry Andric * E.g., struct S, or via a qualified name, e.g., N::M::type, or both. 28820b57cec5SDimitry Andric */ 28830b57cec5SDimitry Andric CXType_Elaborated = 119, 28840b57cec5SDimitry Andric 28850b57cec5SDimitry Andric /* OpenCL PipeType. */ 28860b57cec5SDimitry Andric CXType_Pipe = 120, 28870b57cec5SDimitry Andric 28880b57cec5SDimitry Andric /* OpenCL builtin types. */ 28890b57cec5SDimitry Andric CXType_OCLImage1dRO = 121, 28900b57cec5SDimitry Andric CXType_OCLImage1dArrayRO = 122, 28910b57cec5SDimitry Andric CXType_OCLImage1dBufferRO = 123, 28920b57cec5SDimitry Andric CXType_OCLImage2dRO = 124, 28930b57cec5SDimitry Andric CXType_OCLImage2dArrayRO = 125, 28940b57cec5SDimitry Andric CXType_OCLImage2dDepthRO = 126, 28950b57cec5SDimitry Andric CXType_OCLImage2dArrayDepthRO = 127, 28960b57cec5SDimitry Andric CXType_OCLImage2dMSAARO = 128, 28970b57cec5SDimitry Andric CXType_OCLImage2dArrayMSAARO = 129, 28980b57cec5SDimitry Andric CXType_OCLImage2dMSAADepthRO = 130, 28990b57cec5SDimitry Andric CXType_OCLImage2dArrayMSAADepthRO = 131, 29000b57cec5SDimitry Andric CXType_OCLImage3dRO = 132, 29010b57cec5SDimitry Andric CXType_OCLImage1dWO = 133, 29020b57cec5SDimitry Andric CXType_OCLImage1dArrayWO = 134, 29030b57cec5SDimitry Andric CXType_OCLImage1dBufferWO = 135, 29040b57cec5SDimitry Andric CXType_OCLImage2dWO = 136, 29050b57cec5SDimitry Andric CXType_OCLImage2dArrayWO = 137, 29060b57cec5SDimitry Andric CXType_OCLImage2dDepthWO = 138, 29070b57cec5SDimitry Andric CXType_OCLImage2dArrayDepthWO = 139, 29080b57cec5SDimitry Andric CXType_OCLImage2dMSAAWO = 140, 29090b57cec5SDimitry Andric CXType_OCLImage2dArrayMSAAWO = 141, 29100b57cec5SDimitry Andric CXType_OCLImage2dMSAADepthWO = 142, 29110b57cec5SDimitry Andric CXType_OCLImage2dArrayMSAADepthWO = 143, 29120b57cec5SDimitry Andric CXType_OCLImage3dWO = 144, 29130b57cec5SDimitry Andric CXType_OCLImage1dRW = 145, 29140b57cec5SDimitry Andric CXType_OCLImage1dArrayRW = 146, 29150b57cec5SDimitry Andric CXType_OCLImage1dBufferRW = 147, 29160b57cec5SDimitry Andric CXType_OCLImage2dRW = 148, 29170b57cec5SDimitry Andric CXType_OCLImage2dArrayRW = 149, 29180b57cec5SDimitry Andric CXType_OCLImage2dDepthRW = 150, 29190b57cec5SDimitry Andric CXType_OCLImage2dArrayDepthRW = 151, 29200b57cec5SDimitry Andric CXType_OCLImage2dMSAARW = 152, 29210b57cec5SDimitry Andric CXType_OCLImage2dArrayMSAARW = 153, 29220b57cec5SDimitry Andric CXType_OCLImage2dMSAADepthRW = 154, 29230b57cec5SDimitry Andric CXType_OCLImage2dArrayMSAADepthRW = 155, 29240b57cec5SDimitry Andric CXType_OCLImage3dRW = 156, 29250b57cec5SDimitry Andric CXType_OCLSampler = 157, 29260b57cec5SDimitry Andric CXType_OCLEvent = 158, 29270b57cec5SDimitry Andric CXType_OCLQueue = 159, 29280b57cec5SDimitry Andric CXType_OCLReserveID = 160, 29290b57cec5SDimitry Andric 29300b57cec5SDimitry Andric CXType_ObjCObject = 161, 29310b57cec5SDimitry Andric CXType_ObjCTypeParam = 162, 29320b57cec5SDimitry Andric CXType_Attributed = 163, 29330b57cec5SDimitry Andric 29340b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCMcePayload = 164, 29350b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCImePayload = 165, 29360b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCRefPayload = 166, 29370b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCSicPayload = 167, 29380b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCMceResult = 168, 29390b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCImeResult = 169, 29400b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCRefResult = 170, 29410b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCSicResult = 171, 294206c3fb27SDimitry Andric CXType_OCLIntelSubgroupAVCImeResultSingleReferenceStreamout = 172, 294306c3fb27SDimitry Andric CXType_OCLIntelSubgroupAVCImeResultDualReferenceStreamout = 173, 294406c3fb27SDimitry Andric CXType_OCLIntelSubgroupAVCImeSingleReferenceStreamin = 174, 294506c3fb27SDimitry Andric CXType_OCLIntelSubgroupAVCImeDualReferenceStreamin = 175, 294606c3fb27SDimitry Andric 294706c3fb27SDimitry Andric /* Old aliases for AVC OpenCL extension types. */ 29480b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout = 172, 29490b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout = 173, 29500b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCImeSingleRefStreamin = 174, 29510b57cec5SDimitry Andric CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175, 29520b57cec5SDimitry Andric 29535ffd83dbSDimitry Andric CXType_ExtVector = 176, 295481ad6265SDimitry Andric CXType_Atomic = 177, 295581ad6265SDimitry Andric CXType_BTFTagAttributed = 178 29560b57cec5SDimitry Andric }; 29570b57cec5SDimitry Andric 29580b57cec5SDimitry Andric /** 29590b57cec5SDimitry Andric * Describes the calling convention of a function type 29600b57cec5SDimitry Andric */ 29610b57cec5SDimitry Andric enum CXCallingConv { 29620b57cec5SDimitry Andric CXCallingConv_Default = 0, 29630b57cec5SDimitry Andric CXCallingConv_C = 1, 29640b57cec5SDimitry Andric CXCallingConv_X86StdCall = 2, 29650b57cec5SDimitry Andric CXCallingConv_X86FastCall = 3, 29660b57cec5SDimitry Andric CXCallingConv_X86ThisCall = 4, 29670b57cec5SDimitry Andric CXCallingConv_X86Pascal = 5, 29680b57cec5SDimitry Andric CXCallingConv_AAPCS = 6, 29690b57cec5SDimitry Andric CXCallingConv_AAPCS_VFP = 7, 29700b57cec5SDimitry Andric CXCallingConv_X86RegCall = 8, 29710b57cec5SDimitry Andric CXCallingConv_IntelOclBicc = 9, 29720b57cec5SDimitry Andric CXCallingConv_Win64 = 10, 29730b57cec5SDimitry Andric /* Alias for compatibility with older versions of API. */ 29740b57cec5SDimitry Andric CXCallingConv_X86_64Win64 = CXCallingConv_Win64, 29750b57cec5SDimitry Andric CXCallingConv_X86_64SysV = 11, 29760b57cec5SDimitry Andric CXCallingConv_X86VectorCall = 12, 29770b57cec5SDimitry Andric CXCallingConv_Swift = 13, 29780b57cec5SDimitry Andric CXCallingConv_PreserveMost = 14, 29790b57cec5SDimitry Andric CXCallingConv_PreserveAll = 15, 29800b57cec5SDimitry Andric CXCallingConv_AArch64VectorCall = 16, 2981fe6060f1SDimitry Andric CXCallingConv_SwiftAsync = 17, 298281ad6265SDimitry Andric CXCallingConv_AArch64SVEPCS = 18, 29835f757f3fSDimitry Andric CXCallingConv_M68kRTD = 19, 29840b57cec5SDimitry Andric 29850b57cec5SDimitry Andric CXCallingConv_Invalid = 100, 29860b57cec5SDimitry Andric CXCallingConv_Unexposed = 200 29870b57cec5SDimitry Andric }; 29880b57cec5SDimitry Andric 29890b57cec5SDimitry Andric /** 29900b57cec5SDimitry Andric * The type of an element in the abstract syntax tree. 29910b57cec5SDimitry Andric * 29920b57cec5SDimitry Andric */ 29930b57cec5SDimitry Andric typedef struct { 29940b57cec5SDimitry Andric enum CXTypeKind kind; 29950b57cec5SDimitry Andric void *data[2]; 29960b57cec5SDimitry Andric } CXType; 29970b57cec5SDimitry Andric 29980b57cec5SDimitry Andric /** 29990b57cec5SDimitry Andric * Retrieve the type of a CXCursor (if any). 30000b57cec5SDimitry Andric */ 30010b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C); 30020b57cec5SDimitry Andric 30030b57cec5SDimitry Andric /** 30040b57cec5SDimitry Andric * Pretty-print the underlying type using the rules of the 30050b57cec5SDimitry Andric * language of the translation unit from which it came. 30060b57cec5SDimitry Andric * 30070b57cec5SDimitry Andric * If the type is invalid, an empty string is returned. 30080b57cec5SDimitry Andric */ 30090b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT); 30100b57cec5SDimitry Andric 30110b57cec5SDimitry Andric /** 30120b57cec5SDimitry Andric * Retrieve the underlying type of a typedef declaration. 30130b57cec5SDimitry Andric * 30140b57cec5SDimitry Andric * If the cursor does not reference a typedef declaration, an invalid type is 30150b57cec5SDimitry Andric * returned. 30160b57cec5SDimitry Andric */ 30170b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C); 30180b57cec5SDimitry Andric 30190b57cec5SDimitry Andric /** 30200b57cec5SDimitry Andric * Retrieve the integer type of an enum declaration. 30210b57cec5SDimitry Andric * 30220b57cec5SDimitry Andric * If the cursor does not reference an enum declaration, an invalid type is 30230b57cec5SDimitry Andric * returned. 30240b57cec5SDimitry Andric */ 30250b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C); 30260b57cec5SDimitry Andric 30270b57cec5SDimitry Andric /** 30280b57cec5SDimitry Andric * Retrieve the integer value of an enum constant declaration as a signed 30290b57cec5SDimitry Andric * long long. 30300b57cec5SDimitry Andric * 30315ffd83dbSDimitry Andric * If the cursor does not reference an enum constant declaration, LLONG_MIN is 30325ffd83dbSDimitry Andric * returned. Since this is also potentially a valid constant value, the kind of 30335ffd83dbSDimitry Andric * the cursor must be verified before calling this function. 30340b57cec5SDimitry Andric */ 30350b57cec5SDimitry Andric CINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C); 30360b57cec5SDimitry Andric 30370b57cec5SDimitry Andric /** 30380b57cec5SDimitry Andric * Retrieve the integer value of an enum constant declaration as an unsigned 30390b57cec5SDimitry Andric * long long. 30400b57cec5SDimitry Andric * 30415ffd83dbSDimitry Andric * If the cursor does not reference an enum constant declaration, ULLONG_MAX is 30425ffd83dbSDimitry Andric * returned. Since this is also potentially a valid constant value, the kind of 30435ffd83dbSDimitry Andric * the cursor must be verified before calling this function. 30440b57cec5SDimitry Andric */ 30455ffd83dbSDimitry Andric CINDEX_LINKAGE unsigned long long 30465ffd83dbSDimitry Andric clang_getEnumConstantDeclUnsignedValue(CXCursor C); 30470b57cec5SDimitry Andric 30480b57cec5SDimitry Andric /** 304906c3fb27SDimitry Andric * Returns non-zero if the cursor specifies a Record member that is a bit-field. 305006c3fb27SDimitry Andric */ 305106c3fb27SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_isBitField(CXCursor C); 305206c3fb27SDimitry Andric 305306c3fb27SDimitry Andric /** 305406c3fb27SDimitry Andric * Retrieve the bit width of a bit-field declaration as an integer. 30550b57cec5SDimitry Andric * 305606c3fb27SDimitry Andric * If the cursor does not reference a bit-field, or if the bit-field's width 305706c3fb27SDimitry Andric * expression cannot be evaluated, -1 is returned. 305806c3fb27SDimitry Andric * 305906c3fb27SDimitry Andric * For example: 306006c3fb27SDimitry Andric * \code 306106c3fb27SDimitry Andric * if (clang_Cursor_isBitField(Cursor)) { 306206c3fb27SDimitry Andric * int Width = clang_getFieldDeclBitWidth(Cursor); 306306c3fb27SDimitry Andric * if (Width != -1) { 306406c3fb27SDimitry Andric * // The bit-field width is not value-dependent. 306506c3fb27SDimitry Andric * } 306606c3fb27SDimitry Andric * } 306706c3fb27SDimitry Andric * \endcode 30680b57cec5SDimitry Andric */ 30690b57cec5SDimitry Andric CINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C); 30700b57cec5SDimitry Andric 30710b57cec5SDimitry Andric /** 30720b57cec5SDimitry Andric * Retrieve the number of non-variadic arguments associated with a given 30730b57cec5SDimitry Andric * cursor. 30740b57cec5SDimitry Andric * 30750b57cec5SDimitry Andric * The number of arguments can be determined for calls as well as for 30760b57cec5SDimitry Andric * declarations of functions or methods. For other cursors -1 is returned. 30770b57cec5SDimitry Andric */ 30780b57cec5SDimitry Andric CINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C); 30790b57cec5SDimitry Andric 30800b57cec5SDimitry Andric /** 30810b57cec5SDimitry Andric * Retrieve the argument cursor of a function or method. 30820b57cec5SDimitry Andric * 30830b57cec5SDimitry Andric * The argument cursor can be determined for calls as well as for declarations 30840b57cec5SDimitry Andric * of functions or methods. For other cursors and for invalid indices, an 30850b57cec5SDimitry Andric * invalid cursor is returned. 30860b57cec5SDimitry Andric */ 30870b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i); 30880b57cec5SDimitry Andric 30890b57cec5SDimitry Andric /** 30900b57cec5SDimitry Andric * Describes the kind of a template argument. 30910b57cec5SDimitry Andric * 30920b57cec5SDimitry Andric * See the definition of llvm::clang::TemplateArgument::ArgKind for full 30930b57cec5SDimitry Andric * element descriptions. 30940b57cec5SDimitry Andric */ 30950b57cec5SDimitry Andric enum CXTemplateArgumentKind { 30960b57cec5SDimitry Andric CXTemplateArgumentKind_Null, 30970b57cec5SDimitry Andric CXTemplateArgumentKind_Type, 30980b57cec5SDimitry Andric CXTemplateArgumentKind_Declaration, 30990b57cec5SDimitry Andric CXTemplateArgumentKind_NullPtr, 31000b57cec5SDimitry Andric CXTemplateArgumentKind_Integral, 31010b57cec5SDimitry Andric CXTemplateArgumentKind_Template, 31020b57cec5SDimitry Andric CXTemplateArgumentKind_TemplateExpansion, 31030b57cec5SDimitry Andric CXTemplateArgumentKind_Expression, 31040b57cec5SDimitry Andric CXTemplateArgumentKind_Pack, 31050b57cec5SDimitry Andric /* Indicates an error case, preventing the kind from being deduced. */ 31060b57cec5SDimitry Andric CXTemplateArgumentKind_Invalid 31070b57cec5SDimitry Andric }; 31080b57cec5SDimitry Andric 31090b57cec5SDimitry Andric /** 3110bdd1243dSDimitry Andric * Returns the number of template args of a function, struct, or class decl 3111bdd1243dSDimitry Andric * representing a template specialization. 31120b57cec5SDimitry Andric * 31130b57cec5SDimitry Andric * If the argument cursor cannot be converted into a template function 31140b57cec5SDimitry Andric * declaration, -1 is returned. 31150b57cec5SDimitry Andric * 31160b57cec5SDimitry Andric * For example, for the following declaration and specialization: 31170b57cec5SDimitry Andric * template <typename T, int kInt, bool kBool> 31180b57cec5SDimitry Andric * void foo() { ... } 31190b57cec5SDimitry Andric * 31200b57cec5SDimitry Andric * template <> 31210b57cec5SDimitry Andric * void foo<float, -7, true>(); 31220b57cec5SDimitry Andric * 31230b57cec5SDimitry Andric * The value 3 would be returned from this call. 31240b57cec5SDimitry Andric */ 31250b57cec5SDimitry Andric CINDEX_LINKAGE int clang_Cursor_getNumTemplateArguments(CXCursor C); 31260b57cec5SDimitry Andric 31270b57cec5SDimitry Andric /** 31280b57cec5SDimitry Andric * Retrieve the kind of the I'th template argument of the CXCursor C. 31290b57cec5SDimitry Andric * 3130bdd1243dSDimitry Andric * If the argument CXCursor does not represent a FunctionDecl, StructDecl, or 3131bdd1243dSDimitry Andric * ClassTemplatePartialSpecialization, an invalid template argument kind is 3132bdd1243dSDimitry Andric * returned. 31330b57cec5SDimitry Andric * 31340b57cec5SDimitry Andric * For example, for the following declaration and specialization: 31350b57cec5SDimitry Andric * template <typename T, int kInt, bool kBool> 31360b57cec5SDimitry Andric * void foo() { ... } 31370b57cec5SDimitry Andric * 31380b57cec5SDimitry Andric * template <> 31390b57cec5SDimitry Andric * void foo<float, -7, true>(); 31400b57cec5SDimitry Andric * 31410b57cec5SDimitry Andric * For I = 0, 1, and 2, Type, Integral, and Integral will be returned, 31420b57cec5SDimitry Andric * respectively. 31430b57cec5SDimitry Andric */ 31445ffd83dbSDimitry Andric CINDEX_LINKAGE enum CXTemplateArgumentKind 31455ffd83dbSDimitry Andric clang_Cursor_getTemplateArgumentKind(CXCursor C, unsigned I); 31460b57cec5SDimitry Andric 31470b57cec5SDimitry Andric /** 31480b57cec5SDimitry Andric * Retrieve a CXType representing the type of a TemplateArgument of a 31490b57cec5SDimitry Andric * function decl representing a template specialization. 31500b57cec5SDimitry Andric * 3151bdd1243dSDimitry Andric * If the argument CXCursor does not represent a FunctionDecl, StructDecl, 3152bdd1243dSDimitry Andric * ClassDecl or ClassTemplatePartialSpecialization whose I'th template argument 3153bdd1243dSDimitry Andric * has a kind of CXTemplateArgKind_Integral, an invalid type is returned. 31540b57cec5SDimitry Andric * 31550b57cec5SDimitry Andric * For example, for the following declaration and specialization: 31560b57cec5SDimitry Andric * template <typename T, int kInt, bool kBool> 31570b57cec5SDimitry Andric * void foo() { ... } 31580b57cec5SDimitry Andric * 31590b57cec5SDimitry Andric * template <> 31600b57cec5SDimitry Andric * void foo<float, -7, true>(); 31610b57cec5SDimitry Andric * 31620b57cec5SDimitry Andric * If called with I = 0, "float", will be returned. 31630b57cec5SDimitry Andric * Invalid types will be returned for I == 1 or 2. 31640b57cec5SDimitry Andric */ 31650b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_Cursor_getTemplateArgumentType(CXCursor C, 31660b57cec5SDimitry Andric unsigned I); 31670b57cec5SDimitry Andric 31680b57cec5SDimitry Andric /** 31690b57cec5SDimitry Andric * Retrieve the value of an Integral TemplateArgument (of a function 31700b57cec5SDimitry Andric * decl representing a template specialization) as a signed long long. 31710b57cec5SDimitry Andric * 31720b57cec5SDimitry Andric * It is undefined to call this function on a CXCursor that does not represent a 3173bdd1243dSDimitry Andric * FunctionDecl, StructDecl, ClassDecl or ClassTemplatePartialSpecialization 3174bdd1243dSDimitry Andric * whose I'th template argument is not an integral value. 31750b57cec5SDimitry Andric * 31760b57cec5SDimitry Andric * For example, for the following declaration and specialization: 31770b57cec5SDimitry Andric * template <typename T, int kInt, bool kBool> 31780b57cec5SDimitry Andric * void foo() { ... } 31790b57cec5SDimitry Andric * 31800b57cec5SDimitry Andric * template <> 31810b57cec5SDimitry Andric * void foo<float, -7, true>(); 31820b57cec5SDimitry Andric * 31830b57cec5SDimitry Andric * If called with I = 1 or 2, -7 or true will be returned, respectively. 31840b57cec5SDimitry Andric * For I == 0, this function's behavior is undefined. 31850b57cec5SDimitry Andric */ 31860b57cec5SDimitry Andric CINDEX_LINKAGE long long clang_Cursor_getTemplateArgumentValue(CXCursor C, 31870b57cec5SDimitry Andric unsigned I); 31880b57cec5SDimitry Andric 31890b57cec5SDimitry Andric /** 31900b57cec5SDimitry Andric * Retrieve the value of an Integral TemplateArgument (of a function 31910b57cec5SDimitry Andric * decl representing a template specialization) as an unsigned long long. 31920b57cec5SDimitry Andric * 31930b57cec5SDimitry Andric * It is undefined to call this function on a CXCursor that does not represent a 3194bdd1243dSDimitry Andric * FunctionDecl, StructDecl, ClassDecl or ClassTemplatePartialSpecialization or 3195bdd1243dSDimitry Andric * whose I'th template argument is not an integral value. 31960b57cec5SDimitry Andric * 31970b57cec5SDimitry Andric * For example, for the following declaration and specialization: 31980b57cec5SDimitry Andric * template <typename T, int kInt, bool kBool> 31990b57cec5SDimitry Andric * void foo() { ... } 32000b57cec5SDimitry Andric * 32010b57cec5SDimitry Andric * template <> 32020b57cec5SDimitry Andric * void foo<float, 2147483649, true>(); 32030b57cec5SDimitry Andric * 32040b57cec5SDimitry Andric * If called with I = 1 or 2, 2147483649 or true will be returned, respectively. 32050b57cec5SDimitry Andric * For I == 0, this function's behavior is undefined. 32060b57cec5SDimitry Andric */ 32075ffd83dbSDimitry Andric CINDEX_LINKAGE unsigned long long 32085ffd83dbSDimitry Andric clang_Cursor_getTemplateArgumentUnsignedValue(CXCursor C, unsigned I); 32090b57cec5SDimitry Andric 32100b57cec5SDimitry Andric /** 32110b57cec5SDimitry Andric * Determine whether two CXTypes represent the same type. 32120b57cec5SDimitry Andric * 32130b57cec5SDimitry Andric * \returns non-zero if the CXTypes represent the same type and 32140b57cec5SDimitry Andric * zero otherwise. 32150b57cec5SDimitry Andric */ 32160b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B); 32170b57cec5SDimitry Andric 32180b57cec5SDimitry Andric /** 32190b57cec5SDimitry Andric * Return the canonical type for a CXType. 32200b57cec5SDimitry Andric * 32210b57cec5SDimitry Andric * Clang's type system explicitly models typedefs and all the ways 32220b57cec5SDimitry Andric * a specific type can be represented. The canonical type is the underlying 32230b57cec5SDimitry Andric * type with all the "sugar" removed. For example, if 'T' is a typedef 32240b57cec5SDimitry Andric * for 'int', the canonical type for 'T' would be 'int'. 32250b57cec5SDimitry Andric */ 32260b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_getCanonicalType(CXType T); 32270b57cec5SDimitry Andric 32280b57cec5SDimitry Andric /** 32290b57cec5SDimitry Andric * Determine whether a CXType has the "const" qualifier set, 32300b57cec5SDimitry Andric * without looking through typedefs that may have added "const" at a 32310b57cec5SDimitry Andric * different level. 32320b57cec5SDimitry Andric */ 32330b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T); 32340b57cec5SDimitry Andric 32350b57cec5SDimitry Andric /** 32360b57cec5SDimitry Andric * Determine whether a CXCursor that is a macro, is 32370b57cec5SDimitry Andric * function like. 32380b57cec5SDimitry Andric */ 32390b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_isMacroFunctionLike(CXCursor C); 32400b57cec5SDimitry Andric 32410b57cec5SDimitry Andric /** 32420b57cec5SDimitry Andric * Determine whether a CXCursor that is a macro, is a 32430b57cec5SDimitry Andric * builtin one. 32440b57cec5SDimitry Andric */ 32450b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_isMacroBuiltin(CXCursor C); 32460b57cec5SDimitry Andric 32470b57cec5SDimitry Andric /** 32480b57cec5SDimitry Andric * Determine whether a CXCursor that is a function declaration, is an 32490b57cec5SDimitry Andric * inline declaration. 32500b57cec5SDimitry Andric */ 32510b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_isFunctionInlined(CXCursor C); 32520b57cec5SDimitry Andric 32530b57cec5SDimitry Andric /** 32540b57cec5SDimitry Andric * Determine whether a CXType has the "volatile" qualifier set, 32550b57cec5SDimitry Andric * without looking through typedefs that may have added "volatile" at 32560b57cec5SDimitry Andric * a different level. 32570b57cec5SDimitry Andric */ 32580b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T); 32590b57cec5SDimitry Andric 32600b57cec5SDimitry Andric /** 32610b57cec5SDimitry Andric * Determine whether a CXType has the "restrict" qualifier set, 32620b57cec5SDimitry Andric * without looking through typedefs that may have added "restrict" at a 32630b57cec5SDimitry Andric * different level. 32640b57cec5SDimitry Andric */ 32650b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T); 32660b57cec5SDimitry Andric 32670b57cec5SDimitry Andric /** 32680b57cec5SDimitry Andric * Returns the address space of the given type. 32690b57cec5SDimitry Andric */ 32700b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_getAddressSpace(CXType T); 32710b57cec5SDimitry Andric 32720b57cec5SDimitry Andric /** 32730b57cec5SDimitry Andric * Returns the typedef name of the given type. 32740b57cec5SDimitry Andric */ 32750b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getTypedefName(CXType CT); 32760b57cec5SDimitry Andric 32770b57cec5SDimitry Andric /** 32780b57cec5SDimitry Andric * For pointer types, returns the type of the pointee. 32790b57cec5SDimitry Andric */ 32800b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_getPointeeType(CXType T); 32810b57cec5SDimitry Andric 32820b57cec5SDimitry Andric /** 3283bdd1243dSDimitry Andric * Retrieve the unqualified variant of the given type, removing as 3284bdd1243dSDimitry Andric * little sugar as possible. 3285bdd1243dSDimitry Andric * 3286bdd1243dSDimitry Andric * For example, given the following series of typedefs: 3287bdd1243dSDimitry Andric * 3288bdd1243dSDimitry Andric * \code 3289bdd1243dSDimitry Andric * typedef int Integer; 3290bdd1243dSDimitry Andric * typedef const Integer CInteger; 3291bdd1243dSDimitry Andric * typedef CInteger DifferenceType; 3292bdd1243dSDimitry Andric * \endcode 3293bdd1243dSDimitry Andric * 3294bdd1243dSDimitry Andric * Executing \c clang_getUnqualifiedType() on a \c CXType that 3295bdd1243dSDimitry Andric * represents \c DifferenceType, will desugar to a type representing 3296bdd1243dSDimitry Andric * \c Integer, that has no qualifiers. 3297bdd1243dSDimitry Andric * 3298bdd1243dSDimitry Andric * And, executing \c clang_getUnqualifiedType() on the type of the 3299bdd1243dSDimitry Andric * first argument of the following function declaration: 3300bdd1243dSDimitry Andric * 3301bdd1243dSDimitry Andric * \code 3302bdd1243dSDimitry Andric * void foo(const int); 3303bdd1243dSDimitry Andric * \endcode 3304bdd1243dSDimitry Andric * 3305bdd1243dSDimitry Andric * Will return a type representing \c int, removing the \c const 3306bdd1243dSDimitry Andric * qualifier. 3307bdd1243dSDimitry Andric * 3308bdd1243dSDimitry Andric * Sugar over array types is not desugared. 3309bdd1243dSDimitry Andric * 3310bdd1243dSDimitry Andric * A type can be checked for qualifiers with \c 3311bdd1243dSDimitry Andric * clang_isConstQualifiedType(), \c clang_isVolatileQualifiedType() 3312bdd1243dSDimitry Andric * and \c clang_isRestrictQualifiedType(). 3313bdd1243dSDimitry Andric * 3314bdd1243dSDimitry Andric * A type that resulted from a call to \c clang_getUnqualifiedType 3315bdd1243dSDimitry Andric * will return \c false for all of the above calls. 3316bdd1243dSDimitry Andric */ 3317bdd1243dSDimitry Andric CINDEX_LINKAGE CXType clang_getUnqualifiedType(CXType CT); 3318bdd1243dSDimitry Andric 3319bdd1243dSDimitry Andric /** 3320bdd1243dSDimitry Andric * For reference types (e.g., "const int&"), returns the type that the 3321bdd1243dSDimitry Andric * reference refers to (e.g "const int"). 3322bdd1243dSDimitry Andric * 3323bdd1243dSDimitry Andric * Otherwise, returns the type itself. 3324bdd1243dSDimitry Andric * 3325bdd1243dSDimitry Andric * A type that has kind \c CXType_LValueReference or 3326bdd1243dSDimitry Andric * \c CXType_RValueReference is a reference type. 3327bdd1243dSDimitry Andric */ 3328bdd1243dSDimitry Andric CINDEX_LINKAGE CXType clang_getNonReferenceType(CXType CT); 3329bdd1243dSDimitry Andric 3330bdd1243dSDimitry Andric /** 33310b57cec5SDimitry Andric * Return the cursor for the declaration of the given type. 33320b57cec5SDimitry Andric */ 33330b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T); 33340b57cec5SDimitry Andric 33350b57cec5SDimitry Andric /** 33360b57cec5SDimitry Andric * Returns the Objective-C type encoding for the specified declaration. 33370b57cec5SDimitry Andric */ 33380b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C); 33390b57cec5SDimitry Andric 33400b57cec5SDimitry Andric /** 33410b57cec5SDimitry Andric * Returns the Objective-C type encoding for the specified CXType. 33420b57cec5SDimitry Andric */ 33430b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_Type_getObjCEncoding(CXType type); 33440b57cec5SDimitry Andric 33450b57cec5SDimitry Andric /** 33460b57cec5SDimitry Andric * Retrieve the spelling of a given CXTypeKind. 33470b57cec5SDimitry Andric */ 33480b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K); 33490b57cec5SDimitry Andric 33500b57cec5SDimitry Andric /** 33510b57cec5SDimitry Andric * Retrieve the calling convention associated with a function type. 33520b57cec5SDimitry Andric * 33530b57cec5SDimitry Andric * If a non-function type is passed in, CXCallingConv_Invalid is returned. 33540b57cec5SDimitry Andric */ 33550b57cec5SDimitry Andric CINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T); 33560b57cec5SDimitry Andric 33570b57cec5SDimitry Andric /** 33580b57cec5SDimitry Andric * Retrieve the return type associated with a function type. 33590b57cec5SDimitry Andric * 33600b57cec5SDimitry Andric * If a non-function type is passed in, an invalid type is returned. 33610b57cec5SDimitry Andric */ 33620b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_getResultType(CXType T); 33630b57cec5SDimitry Andric 33640b57cec5SDimitry Andric /** 33650b57cec5SDimitry Andric * Retrieve the exception specification type associated with a function type. 33660b57cec5SDimitry Andric * This is a value of type CXCursor_ExceptionSpecificationKind. 33670b57cec5SDimitry Andric * 33680b57cec5SDimitry Andric * If a non-function type is passed in, an error code of -1 is returned. 33690b57cec5SDimitry Andric */ 33700b57cec5SDimitry Andric CINDEX_LINKAGE int clang_getExceptionSpecificationType(CXType T); 33710b57cec5SDimitry Andric 33720b57cec5SDimitry Andric /** 33730b57cec5SDimitry Andric * Retrieve the number of non-variadic parameters associated with a 33740b57cec5SDimitry Andric * function type. 33750b57cec5SDimitry Andric * 33760b57cec5SDimitry Andric * If a non-function type is passed in, -1 is returned. 33770b57cec5SDimitry Andric */ 33780b57cec5SDimitry Andric CINDEX_LINKAGE int clang_getNumArgTypes(CXType T); 33790b57cec5SDimitry Andric 33800b57cec5SDimitry Andric /** 33810b57cec5SDimitry Andric * Retrieve the type of a parameter of a function type. 33820b57cec5SDimitry Andric * 33830b57cec5SDimitry Andric * If a non-function type is passed in or the function does not have enough 33840b57cec5SDimitry Andric * parameters, an invalid type is returned. 33850b57cec5SDimitry Andric */ 33860b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i); 33870b57cec5SDimitry Andric 33880b57cec5SDimitry Andric /** 33890b57cec5SDimitry Andric * Retrieves the base type of the ObjCObjectType. 33900b57cec5SDimitry Andric * 33910b57cec5SDimitry Andric * If the type is not an ObjC object, an invalid type is returned. 33920b57cec5SDimitry Andric */ 33930b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_Type_getObjCObjectBaseType(CXType T); 33940b57cec5SDimitry Andric 33950b57cec5SDimitry Andric /** 33960b57cec5SDimitry Andric * Retrieve the number of protocol references associated with an ObjC object/id. 33970b57cec5SDimitry Andric * 33980b57cec5SDimitry Andric * If the type is not an ObjC object, 0 is returned. 33990b57cec5SDimitry Andric */ 34000b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Type_getNumObjCProtocolRefs(CXType T); 34010b57cec5SDimitry Andric 34020b57cec5SDimitry Andric /** 34030b57cec5SDimitry Andric * Retrieve the decl for a protocol reference for an ObjC object/id. 34040b57cec5SDimitry Andric * 34050b57cec5SDimitry Andric * If the type is not an ObjC object or there are not enough protocol 34060b57cec5SDimitry Andric * references, an invalid cursor is returned. 34070b57cec5SDimitry Andric */ 34080b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_Type_getObjCProtocolDecl(CXType T, unsigned i); 34090b57cec5SDimitry Andric 34100b57cec5SDimitry Andric /** 34115ffd83dbSDimitry Andric * Retrieve the number of type arguments associated with an ObjC object. 34120b57cec5SDimitry Andric * 34130b57cec5SDimitry Andric * If the type is not an ObjC object, 0 is returned. 34140b57cec5SDimitry Andric */ 34150b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Type_getNumObjCTypeArgs(CXType T); 34160b57cec5SDimitry Andric 34170b57cec5SDimitry Andric /** 34180b57cec5SDimitry Andric * Retrieve a type argument associated with an ObjC object. 34190b57cec5SDimitry Andric * 34200b57cec5SDimitry Andric * If the type is not an ObjC or the index is not valid, 34210b57cec5SDimitry Andric * an invalid type is returned. 34220b57cec5SDimitry Andric */ 34230b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_Type_getObjCTypeArg(CXType T, unsigned i); 34240b57cec5SDimitry Andric 34250b57cec5SDimitry Andric /** 34260b57cec5SDimitry Andric * Return 1 if the CXType is a variadic function type, and 0 otherwise. 34270b57cec5SDimitry Andric */ 34280b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T); 34290b57cec5SDimitry Andric 34300b57cec5SDimitry Andric /** 34310b57cec5SDimitry Andric * Retrieve the return type associated with a given cursor. 34320b57cec5SDimitry Andric * 34330b57cec5SDimitry Andric * This only returns a valid type if the cursor refers to a function or method. 34340b57cec5SDimitry Andric */ 34350b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C); 34360b57cec5SDimitry Andric 34370b57cec5SDimitry Andric /** 34380b57cec5SDimitry Andric * Retrieve the exception specification type associated with a given cursor. 34390b57cec5SDimitry Andric * This is a value of type CXCursor_ExceptionSpecificationKind. 34400b57cec5SDimitry Andric * 34415ffd83dbSDimitry Andric * This only returns a valid result if the cursor refers to a function or 34425ffd83dbSDimitry Andric * method. 34430b57cec5SDimitry Andric */ 34440b57cec5SDimitry Andric CINDEX_LINKAGE int clang_getCursorExceptionSpecificationType(CXCursor C); 34450b57cec5SDimitry Andric 34460b57cec5SDimitry Andric /** 34470b57cec5SDimitry Andric * Return 1 if the CXType is a POD (plain old data) type, and 0 34480b57cec5SDimitry Andric * otherwise. 34490b57cec5SDimitry Andric */ 34500b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isPODType(CXType T); 34510b57cec5SDimitry Andric 34520b57cec5SDimitry Andric /** 34530b57cec5SDimitry Andric * Return the element type of an array, complex, or vector type. 34540b57cec5SDimitry Andric * 34550b57cec5SDimitry Andric * If a type is passed in that is not an array, complex, or vector type, 34560b57cec5SDimitry Andric * an invalid type is returned. 34570b57cec5SDimitry Andric */ 34580b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_getElementType(CXType T); 34590b57cec5SDimitry Andric 34600b57cec5SDimitry Andric /** 34610b57cec5SDimitry Andric * Return the number of elements of an array or vector type. 34620b57cec5SDimitry Andric * 34630b57cec5SDimitry Andric * If a type is passed in that is not an array or vector type, 34640b57cec5SDimitry Andric * -1 is returned. 34650b57cec5SDimitry Andric */ 34660b57cec5SDimitry Andric CINDEX_LINKAGE long long clang_getNumElements(CXType T); 34670b57cec5SDimitry Andric 34680b57cec5SDimitry Andric /** 34690b57cec5SDimitry Andric * Return the element type of an array type. 34700b57cec5SDimitry Andric * 34710b57cec5SDimitry Andric * If a non-array type is passed in, an invalid type is returned. 34720b57cec5SDimitry Andric */ 34730b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_getArrayElementType(CXType T); 34740b57cec5SDimitry Andric 34750b57cec5SDimitry Andric /** 34760b57cec5SDimitry Andric * Return the array size of a constant array. 34770b57cec5SDimitry Andric * 34780b57cec5SDimitry Andric * If a non-array type is passed in, -1 is returned. 34790b57cec5SDimitry Andric */ 34800b57cec5SDimitry Andric CINDEX_LINKAGE long long clang_getArraySize(CXType T); 34810b57cec5SDimitry Andric 34820b57cec5SDimitry Andric /** 34830b57cec5SDimitry Andric * Retrieve the type named by the qualified-id. 34840b57cec5SDimitry Andric * 34850b57cec5SDimitry Andric * If a non-elaborated type is passed in, an invalid type is returned. 34860b57cec5SDimitry Andric */ 34870b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_Type_getNamedType(CXType T); 34880b57cec5SDimitry Andric 34890b57cec5SDimitry Andric /** 34900b57cec5SDimitry Andric * Determine if a typedef is 'transparent' tag. 34910b57cec5SDimitry Andric * 34920b57cec5SDimitry Andric * A typedef is considered 'transparent' if it shares a name and spelling 34930b57cec5SDimitry Andric * location with its underlying tag type, as is the case with the NS_ENUM macro. 34940b57cec5SDimitry Andric * 34950b57cec5SDimitry Andric * \returns non-zero if transparent and zero otherwise. 34960b57cec5SDimitry Andric */ 34970b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Type_isTransparentTagTypedef(CXType T); 34980b57cec5SDimitry Andric 34990b57cec5SDimitry Andric enum CXTypeNullabilityKind { 35000b57cec5SDimitry Andric /** 35010b57cec5SDimitry Andric * Values of this type can never be null. 35020b57cec5SDimitry Andric */ 35030b57cec5SDimitry Andric CXTypeNullability_NonNull = 0, 35040b57cec5SDimitry Andric /** 35050b57cec5SDimitry Andric * Values of this type can be null. 35060b57cec5SDimitry Andric */ 35070b57cec5SDimitry Andric CXTypeNullability_Nullable = 1, 35080b57cec5SDimitry Andric /** 35090b57cec5SDimitry Andric * Whether values of this type can be null is (explicitly) 35100b57cec5SDimitry Andric * unspecified. This captures a (fairly rare) case where we 35110b57cec5SDimitry Andric * can't conclude anything about the nullability of the type even 35120b57cec5SDimitry Andric * though it has been considered. 35130b57cec5SDimitry Andric */ 35140b57cec5SDimitry Andric CXTypeNullability_Unspecified = 2, 35150b57cec5SDimitry Andric /** 35160b57cec5SDimitry Andric * Nullability is not applicable to this type. 35170b57cec5SDimitry Andric */ 3518e8d8bef9SDimitry Andric CXTypeNullability_Invalid = 3, 3519e8d8bef9SDimitry Andric 3520e8d8bef9SDimitry Andric /** 3521e8d8bef9SDimitry Andric * Generally behaves like Nullable, except when used in a block parameter that 3522e8d8bef9SDimitry Andric * was imported into a swift async method. There, swift will assume that the 352381ad6265SDimitry Andric * parameter can get null even if no error occurred. _Nullable parameters are 3524e8d8bef9SDimitry Andric * assumed to only get null on error. 3525e8d8bef9SDimitry Andric */ 3526e8d8bef9SDimitry Andric CXTypeNullability_NullableResult = 4 35270b57cec5SDimitry Andric }; 35280b57cec5SDimitry Andric 35290b57cec5SDimitry Andric /** 35300b57cec5SDimitry Andric * Retrieve the nullability kind of a pointer type. 35310b57cec5SDimitry Andric */ 35320b57cec5SDimitry Andric CINDEX_LINKAGE enum CXTypeNullabilityKind clang_Type_getNullability(CXType T); 35330b57cec5SDimitry Andric 35340b57cec5SDimitry Andric /** 35350b57cec5SDimitry Andric * List the possible error codes for \c clang_Type_getSizeOf, 35360b57cec5SDimitry Andric * \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and 35370b57cec5SDimitry Andric * \c clang_Cursor_getOffsetOf. 35380b57cec5SDimitry Andric * 35390b57cec5SDimitry Andric * A value of this enumeration type can be returned if the target type is not 35400b57cec5SDimitry Andric * a valid argument to sizeof, alignof or offsetof. 35410b57cec5SDimitry Andric */ 35420b57cec5SDimitry Andric enum CXTypeLayoutError { 35430b57cec5SDimitry Andric /** 35440b57cec5SDimitry Andric * Type is of kind CXType_Invalid. 35450b57cec5SDimitry Andric */ 35460b57cec5SDimitry Andric CXTypeLayoutError_Invalid = -1, 35470b57cec5SDimitry Andric /** 35480b57cec5SDimitry Andric * The type is an incomplete Type. 35490b57cec5SDimitry Andric */ 35500b57cec5SDimitry Andric CXTypeLayoutError_Incomplete = -2, 35510b57cec5SDimitry Andric /** 35520b57cec5SDimitry Andric * The type is a dependent Type. 35530b57cec5SDimitry Andric */ 35540b57cec5SDimitry Andric CXTypeLayoutError_Dependent = -3, 35550b57cec5SDimitry Andric /** 35560b57cec5SDimitry Andric * The type is not a constant size type. 35570b57cec5SDimitry Andric */ 35580b57cec5SDimitry Andric CXTypeLayoutError_NotConstantSize = -4, 35590b57cec5SDimitry Andric /** 35600b57cec5SDimitry Andric * The Field name is not valid for this record. 35610b57cec5SDimitry Andric */ 35620b57cec5SDimitry Andric CXTypeLayoutError_InvalidFieldName = -5, 35630b57cec5SDimitry Andric /** 35640b57cec5SDimitry Andric * The type is undeduced. 35650b57cec5SDimitry Andric */ 35660b57cec5SDimitry Andric CXTypeLayoutError_Undeduced = -6 35670b57cec5SDimitry Andric }; 35680b57cec5SDimitry Andric 35690b57cec5SDimitry Andric /** 35700b57cec5SDimitry Andric * Return the alignment of a type in bytes as per C++[expr.alignof] 35710b57cec5SDimitry Andric * standard. 35720b57cec5SDimitry Andric * 35730b57cec5SDimitry Andric * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. 35740b57cec5SDimitry Andric * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete 35750b57cec5SDimitry Andric * is returned. 35760b57cec5SDimitry Andric * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is 35770b57cec5SDimitry Andric * returned. 35780b57cec5SDimitry Andric * If the type declaration is not a constant size type, 35790b57cec5SDimitry Andric * CXTypeLayoutError_NotConstantSize is returned. 35800b57cec5SDimitry Andric */ 35810b57cec5SDimitry Andric CINDEX_LINKAGE long long clang_Type_getAlignOf(CXType T); 35820b57cec5SDimitry Andric 35830b57cec5SDimitry Andric /** 35840b57cec5SDimitry Andric * Return the class type of an member pointer type. 35850b57cec5SDimitry Andric * 35860b57cec5SDimitry Andric * If a non-member-pointer type is passed in, an invalid type is returned. 35870b57cec5SDimitry Andric */ 35880b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_Type_getClassType(CXType T); 35890b57cec5SDimitry Andric 35900b57cec5SDimitry Andric /** 35910b57cec5SDimitry Andric * Return the size of a type in bytes as per C++[expr.sizeof] standard. 35920b57cec5SDimitry Andric * 35930b57cec5SDimitry Andric * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. 35940b57cec5SDimitry Andric * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete 35950b57cec5SDimitry Andric * is returned. 35960b57cec5SDimitry Andric * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is 35970b57cec5SDimitry Andric * returned. 35980b57cec5SDimitry Andric */ 35990b57cec5SDimitry Andric CINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T); 36000b57cec5SDimitry Andric 36010b57cec5SDimitry Andric /** 36020b57cec5SDimitry Andric * Return the offset of a field named S in a record of type T in bits 36030b57cec5SDimitry Andric * as it would be returned by __offsetof__ as per C++11[18.2p4] 36040b57cec5SDimitry Andric * 36050b57cec5SDimitry Andric * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid 36060b57cec5SDimitry Andric * is returned. 36070b57cec5SDimitry Andric * If the field's type declaration is an incomplete type, 36080b57cec5SDimitry Andric * CXTypeLayoutError_Incomplete is returned. 36090b57cec5SDimitry Andric * If the field's type declaration is a dependent type, 36100b57cec5SDimitry Andric * CXTypeLayoutError_Dependent is returned. 36110b57cec5SDimitry Andric * If the field's name S is not found, 36120b57cec5SDimitry Andric * CXTypeLayoutError_InvalidFieldName is returned. 36130b57cec5SDimitry Andric */ 36140b57cec5SDimitry Andric CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S); 36150b57cec5SDimitry Andric 36160b57cec5SDimitry Andric /** 36170b57cec5SDimitry Andric * Return the type that was modified by this attributed type. 36180b57cec5SDimitry Andric * 36190b57cec5SDimitry Andric * If the type is not an attributed type, an invalid type is returned. 36200b57cec5SDimitry Andric */ 36210b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_Type_getModifiedType(CXType T); 36220b57cec5SDimitry Andric 36230b57cec5SDimitry Andric /** 36245ffd83dbSDimitry Andric * Gets the type contained by this atomic type. 36255ffd83dbSDimitry Andric * 36265ffd83dbSDimitry Andric * If a non-atomic type is passed in, an invalid type is returned. 36275ffd83dbSDimitry Andric */ 36285ffd83dbSDimitry Andric CINDEX_LINKAGE CXType clang_Type_getValueType(CXType CT); 36295ffd83dbSDimitry Andric 36305ffd83dbSDimitry Andric /** 36310b57cec5SDimitry Andric * Return the offset of the field represented by the Cursor. 36320b57cec5SDimitry Andric * 36330b57cec5SDimitry Andric * If the cursor is not a field declaration, -1 is returned. 36340b57cec5SDimitry Andric * If the cursor semantic parent is not a record field declaration, 36350b57cec5SDimitry Andric * CXTypeLayoutError_Invalid is returned. 36360b57cec5SDimitry Andric * If the field's type declaration is an incomplete type, 36370b57cec5SDimitry Andric * CXTypeLayoutError_Incomplete is returned. 36380b57cec5SDimitry Andric * If the field's type declaration is a dependent type, 36390b57cec5SDimitry Andric * CXTypeLayoutError_Dependent is returned. 36400b57cec5SDimitry Andric * If the field's name S is not found, 36410b57cec5SDimitry Andric * CXTypeLayoutError_InvalidFieldName is returned. 36420b57cec5SDimitry Andric */ 36430b57cec5SDimitry Andric CINDEX_LINKAGE long long clang_Cursor_getOffsetOfField(CXCursor C); 36440b57cec5SDimitry Andric 36450b57cec5SDimitry Andric /** 36460b57cec5SDimitry Andric * Determine whether the given cursor represents an anonymous 36470b57cec5SDimitry Andric * tag or namespace 36480b57cec5SDimitry Andric */ 36490b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_isAnonymous(CXCursor C); 36500b57cec5SDimitry Andric 36510b57cec5SDimitry Andric /** 36520b57cec5SDimitry Andric * Determine whether the given cursor represents an anonymous record 36530b57cec5SDimitry Andric * declaration. 36540b57cec5SDimitry Andric */ 36550b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_isAnonymousRecordDecl(CXCursor C); 36560b57cec5SDimitry Andric 36570b57cec5SDimitry Andric /** 36580b57cec5SDimitry Andric * Determine whether the given cursor represents an inline namespace 36590b57cec5SDimitry Andric * declaration. 36600b57cec5SDimitry Andric */ 36610b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_isInlineNamespace(CXCursor C); 36620b57cec5SDimitry Andric 36630b57cec5SDimitry Andric enum CXRefQualifierKind { 36640b57cec5SDimitry Andric /** No ref-qualifier was provided. */ 36650b57cec5SDimitry Andric CXRefQualifier_None = 0, 36660b57cec5SDimitry Andric /** An lvalue ref-qualifier was provided (\c &). */ 36670b57cec5SDimitry Andric CXRefQualifier_LValue, 36680b57cec5SDimitry Andric /** An rvalue ref-qualifier was provided (\c &&). */ 36690b57cec5SDimitry Andric CXRefQualifier_RValue 36700b57cec5SDimitry Andric }; 36710b57cec5SDimitry Andric 36720b57cec5SDimitry Andric /** 36730b57cec5SDimitry Andric * Returns the number of template arguments for given template 36740b57cec5SDimitry Andric * specialization, or -1 if type \c T is not a template specialization. 36750b57cec5SDimitry Andric */ 36760b57cec5SDimitry Andric CINDEX_LINKAGE int clang_Type_getNumTemplateArguments(CXType T); 36770b57cec5SDimitry Andric 36780b57cec5SDimitry Andric /** 36790b57cec5SDimitry Andric * Returns the type template argument of a template class specialization 36800b57cec5SDimitry Andric * at given index. 36810b57cec5SDimitry Andric * 36820b57cec5SDimitry Andric * This function only returns template type arguments and does not handle 36830b57cec5SDimitry Andric * template template arguments or variadic packs. 36840b57cec5SDimitry Andric */ 36855ffd83dbSDimitry Andric CINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T, 36865ffd83dbSDimitry Andric unsigned i); 36870b57cec5SDimitry Andric 36880b57cec5SDimitry Andric /** 36890b57cec5SDimitry Andric * Retrieve the ref-qualifier kind of a function or method. 36900b57cec5SDimitry Andric * 36910b57cec5SDimitry Andric * The ref-qualifier is returned for C++ functions or methods. For other types 36920b57cec5SDimitry Andric * or non-C++ declarations, CXRefQualifier_None is returned. 36930b57cec5SDimitry Andric */ 36940b57cec5SDimitry Andric CINDEX_LINKAGE enum CXRefQualifierKind clang_Type_getCXXRefQualifier(CXType T); 36950b57cec5SDimitry Andric 36960b57cec5SDimitry Andric /** 36970b57cec5SDimitry Andric * Returns 1 if the base class specified by the cursor with kind 36980b57cec5SDimitry Andric * CX_CXXBaseSpecifier is virtual. 36990b57cec5SDimitry Andric */ 37000b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor); 37010b57cec5SDimitry Andric 37020b57cec5SDimitry Andric /** 37030b57cec5SDimitry Andric * Represents the C++ access control level to a base class for a 37040b57cec5SDimitry Andric * cursor with kind CX_CXXBaseSpecifier. 37050b57cec5SDimitry Andric */ 37060b57cec5SDimitry Andric enum CX_CXXAccessSpecifier { 37070b57cec5SDimitry Andric CX_CXXInvalidAccessSpecifier, 37080b57cec5SDimitry Andric CX_CXXPublic, 37090b57cec5SDimitry Andric CX_CXXProtected, 37100b57cec5SDimitry Andric CX_CXXPrivate 37110b57cec5SDimitry Andric }; 37120b57cec5SDimitry Andric 37130b57cec5SDimitry Andric /** 37140b57cec5SDimitry Andric * Returns the access control level for the referenced object. 37150b57cec5SDimitry Andric * 37165ffd83dbSDimitry Andric * If the cursor refers to a C++ declaration, its access control level within 37175ffd83dbSDimitry Andric * its parent scope is returned. Otherwise, if the cursor refers to a base 37185ffd83dbSDimitry Andric * specifier or access specifier, the specifier itself is returned. 37190b57cec5SDimitry Andric */ 37200b57cec5SDimitry Andric CINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor); 37210b57cec5SDimitry Andric 37220b57cec5SDimitry Andric /** 37230b57cec5SDimitry Andric * Represents the storage classes as declared in the source. CX_SC_Invalid 37240b57cec5SDimitry Andric * was added for the case that the passed cursor in not a declaration. 37250b57cec5SDimitry Andric */ 37260b57cec5SDimitry Andric enum CX_StorageClass { 37270b57cec5SDimitry Andric CX_SC_Invalid, 37280b57cec5SDimitry Andric CX_SC_None, 37290b57cec5SDimitry Andric CX_SC_Extern, 37300b57cec5SDimitry Andric CX_SC_Static, 37310b57cec5SDimitry Andric CX_SC_PrivateExtern, 37320b57cec5SDimitry Andric CX_SC_OpenCLWorkGroupLocal, 37330b57cec5SDimitry Andric CX_SC_Auto, 37340b57cec5SDimitry Andric CX_SC_Register 37350b57cec5SDimitry Andric }; 37360b57cec5SDimitry Andric 37370b57cec5SDimitry Andric /** 37380b57cec5SDimitry Andric * Returns the storage class for a function or variable declaration. 37390b57cec5SDimitry Andric * 37400b57cec5SDimitry Andric * If the passed in Cursor is not a function or variable declaration, 37410b57cec5SDimitry Andric * CX_SC_Invalid is returned else the storage class. 37420b57cec5SDimitry Andric */ 37430b57cec5SDimitry Andric CINDEX_LINKAGE enum CX_StorageClass clang_Cursor_getStorageClass(CXCursor); 37440b57cec5SDimitry Andric 37450b57cec5SDimitry Andric /** 37460b57cec5SDimitry Andric * Determine the number of overloaded declarations referenced by a 37470b57cec5SDimitry Andric * \c CXCursor_OverloadedDeclRef cursor. 37480b57cec5SDimitry Andric * 37490b57cec5SDimitry Andric * \param cursor The cursor whose overloaded declarations are being queried. 37500b57cec5SDimitry Andric * 37510b57cec5SDimitry Andric * \returns The number of overloaded declarations referenced by \c cursor. If it 37520b57cec5SDimitry Andric * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0. 37530b57cec5SDimitry Andric */ 37540b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor); 37550b57cec5SDimitry Andric 37560b57cec5SDimitry Andric /** 37570b57cec5SDimitry Andric * Retrieve a cursor for one of the overloaded declarations referenced 37580b57cec5SDimitry Andric * by a \c CXCursor_OverloadedDeclRef cursor. 37590b57cec5SDimitry Andric * 37600b57cec5SDimitry Andric * \param cursor The cursor whose overloaded declarations are being queried. 37610b57cec5SDimitry Andric * 37620b57cec5SDimitry Andric * \param index The zero-based index into the set of overloaded declarations in 37630b57cec5SDimitry Andric * the cursor. 37640b57cec5SDimitry Andric * 37650b57cec5SDimitry Andric * \returns A cursor representing the declaration referenced by the given 37660b57cec5SDimitry Andric * \c cursor at the specified \c index. If the cursor does not have an 37670b57cec5SDimitry Andric * associated set of overloaded declarations, or if the index is out of bounds, 37680b57cec5SDimitry Andric * returns \c clang_getNullCursor(); 37690b57cec5SDimitry Andric */ 37700b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor, 37710b57cec5SDimitry Andric unsigned index); 37720b57cec5SDimitry Andric 37730b57cec5SDimitry Andric /** 37740b57cec5SDimitry Andric * @} 37750b57cec5SDimitry Andric */ 37760b57cec5SDimitry Andric 37770b57cec5SDimitry Andric /** 37780b57cec5SDimitry Andric * \defgroup CINDEX_ATTRIBUTES Information for attributes 37790b57cec5SDimitry Andric * 37800b57cec5SDimitry Andric * @{ 37810b57cec5SDimitry Andric */ 37820b57cec5SDimitry Andric 37830b57cec5SDimitry Andric /** 37840b57cec5SDimitry Andric * For cursors representing an iboutletcollection attribute, 37850b57cec5SDimitry Andric * this function returns the collection element type. 37860b57cec5SDimitry Andric * 37870b57cec5SDimitry Andric */ 37880b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor); 37890b57cec5SDimitry Andric 37900b57cec5SDimitry Andric /** 37910b57cec5SDimitry Andric * @} 37920b57cec5SDimitry Andric */ 37930b57cec5SDimitry Andric 37940b57cec5SDimitry Andric /** 37950b57cec5SDimitry Andric * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors 37960b57cec5SDimitry Andric * 37970b57cec5SDimitry Andric * These routines provide the ability to traverse the abstract syntax tree 37980b57cec5SDimitry Andric * using cursors. 37990b57cec5SDimitry Andric * 38000b57cec5SDimitry Andric * @{ 38010b57cec5SDimitry Andric */ 38020b57cec5SDimitry Andric 38030b57cec5SDimitry Andric /** 38040b57cec5SDimitry Andric * Describes how the traversal of the children of a particular 38050b57cec5SDimitry Andric * cursor should proceed after visiting a particular child cursor. 38060b57cec5SDimitry Andric * 38070b57cec5SDimitry Andric * A value of this enumeration type should be returned by each 38080b57cec5SDimitry Andric * \c CXCursorVisitor to indicate how clang_visitChildren() proceed. 38090b57cec5SDimitry Andric */ 38100b57cec5SDimitry Andric enum CXChildVisitResult { 38110b57cec5SDimitry Andric /** 38120b57cec5SDimitry Andric * Terminates the cursor traversal. 38130b57cec5SDimitry Andric */ 38140b57cec5SDimitry Andric CXChildVisit_Break, 38150b57cec5SDimitry Andric /** 38160b57cec5SDimitry Andric * Continues the cursor traversal with the next sibling of 38170b57cec5SDimitry Andric * the cursor just visited, without visiting its children. 38180b57cec5SDimitry Andric */ 38190b57cec5SDimitry Andric CXChildVisit_Continue, 38200b57cec5SDimitry Andric /** 38210b57cec5SDimitry Andric * Recursively traverse the children of this cursor, using 38220b57cec5SDimitry Andric * the same visitor and client data. 38230b57cec5SDimitry Andric */ 38240b57cec5SDimitry Andric CXChildVisit_Recurse 38250b57cec5SDimitry Andric }; 38260b57cec5SDimitry Andric 38270b57cec5SDimitry Andric /** 38280b57cec5SDimitry Andric * Visitor invoked for each cursor found by a traversal. 38290b57cec5SDimitry Andric * 38300b57cec5SDimitry Andric * This visitor function will be invoked for each cursor found by 38310b57cec5SDimitry Andric * clang_visitCursorChildren(). Its first argument is the cursor being 38320b57cec5SDimitry Andric * visited, its second argument is the parent visitor for that cursor, 38330b57cec5SDimitry Andric * and its third argument is the client data provided to 38340b57cec5SDimitry Andric * clang_visitCursorChildren(). 38350b57cec5SDimitry Andric * 38360b57cec5SDimitry Andric * The visitor should return one of the \c CXChildVisitResult values 38370b57cec5SDimitry Andric * to direct clang_visitCursorChildren(). 38380b57cec5SDimitry Andric */ 38390b57cec5SDimitry Andric typedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor, 38400b57cec5SDimitry Andric CXCursor parent, 38410b57cec5SDimitry Andric CXClientData client_data); 38420b57cec5SDimitry Andric 38430b57cec5SDimitry Andric /** 38440b57cec5SDimitry Andric * Visit the children of a particular cursor. 38450b57cec5SDimitry Andric * 38460b57cec5SDimitry Andric * This function visits all the direct children of the given cursor, 38470b57cec5SDimitry Andric * invoking the given \p visitor function with the cursors of each 38480b57cec5SDimitry Andric * visited child. The traversal may be recursive, if the visitor returns 38490b57cec5SDimitry Andric * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if 38500b57cec5SDimitry Andric * the visitor returns \c CXChildVisit_Break. 38510b57cec5SDimitry Andric * 38520b57cec5SDimitry Andric * \param parent the cursor whose child may be visited. All kinds of 38530b57cec5SDimitry Andric * cursors can be visited, including invalid cursors (which, by 38540b57cec5SDimitry Andric * definition, have no children). 38550b57cec5SDimitry Andric * 38560b57cec5SDimitry Andric * \param visitor the visitor function that will be invoked for each 38570b57cec5SDimitry Andric * child of \p parent. 38580b57cec5SDimitry Andric * 38590b57cec5SDimitry Andric * \param client_data pointer data supplied by the client, which will 38600b57cec5SDimitry Andric * be passed to the visitor each time it is invoked. 38610b57cec5SDimitry Andric * 38620b57cec5SDimitry Andric * \returns a non-zero value if the traversal was terminated 38630b57cec5SDimitry Andric * prematurely by the visitor returning \c CXChildVisit_Break. 38640b57cec5SDimitry Andric */ 38650b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent, 38660b57cec5SDimitry Andric CXCursorVisitor visitor, 38670b57cec5SDimitry Andric CXClientData client_data); 38680b57cec5SDimitry Andric /** 38690b57cec5SDimitry Andric * Visitor invoked for each cursor found by a traversal. 38700b57cec5SDimitry Andric * 38710b57cec5SDimitry Andric * This visitor block will be invoked for each cursor found by 38720b57cec5SDimitry Andric * clang_visitChildrenWithBlock(). Its first argument is the cursor being 38730b57cec5SDimitry Andric * visited, its second argument is the parent visitor for that cursor. 38740b57cec5SDimitry Andric * 38750b57cec5SDimitry Andric * The visitor should return one of the \c CXChildVisitResult values 38760b57cec5SDimitry Andric * to direct clang_visitChildrenWithBlock(). 38770b57cec5SDimitry Andric */ 387806c3fb27SDimitry Andric #if __has_feature(blocks) 38795ffd83dbSDimitry Andric typedef enum CXChildVisitResult (^CXCursorVisitorBlock)(CXCursor cursor, 38805ffd83dbSDimitry Andric CXCursor parent); 388106c3fb27SDimitry Andric #else 388206c3fb27SDimitry Andric typedef struct _CXChildVisitResult *CXCursorVisitorBlock; 388306c3fb27SDimitry Andric #endif 38840b57cec5SDimitry Andric 38850b57cec5SDimitry Andric /** 38860b57cec5SDimitry Andric * Visits the children of a cursor using the specified block. Behaves 38870b57cec5SDimitry Andric * identically to clang_visitChildren() in all other respects. 38880b57cec5SDimitry Andric */ 38895ffd83dbSDimitry Andric CINDEX_LINKAGE unsigned 38905ffd83dbSDimitry Andric clang_visitChildrenWithBlock(CXCursor parent, CXCursorVisitorBlock block); 38910b57cec5SDimitry Andric 38920b57cec5SDimitry Andric /** 38930b57cec5SDimitry Andric * @} 38940b57cec5SDimitry Andric */ 38950b57cec5SDimitry Andric 38960b57cec5SDimitry Andric /** 38970b57cec5SDimitry Andric * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST 38980b57cec5SDimitry Andric * 38990b57cec5SDimitry Andric * These routines provide the ability to determine references within and 39000b57cec5SDimitry Andric * across translation units, by providing the names of the entities referenced 39010b57cec5SDimitry Andric * by cursors, follow reference cursors to the declarations they reference, 39020b57cec5SDimitry Andric * and associate declarations with their definitions. 39030b57cec5SDimitry Andric * 39040b57cec5SDimitry Andric * @{ 39050b57cec5SDimitry Andric */ 39060b57cec5SDimitry Andric 39070b57cec5SDimitry Andric /** 39080b57cec5SDimitry Andric * Retrieve a Unified Symbol Resolution (USR) for the entity referenced 39090b57cec5SDimitry Andric * by the given cursor. 39100b57cec5SDimitry Andric * 39110b57cec5SDimitry Andric * A Unified Symbol Resolution (USR) is a string that identifies a particular 39120b57cec5SDimitry Andric * entity (function, class, variable, etc.) within a program. USRs can be 39130b57cec5SDimitry Andric * compared across translation units to determine, e.g., when references in 39140b57cec5SDimitry Andric * one translation refer to an entity defined in another translation unit. 39150b57cec5SDimitry Andric */ 39160b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor); 39170b57cec5SDimitry Andric 39180b57cec5SDimitry Andric /** 39190b57cec5SDimitry Andric * Construct a USR for a specified Objective-C class. 39200b57cec5SDimitry Andric */ 39210b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name); 39220b57cec5SDimitry Andric 39230b57cec5SDimitry Andric /** 39240b57cec5SDimitry Andric * Construct a USR for a specified Objective-C category. 39250b57cec5SDimitry Andric */ 39265ffd83dbSDimitry Andric CINDEX_LINKAGE CXString clang_constructUSR_ObjCCategory( 39275ffd83dbSDimitry Andric const char *class_name, const char *category_name); 39280b57cec5SDimitry Andric 39290b57cec5SDimitry Andric /** 39300b57cec5SDimitry Andric * Construct a USR for a specified Objective-C protocol. 39310b57cec5SDimitry Andric */ 39320b57cec5SDimitry Andric CINDEX_LINKAGE CXString 39330b57cec5SDimitry Andric clang_constructUSR_ObjCProtocol(const char *protocol_name); 39340b57cec5SDimitry Andric 39350b57cec5SDimitry Andric /** 39360b57cec5SDimitry Andric * Construct a USR for a specified Objective-C instance variable and 39370b57cec5SDimitry Andric * the USR for its containing class. 39380b57cec5SDimitry Andric */ 39390b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name, 39400b57cec5SDimitry Andric CXString classUSR); 39410b57cec5SDimitry Andric 39420b57cec5SDimitry Andric /** 39430b57cec5SDimitry Andric * Construct a USR for a specified Objective-C method and 39440b57cec5SDimitry Andric * the USR for its containing class. 39450b57cec5SDimitry Andric */ 39460b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name, 39470b57cec5SDimitry Andric unsigned isInstanceMethod, 39480b57cec5SDimitry Andric CXString classUSR); 39490b57cec5SDimitry Andric 39500b57cec5SDimitry Andric /** 39510b57cec5SDimitry Andric * Construct a USR for a specified Objective-C property and the USR 39520b57cec5SDimitry Andric * for its containing class. 39530b57cec5SDimitry Andric */ 39540b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property, 39550b57cec5SDimitry Andric CXString classUSR); 39560b57cec5SDimitry Andric 39570b57cec5SDimitry Andric /** 39580b57cec5SDimitry Andric * Retrieve a name for the entity referenced by this cursor. 39590b57cec5SDimitry Andric */ 39600b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor); 39610b57cec5SDimitry Andric 39620b57cec5SDimitry Andric /** 39630b57cec5SDimitry Andric * Retrieve a range for a piece that forms the cursors spelling name. 39640b57cec5SDimitry Andric * Most of the times there is only one range for the complete spelling but for 39650b57cec5SDimitry Andric * Objective-C methods and Objective-C message expressions, there are multiple 39660b57cec5SDimitry Andric * pieces for each selector identifier. 39670b57cec5SDimitry Andric * 39680b57cec5SDimitry Andric * \param pieceIndex the index of the spelling name piece. If this is greater 39690b57cec5SDimitry Andric * than the actual number of pieces, it will return a NULL (invalid) range. 39700b57cec5SDimitry Andric * 39710b57cec5SDimitry Andric * \param options Reserved. 39720b57cec5SDimitry Andric */ 39735ffd83dbSDimitry Andric CINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange( 39745ffd83dbSDimitry Andric CXCursor, unsigned pieceIndex, unsigned options); 39750b57cec5SDimitry Andric 39760b57cec5SDimitry Andric /** 39770b57cec5SDimitry Andric * Opaque pointer representing a policy that controls pretty printing 39780b57cec5SDimitry Andric * for \c clang_getCursorPrettyPrinted. 39790b57cec5SDimitry Andric */ 39800b57cec5SDimitry Andric typedef void *CXPrintingPolicy; 39810b57cec5SDimitry Andric 39820b57cec5SDimitry Andric /** 39830b57cec5SDimitry Andric * Properties for the printing policy. 39840b57cec5SDimitry Andric * 39850b57cec5SDimitry Andric * See \c clang::PrintingPolicy for more information. 39860b57cec5SDimitry Andric */ 39870b57cec5SDimitry Andric enum CXPrintingPolicyProperty { 39880b57cec5SDimitry Andric CXPrintingPolicy_Indentation, 39890b57cec5SDimitry Andric CXPrintingPolicy_SuppressSpecifiers, 39900b57cec5SDimitry Andric CXPrintingPolicy_SuppressTagKeyword, 39910b57cec5SDimitry Andric CXPrintingPolicy_IncludeTagDefinition, 39920b57cec5SDimitry Andric CXPrintingPolicy_SuppressScope, 39930b57cec5SDimitry Andric CXPrintingPolicy_SuppressUnwrittenScope, 39940b57cec5SDimitry Andric CXPrintingPolicy_SuppressInitializers, 39950b57cec5SDimitry Andric CXPrintingPolicy_ConstantArraySizeAsWritten, 39960b57cec5SDimitry Andric CXPrintingPolicy_AnonymousTagLocations, 39970b57cec5SDimitry Andric CXPrintingPolicy_SuppressStrongLifetime, 39980b57cec5SDimitry Andric CXPrintingPolicy_SuppressLifetimeQualifiers, 39990b57cec5SDimitry Andric CXPrintingPolicy_SuppressTemplateArgsInCXXConstructors, 40000b57cec5SDimitry Andric CXPrintingPolicy_Bool, 40010b57cec5SDimitry Andric CXPrintingPolicy_Restrict, 40020b57cec5SDimitry Andric CXPrintingPolicy_Alignof, 40030b57cec5SDimitry Andric CXPrintingPolicy_UnderscoreAlignof, 40040b57cec5SDimitry Andric CXPrintingPolicy_UseVoidForZeroParams, 40050b57cec5SDimitry Andric CXPrintingPolicy_TerseOutput, 40060b57cec5SDimitry Andric CXPrintingPolicy_PolishForDeclaration, 40070b57cec5SDimitry Andric CXPrintingPolicy_Half, 40080b57cec5SDimitry Andric CXPrintingPolicy_MSWChar, 40090b57cec5SDimitry Andric CXPrintingPolicy_IncludeNewlines, 40100b57cec5SDimitry Andric CXPrintingPolicy_MSVCFormatting, 40110b57cec5SDimitry Andric CXPrintingPolicy_ConstantsAsWritten, 40120b57cec5SDimitry Andric CXPrintingPolicy_SuppressImplicitBase, 40130b57cec5SDimitry Andric CXPrintingPolicy_FullyQualifiedName, 40140b57cec5SDimitry Andric 40150b57cec5SDimitry Andric CXPrintingPolicy_LastProperty = CXPrintingPolicy_FullyQualifiedName 40160b57cec5SDimitry Andric }; 40170b57cec5SDimitry Andric 40180b57cec5SDimitry Andric /** 40190b57cec5SDimitry Andric * Get a property value for the given printing policy. 40200b57cec5SDimitry Andric */ 40210b57cec5SDimitry Andric CINDEX_LINKAGE unsigned 40220b57cec5SDimitry Andric clang_PrintingPolicy_getProperty(CXPrintingPolicy Policy, 40230b57cec5SDimitry Andric enum CXPrintingPolicyProperty Property); 40240b57cec5SDimitry Andric 40250b57cec5SDimitry Andric /** 40260b57cec5SDimitry Andric * Set a property value for the given printing policy. 40270b57cec5SDimitry Andric */ 40285ffd83dbSDimitry Andric CINDEX_LINKAGE void 40295ffd83dbSDimitry Andric clang_PrintingPolicy_setProperty(CXPrintingPolicy Policy, 40300b57cec5SDimitry Andric enum CXPrintingPolicyProperty Property, 40310b57cec5SDimitry Andric unsigned Value); 40320b57cec5SDimitry Andric 40330b57cec5SDimitry Andric /** 40340b57cec5SDimitry Andric * Retrieve the default policy for the cursor. 40350b57cec5SDimitry Andric * 40360b57cec5SDimitry Andric * The policy should be released after use with \c 40370b57cec5SDimitry Andric * clang_PrintingPolicy_dispose. 40380b57cec5SDimitry Andric */ 40390b57cec5SDimitry Andric CINDEX_LINKAGE CXPrintingPolicy clang_getCursorPrintingPolicy(CXCursor); 40400b57cec5SDimitry Andric 40410b57cec5SDimitry Andric /** 40420b57cec5SDimitry Andric * Release a printing policy. 40430b57cec5SDimitry Andric */ 40440b57cec5SDimitry Andric CINDEX_LINKAGE void clang_PrintingPolicy_dispose(CXPrintingPolicy Policy); 40450b57cec5SDimitry Andric 40460b57cec5SDimitry Andric /** 40470b57cec5SDimitry Andric * Pretty print declarations. 40480b57cec5SDimitry Andric * 40490b57cec5SDimitry Andric * \param Cursor The cursor representing a declaration. 40500b57cec5SDimitry Andric * 40510b57cec5SDimitry Andric * \param Policy The policy to control the entities being printed. If 40520b57cec5SDimitry Andric * NULL, a default policy is used. 40530b57cec5SDimitry Andric * 40540b57cec5SDimitry Andric * \returns The pretty printed declaration or the empty string for 40550b57cec5SDimitry Andric * other cursors. 40560b57cec5SDimitry Andric */ 40570b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getCursorPrettyPrinted(CXCursor Cursor, 40580b57cec5SDimitry Andric CXPrintingPolicy Policy); 40590b57cec5SDimitry Andric 40600b57cec5SDimitry Andric /** 40610b57cec5SDimitry Andric * Retrieve the display name for the entity referenced by this cursor. 40620b57cec5SDimitry Andric * 40630b57cec5SDimitry Andric * The display name contains extra information that helps identify the cursor, 40640b57cec5SDimitry Andric * such as the parameters of a function or template or the arguments of a 40650b57cec5SDimitry Andric * class template specialization. 40660b57cec5SDimitry Andric */ 40670b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor); 40680b57cec5SDimitry Andric 40690b57cec5SDimitry Andric /** For a cursor that is a reference, retrieve a cursor representing the 40700b57cec5SDimitry Andric * entity that it references. 40710b57cec5SDimitry Andric * 40720b57cec5SDimitry Andric * Reference cursors refer to other entities in the AST. For example, an 40730b57cec5SDimitry Andric * Objective-C superclass reference cursor refers to an Objective-C class. 40740b57cec5SDimitry Andric * This function produces the cursor for the Objective-C class from the 40750b57cec5SDimitry Andric * cursor for the superclass reference. If the input cursor is a declaration or 40760b57cec5SDimitry Andric * definition, it returns that declaration or definition unchanged. 40770b57cec5SDimitry Andric * Otherwise, returns the NULL cursor. 40780b57cec5SDimitry Andric */ 40790b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor); 40800b57cec5SDimitry Andric 40810b57cec5SDimitry Andric /** 40820b57cec5SDimitry Andric * For a cursor that is either a reference to or a declaration 40830b57cec5SDimitry Andric * of some entity, retrieve a cursor that describes the definition of 40840b57cec5SDimitry Andric * that entity. 40850b57cec5SDimitry Andric * 40860b57cec5SDimitry Andric * Some entities can be declared multiple times within a translation 40870b57cec5SDimitry Andric * unit, but only one of those declarations can also be a 40880b57cec5SDimitry Andric * definition. For example, given: 40890b57cec5SDimitry Andric * 40900b57cec5SDimitry Andric * \code 40910b57cec5SDimitry Andric * int f(int, int); 40920b57cec5SDimitry Andric * int g(int x, int y) { return f(x, y); } 40930b57cec5SDimitry Andric * int f(int a, int b) { return a + b; } 40940b57cec5SDimitry Andric * int f(int, int); 40950b57cec5SDimitry Andric * \endcode 40960b57cec5SDimitry Andric * 40970b57cec5SDimitry Andric * there are three declarations of the function "f", but only the 40980b57cec5SDimitry Andric * second one is a definition. The clang_getCursorDefinition() 40990b57cec5SDimitry Andric * function will take any cursor pointing to a declaration of "f" 41000b57cec5SDimitry Andric * (the first or fourth lines of the example) or a cursor referenced 41010b57cec5SDimitry Andric * that uses "f" (the call to "f' inside "g") and will return a 41020b57cec5SDimitry Andric * declaration cursor pointing to the definition (the second "f" 41030b57cec5SDimitry Andric * declaration). 41040b57cec5SDimitry Andric * 41050b57cec5SDimitry Andric * If given a cursor for which there is no corresponding definition, 41060b57cec5SDimitry Andric * e.g., because there is no definition of that entity within this 41070b57cec5SDimitry Andric * translation unit, returns a NULL cursor. 41080b57cec5SDimitry Andric */ 41090b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor); 41100b57cec5SDimitry Andric 41110b57cec5SDimitry Andric /** 41120b57cec5SDimitry Andric * Determine whether the declaration pointed to by this cursor 41130b57cec5SDimitry Andric * is also a definition of that entity. 41140b57cec5SDimitry Andric */ 41150b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor); 41160b57cec5SDimitry Andric 41170b57cec5SDimitry Andric /** 41180b57cec5SDimitry Andric * Retrieve the canonical cursor corresponding to the given cursor. 41190b57cec5SDimitry Andric * 41200b57cec5SDimitry Andric * In the C family of languages, many kinds of entities can be declared several 41210b57cec5SDimitry Andric * times within a single translation unit. For example, a structure type can 41220b57cec5SDimitry Andric * be forward-declared (possibly multiple times) and later defined: 41230b57cec5SDimitry Andric * 41240b57cec5SDimitry Andric * \code 41250b57cec5SDimitry Andric * struct X; 41260b57cec5SDimitry Andric * struct X; 41270b57cec5SDimitry Andric * struct X { 41280b57cec5SDimitry Andric * int member; 41290b57cec5SDimitry Andric * }; 41300b57cec5SDimitry Andric * \endcode 41310b57cec5SDimitry Andric * 41320b57cec5SDimitry Andric * The declarations and the definition of \c X are represented by three 41330b57cec5SDimitry Andric * different cursors, all of which are declarations of the same underlying 41340b57cec5SDimitry Andric * entity. One of these cursor is considered the "canonical" cursor, which 41350b57cec5SDimitry Andric * is effectively the representative for the underlying entity. One can 41360b57cec5SDimitry Andric * determine if two cursors are declarations of the same underlying entity by 41370b57cec5SDimitry Andric * comparing their canonical cursors. 41380b57cec5SDimitry Andric * 41390b57cec5SDimitry Andric * \returns The canonical cursor for the entity referred to by the given cursor. 41400b57cec5SDimitry Andric */ 41410b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor); 41420b57cec5SDimitry Andric 41430b57cec5SDimitry Andric /** 41440b57cec5SDimitry Andric * If the cursor points to a selector identifier in an Objective-C 41450b57cec5SDimitry Andric * method or message expression, this returns the selector index. 41460b57cec5SDimitry Andric * 41470b57cec5SDimitry Andric * After getting a cursor with #clang_getCursor, this can be called to 41480b57cec5SDimitry Andric * determine if the location points to a selector identifier. 41490b57cec5SDimitry Andric * 41500b57cec5SDimitry Andric * \returns The selector index if the cursor is an Objective-C method or message 41510b57cec5SDimitry Andric * expression and the cursor is pointing to a selector identifier, or -1 41520b57cec5SDimitry Andric * otherwise. 41530b57cec5SDimitry Andric */ 41540b57cec5SDimitry Andric CINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor); 41550b57cec5SDimitry Andric 41560b57cec5SDimitry Andric /** 41570b57cec5SDimitry Andric * Given a cursor pointing to a C++ method call or an Objective-C 41580b57cec5SDimitry Andric * message, returns non-zero if the method/message is "dynamic", meaning: 41590b57cec5SDimitry Andric * 41600b57cec5SDimitry Andric * For a C++ method: the call is virtual. 41610b57cec5SDimitry Andric * For an Objective-C message: the receiver is an object instance, not 'super' 41620b57cec5SDimitry Andric * or a specific class. 41630b57cec5SDimitry Andric * 41640b57cec5SDimitry Andric * If the method/message is "static" or the cursor does not point to a 41650b57cec5SDimitry Andric * method/message, it will return zero. 41660b57cec5SDimitry Andric */ 41670b57cec5SDimitry Andric CINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C); 41680b57cec5SDimitry Andric 41690b57cec5SDimitry Andric /** 41700b57cec5SDimitry Andric * Given a cursor pointing to an Objective-C message or property 41710b57cec5SDimitry Andric * reference, or C++ method call, returns the CXType of the receiver. 41720b57cec5SDimitry Andric */ 41730b57cec5SDimitry Andric CINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C); 41740b57cec5SDimitry Andric 41750b57cec5SDimitry Andric /** 41760b57cec5SDimitry Andric * Property attributes for a \c CXCursor_ObjCPropertyDecl. 41770b57cec5SDimitry Andric */ 41780b57cec5SDimitry Andric typedef enum { 41790b57cec5SDimitry Andric CXObjCPropertyAttr_noattr = 0x00, 41800b57cec5SDimitry Andric CXObjCPropertyAttr_readonly = 0x01, 41810b57cec5SDimitry Andric CXObjCPropertyAttr_getter = 0x02, 41820b57cec5SDimitry Andric CXObjCPropertyAttr_assign = 0x04, 41830b57cec5SDimitry Andric CXObjCPropertyAttr_readwrite = 0x08, 41840b57cec5SDimitry Andric CXObjCPropertyAttr_retain = 0x10, 41850b57cec5SDimitry Andric CXObjCPropertyAttr_copy = 0x20, 41860b57cec5SDimitry Andric CXObjCPropertyAttr_nonatomic = 0x40, 41870b57cec5SDimitry Andric CXObjCPropertyAttr_setter = 0x80, 41880b57cec5SDimitry Andric CXObjCPropertyAttr_atomic = 0x100, 41890b57cec5SDimitry Andric CXObjCPropertyAttr_weak = 0x200, 41900b57cec5SDimitry Andric CXObjCPropertyAttr_strong = 0x400, 41910b57cec5SDimitry Andric CXObjCPropertyAttr_unsafe_unretained = 0x800, 41920b57cec5SDimitry Andric CXObjCPropertyAttr_class = 0x1000 41930b57cec5SDimitry Andric } CXObjCPropertyAttrKind; 41940b57cec5SDimitry Andric 41950b57cec5SDimitry Andric /** 41960b57cec5SDimitry Andric * Given a cursor that represents a property declaration, return the 41970b57cec5SDimitry Andric * associated property attributes. The bits are formed from 41980b57cec5SDimitry Andric * \c CXObjCPropertyAttrKind. 41990b57cec5SDimitry Andric * 42000b57cec5SDimitry Andric * \param reserved Reserved for future use, pass 0. 42010b57cec5SDimitry Andric */ 42025ffd83dbSDimitry Andric CINDEX_LINKAGE unsigned 42035ffd83dbSDimitry Andric clang_Cursor_getObjCPropertyAttributes(CXCursor C, unsigned reserved); 42040b57cec5SDimitry Andric 42050b57cec5SDimitry Andric /** 42060b57cec5SDimitry Andric * Given a cursor that represents a property declaration, return the 42070b57cec5SDimitry Andric * name of the method that implements the getter. 42080b57cec5SDimitry Andric */ 42090b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertyGetterName(CXCursor C); 42100b57cec5SDimitry Andric 42110b57cec5SDimitry Andric /** 42120b57cec5SDimitry Andric * Given a cursor that represents a property declaration, return the 42130b57cec5SDimitry Andric * name of the method that implements the setter, if any. 42140b57cec5SDimitry Andric */ 42150b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertySetterName(CXCursor C); 42160b57cec5SDimitry Andric 42170b57cec5SDimitry Andric /** 42180b57cec5SDimitry Andric * 'Qualifiers' written next to the return and parameter types in 42190b57cec5SDimitry Andric * Objective-C method declarations. 42200b57cec5SDimitry Andric */ 42210b57cec5SDimitry Andric typedef enum { 42220b57cec5SDimitry Andric CXObjCDeclQualifier_None = 0x0, 42230b57cec5SDimitry Andric CXObjCDeclQualifier_In = 0x1, 42240b57cec5SDimitry Andric CXObjCDeclQualifier_Inout = 0x2, 42250b57cec5SDimitry Andric CXObjCDeclQualifier_Out = 0x4, 42260b57cec5SDimitry Andric CXObjCDeclQualifier_Bycopy = 0x8, 42270b57cec5SDimitry Andric CXObjCDeclQualifier_Byref = 0x10, 42280b57cec5SDimitry Andric CXObjCDeclQualifier_Oneway = 0x20 42290b57cec5SDimitry Andric } CXObjCDeclQualifierKind; 42300b57cec5SDimitry Andric 42310b57cec5SDimitry Andric /** 42320b57cec5SDimitry Andric * Given a cursor that represents an Objective-C method or parameter 42330b57cec5SDimitry Andric * declaration, return the associated Objective-C qualifiers for the return 42340b57cec5SDimitry Andric * type or the parameter respectively. The bits are formed from 42350b57cec5SDimitry Andric * CXObjCDeclQualifierKind. 42360b57cec5SDimitry Andric */ 42370b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_getObjCDeclQualifiers(CXCursor C); 42380b57cec5SDimitry Andric 42390b57cec5SDimitry Andric /** 42400b57cec5SDimitry Andric * Given a cursor that represents an Objective-C method or property 42410b57cec5SDimitry Andric * declaration, return non-zero if the declaration was affected by "\@optional". 42420b57cec5SDimitry Andric * Returns zero if the cursor is not such a declaration or it is "\@required". 42430b57cec5SDimitry Andric */ 42440b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_isObjCOptional(CXCursor C); 42450b57cec5SDimitry Andric 42460b57cec5SDimitry Andric /** 42470b57cec5SDimitry Andric * Returns non-zero if the given cursor is a variadic function or method. 42480b57cec5SDimitry Andric */ 42490b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_isVariadic(CXCursor C); 42500b57cec5SDimitry Andric 42510b57cec5SDimitry Andric /** 42520b57cec5SDimitry Andric * Returns non-zero if the given cursor points to a symbol marked with 42530b57cec5SDimitry Andric * external_source_symbol attribute. 42540b57cec5SDimitry Andric * 42550b57cec5SDimitry Andric * \param language If non-NULL, and the attribute is present, will be set to 42560b57cec5SDimitry Andric * the 'language' string from the attribute. 42570b57cec5SDimitry Andric * 42580b57cec5SDimitry Andric * \param definedIn If non-NULL, and the attribute is present, will be set to 42590b57cec5SDimitry Andric * the 'definedIn' string from the attribute. 42600b57cec5SDimitry Andric * 42610b57cec5SDimitry Andric * \param isGenerated If non-NULL, and the attribute is present, will be set to 42620b57cec5SDimitry Andric * non-zero if the 'generated_declaration' is set in the attribute. 42630b57cec5SDimitry Andric */ 42640b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Cursor_isExternalSymbol(CXCursor C, 42655ffd83dbSDimitry Andric CXString *language, 42665ffd83dbSDimitry Andric CXString *definedIn, 42670b57cec5SDimitry Andric unsigned *isGenerated); 42680b57cec5SDimitry Andric 42690b57cec5SDimitry Andric /** 42700b57cec5SDimitry Andric * Given a cursor that represents a declaration, return the associated 42710b57cec5SDimitry Andric * comment's source range. The range may include multiple consecutive comments 42720b57cec5SDimitry Andric * with whitespace in between. 42730b57cec5SDimitry Andric */ 42740b57cec5SDimitry Andric CINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange(CXCursor C); 42750b57cec5SDimitry Andric 42760b57cec5SDimitry Andric /** 42770b57cec5SDimitry Andric * Given a cursor that represents a declaration, return the associated 42780b57cec5SDimitry Andric * comment text, including comment markers. 42790b57cec5SDimitry Andric */ 42800b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_Cursor_getRawCommentText(CXCursor C); 42810b57cec5SDimitry Andric 42820b57cec5SDimitry Andric /** 42830b57cec5SDimitry Andric * Given a cursor that represents a documentable entity (e.g., 42840b57cec5SDimitry Andric * declaration), return the associated \paragraph; otherwise return the 42850b57cec5SDimitry Andric * first paragraph. 42860b57cec5SDimitry Andric */ 42870b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText(CXCursor C); 42880b57cec5SDimitry Andric 42890b57cec5SDimitry Andric /** 42900b57cec5SDimitry Andric * @} 42910b57cec5SDimitry Andric */ 42920b57cec5SDimitry Andric 42930b57cec5SDimitry Andric /** \defgroup CINDEX_MANGLE Name Mangling API Functions 42940b57cec5SDimitry Andric * 42950b57cec5SDimitry Andric * @{ 42960b57cec5SDimitry Andric */ 42970b57cec5SDimitry Andric 42980b57cec5SDimitry Andric /** 42990b57cec5SDimitry Andric * Retrieve the CXString representing the mangled name of the cursor. 43000b57cec5SDimitry Andric */ 43010b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_Cursor_getMangling(CXCursor); 43020b57cec5SDimitry Andric 43030b57cec5SDimitry Andric /** 43040b57cec5SDimitry Andric * Retrieve the CXStrings representing the mangled symbols of the C++ 43050b57cec5SDimitry Andric * constructor or destructor at the cursor. 43060b57cec5SDimitry Andric */ 43070b57cec5SDimitry Andric CINDEX_LINKAGE CXStringSet *clang_Cursor_getCXXManglings(CXCursor); 43080b57cec5SDimitry Andric 43090b57cec5SDimitry Andric /** 43100b57cec5SDimitry Andric * Retrieve the CXStrings representing the mangled symbols of the ObjC 43110b57cec5SDimitry Andric * class interface or implementation at the cursor. 43120b57cec5SDimitry Andric */ 43130b57cec5SDimitry Andric CINDEX_LINKAGE CXStringSet *clang_Cursor_getObjCManglings(CXCursor); 43140b57cec5SDimitry Andric 43150b57cec5SDimitry Andric /** 43160b57cec5SDimitry Andric * @} 43170b57cec5SDimitry Andric */ 43180b57cec5SDimitry Andric 43190b57cec5SDimitry Andric /** 43200b57cec5SDimitry Andric * \defgroup CINDEX_MODULE Module introspection 43210b57cec5SDimitry Andric * 43220b57cec5SDimitry Andric * The functions in this group provide access to information about modules. 43230b57cec5SDimitry Andric * 43240b57cec5SDimitry Andric * @{ 43250b57cec5SDimitry Andric */ 43260b57cec5SDimitry Andric 43270b57cec5SDimitry Andric typedef void *CXModule; 43280b57cec5SDimitry Andric 43290b57cec5SDimitry Andric /** 43300b57cec5SDimitry Andric * Given a CXCursor_ModuleImportDecl cursor, return the associated module. 43310b57cec5SDimitry Andric */ 43320b57cec5SDimitry Andric CINDEX_LINKAGE CXModule clang_Cursor_getModule(CXCursor C); 43330b57cec5SDimitry Andric 43340b57cec5SDimitry Andric /** 43350b57cec5SDimitry Andric * Given a CXFile header file, return the module that contains it, if one 43360b57cec5SDimitry Andric * exists. 43370b57cec5SDimitry Andric */ 43380b57cec5SDimitry Andric CINDEX_LINKAGE CXModule clang_getModuleForFile(CXTranslationUnit, CXFile); 43390b57cec5SDimitry Andric 43400b57cec5SDimitry Andric /** 43410b57cec5SDimitry Andric * \param Module a module object. 43420b57cec5SDimitry Andric * 43430b57cec5SDimitry Andric * \returns the module file where the provided module object came from. 43440b57cec5SDimitry Andric */ 43450b57cec5SDimitry Andric CINDEX_LINKAGE CXFile clang_Module_getASTFile(CXModule Module); 43460b57cec5SDimitry Andric 43470b57cec5SDimitry Andric /** 43480b57cec5SDimitry Andric * \param Module a module object. 43490b57cec5SDimitry Andric * 43500b57cec5SDimitry Andric * \returns the parent of a sub-module or NULL if the given module is top-level, 43510b57cec5SDimitry Andric * e.g. for 'std.vector' it will return the 'std' module. 43520b57cec5SDimitry Andric */ 43530b57cec5SDimitry Andric CINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module); 43540b57cec5SDimitry Andric 43550b57cec5SDimitry Andric /** 43560b57cec5SDimitry Andric * \param Module a module object. 43570b57cec5SDimitry Andric * 43580b57cec5SDimitry Andric * \returns the name of the module, e.g. for the 'std.vector' sub-module it 43590b57cec5SDimitry Andric * will return "vector". 43600b57cec5SDimitry Andric */ 43610b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_Module_getName(CXModule Module); 43620b57cec5SDimitry Andric 43630b57cec5SDimitry Andric /** 43640b57cec5SDimitry Andric * \param Module a module object. 43650b57cec5SDimitry Andric * 43660b57cec5SDimitry Andric * \returns the full name of the module, e.g. "std.vector". 43670b57cec5SDimitry Andric */ 43680b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module); 43690b57cec5SDimitry Andric 43700b57cec5SDimitry Andric /** 43710b57cec5SDimitry Andric * \param Module a module object. 43720b57cec5SDimitry Andric * 43730b57cec5SDimitry Andric * \returns non-zero if the module is a system one. 43740b57cec5SDimitry Andric */ 43750b57cec5SDimitry Andric CINDEX_LINKAGE int clang_Module_isSystem(CXModule Module); 43760b57cec5SDimitry Andric 43770b57cec5SDimitry Andric /** 43780b57cec5SDimitry Andric * \param Module a module object. 43790b57cec5SDimitry Andric * 43800b57cec5SDimitry Andric * \returns the number of top level headers associated with this module. 43810b57cec5SDimitry Andric */ 43820b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit, 43830b57cec5SDimitry Andric CXModule Module); 43840b57cec5SDimitry Andric 43850b57cec5SDimitry Andric /** 43860b57cec5SDimitry Andric * \param Module a module object. 43870b57cec5SDimitry Andric * 43880b57cec5SDimitry Andric * \param Index top level header index (zero-based). 43890b57cec5SDimitry Andric * 43900b57cec5SDimitry Andric * \returns the specified top level header associated with the module. 43910b57cec5SDimitry Andric */ 43920b57cec5SDimitry Andric CINDEX_LINKAGE 43935ffd83dbSDimitry Andric CXFile clang_Module_getTopLevelHeader(CXTranslationUnit, CXModule Module, 43945ffd83dbSDimitry Andric unsigned Index); 43950b57cec5SDimitry Andric 43960b57cec5SDimitry Andric /** 43970b57cec5SDimitry Andric * @} 43980b57cec5SDimitry Andric */ 43990b57cec5SDimitry Andric 44000b57cec5SDimitry Andric /** 44010b57cec5SDimitry Andric * \defgroup CINDEX_CPP C++ AST introspection 44020b57cec5SDimitry Andric * 44030b57cec5SDimitry Andric * The routines in this group provide access information in the ASTs specific 44040b57cec5SDimitry Andric * to C++ language features. 44050b57cec5SDimitry Andric * 44060b57cec5SDimitry Andric * @{ 44070b57cec5SDimitry Andric */ 44080b57cec5SDimitry Andric 44090b57cec5SDimitry Andric /** 44100b57cec5SDimitry Andric * Determine if a C++ constructor is a converting constructor. 44110b57cec5SDimitry Andric */ 44125ffd83dbSDimitry Andric CINDEX_LINKAGE unsigned 44135ffd83dbSDimitry Andric clang_CXXConstructor_isConvertingConstructor(CXCursor C); 44140b57cec5SDimitry Andric 44150b57cec5SDimitry Andric /** 44160b57cec5SDimitry Andric * Determine if a C++ constructor is a copy constructor. 44170b57cec5SDimitry Andric */ 44180b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXXConstructor_isCopyConstructor(CXCursor C); 44190b57cec5SDimitry Andric 44200b57cec5SDimitry Andric /** 44210b57cec5SDimitry Andric * Determine if a C++ constructor is the default constructor. 44220b57cec5SDimitry Andric */ 44230b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXXConstructor_isDefaultConstructor(CXCursor C); 44240b57cec5SDimitry Andric 44250b57cec5SDimitry Andric /** 44260b57cec5SDimitry Andric * Determine if a C++ constructor is a move constructor. 44270b57cec5SDimitry Andric */ 44280b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXXConstructor_isMoveConstructor(CXCursor C); 44290b57cec5SDimitry Andric 44300b57cec5SDimitry Andric /** 44310b57cec5SDimitry Andric * Determine if a C++ field is declared 'mutable'. 44320b57cec5SDimitry Andric */ 44330b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXXField_isMutable(CXCursor C); 44340b57cec5SDimitry Andric 44350b57cec5SDimitry Andric /** 44360b57cec5SDimitry Andric * Determine if a C++ method is declared '= default'. 44370b57cec5SDimitry Andric */ 44380b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXXMethod_isDefaulted(CXCursor C); 44390b57cec5SDimitry Andric 44400b57cec5SDimitry Andric /** 4441bdd1243dSDimitry Andric * Determine if a C++ method is declared '= delete'. 4442bdd1243dSDimitry Andric */ 4443bdd1243dSDimitry Andric CINDEX_LINKAGE unsigned clang_CXXMethod_isDeleted(CXCursor C); 4444bdd1243dSDimitry Andric 4445bdd1243dSDimitry Andric /** 44460b57cec5SDimitry Andric * Determine if a C++ member function or member function template is 44470b57cec5SDimitry Andric * pure virtual. 44480b57cec5SDimitry Andric */ 44490b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXXMethod_isPureVirtual(CXCursor C); 44500b57cec5SDimitry Andric 44510b57cec5SDimitry Andric /** 44520b57cec5SDimitry Andric * Determine if a C++ member function or member function template is 44530b57cec5SDimitry Andric * declared 'static'. 44540b57cec5SDimitry Andric */ 44550b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C); 44560b57cec5SDimitry Andric 44570b57cec5SDimitry Andric /** 44580b57cec5SDimitry Andric * Determine if a C++ member function or member function template is 44590b57cec5SDimitry Andric * explicitly declared 'virtual' or if it overrides a virtual method from 44600b57cec5SDimitry Andric * one of the base classes. 44610b57cec5SDimitry Andric */ 44620b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C); 44630b57cec5SDimitry Andric 44640b57cec5SDimitry Andric /** 4465bdd1243dSDimitry Andric * Determine if a C++ member function is a copy-assignment operator, 4466bdd1243dSDimitry Andric * returning 1 if such is the case and 0 otherwise. 4467bdd1243dSDimitry Andric * 4468bdd1243dSDimitry Andric * > A copy-assignment operator `X::operator=` is a non-static, 4469bdd1243dSDimitry Andric * > non-template member function of _class_ `X` with exactly one 4470bdd1243dSDimitry Andric * > parameter of type `X`, `X&`, `const X&`, `volatile X&` or `const 4471bdd1243dSDimitry Andric * > volatile X&`. 4472bdd1243dSDimitry Andric * 4473bdd1243dSDimitry Andric * That is, for example, the `operator=` in: 4474bdd1243dSDimitry Andric * 4475bdd1243dSDimitry Andric * class Foo { 4476bdd1243dSDimitry Andric * bool operator=(const volatile Foo&); 4477bdd1243dSDimitry Andric * }; 4478bdd1243dSDimitry Andric * 4479bdd1243dSDimitry Andric * Is a copy-assignment operator, while the `operator=` in: 4480bdd1243dSDimitry Andric * 4481bdd1243dSDimitry Andric * class Bar { 4482bdd1243dSDimitry Andric * bool operator=(const int&); 4483bdd1243dSDimitry Andric * }; 4484bdd1243dSDimitry Andric * 4485bdd1243dSDimitry Andric * Is not. 4486bdd1243dSDimitry Andric */ 4487bdd1243dSDimitry Andric CINDEX_LINKAGE unsigned clang_CXXMethod_isCopyAssignmentOperator(CXCursor C); 4488bdd1243dSDimitry Andric 4489bdd1243dSDimitry Andric /** 4490bdd1243dSDimitry Andric * Determine if a C++ member function is a move-assignment operator, 4491bdd1243dSDimitry Andric * returning 1 if such is the case and 0 otherwise. 4492bdd1243dSDimitry Andric * 4493bdd1243dSDimitry Andric * > A move-assignment operator `X::operator=` is a non-static, 4494bdd1243dSDimitry Andric * > non-template member function of _class_ `X` with exactly one 4495bdd1243dSDimitry Andric * > parameter of type `X&&`, `const X&&`, `volatile X&&` or `const 4496bdd1243dSDimitry Andric * > volatile X&&`. 4497bdd1243dSDimitry Andric * 4498bdd1243dSDimitry Andric * That is, for example, the `operator=` in: 4499bdd1243dSDimitry Andric * 4500bdd1243dSDimitry Andric * class Foo { 4501bdd1243dSDimitry Andric * bool operator=(const volatile Foo&&); 4502bdd1243dSDimitry Andric * }; 4503bdd1243dSDimitry Andric * 4504bdd1243dSDimitry Andric * Is a move-assignment operator, while the `operator=` in: 4505bdd1243dSDimitry Andric * 4506bdd1243dSDimitry Andric * class Bar { 4507bdd1243dSDimitry Andric * bool operator=(const int&&); 4508bdd1243dSDimitry Andric * }; 4509bdd1243dSDimitry Andric * 4510bdd1243dSDimitry Andric * Is not. 4511bdd1243dSDimitry Andric */ 4512bdd1243dSDimitry Andric CINDEX_LINKAGE unsigned clang_CXXMethod_isMoveAssignmentOperator(CXCursor C); 4513bdd1243dSDimitry Andric 4514bdd1243dSDimitry Andric /** 451506c3fb27SDimitry Andric * Determines if a C++ constructor or conversion function was declared 451606c3fb27SDimitry Andric * explicit, returning 1 if such is the case and 0 otherwise. 451706c3fb27SDimitry Andric * 451806c3fb27SDimitry Andric * Constructors or conversion functions are declared explicit through 451906c3fb27SDimitry Andric * the use of the explicit specifier. 452006c3fb27SDimitry Andric * 452106c3fb27SDimitry Andric * For example, the following constructor and conversion function are 452206c3fb27SDimitry Andric * not explicit as they lack the explicit specifier: 452306c3fb27SDimitry Andric * 452406c3fb27SDimitry Andric * class Foo { 452506c3fb27SDimitry Andric * Foo(); 452606c3fb27SDimitry Andric * operator int(); 452706c3fb27SDimitry Andric * }; 452806c3fb27SDimitry Andric * 452906c3fb27SDimitry Andric * While the following constructor and conversion function are 453006c3fb27SDimitry Andric * explicit as they are declared with the explicit specifier. 453106c3fb27SDimitry Andric * 453206c3fb27SDimitry Andric * class Foo { 453306c3fb27SDimitry Andric * explicit Foo(); 453406c3fb27SDimitry Andric * explicit operator int(); 453506c3fb27SDimitry Andric * }; 453606c3fb27SDimitry Andric * 453706c3fb27SDimitry Andric * This function will return 0 when given a cursor pointing to one of 453806c3fb27SDimitry Andric * the former declarations and it will return 1 for a cursor pointing 453906c3fb27SDimitry Andric * to the latter declarations. 454006c3fb27SDimitry Andric * 454106c3fb27SDimitry Andric * The explicit specifier allows the user to specify a 454206c3fb27SDimitry Andric * conditional compile-time expression whose value decides 454306c3fb27SDimitry Andric * whether the marked element is explicit or not. 454406c3fb27SDimitry Andric * 454506c3fb27SDimitry Andric * For example: 454606c3fb27SDimitry Andric * 454706c3fb27SDimitry Andric * constexpr bool foo(int i) { return i % 2 == 0; } 454806c3fb27SDimitry Andric * 454906c3fb27SDimitry Andric * class Foo { 455006c3fb27SDimitry Andric * explicit(foo(1)) Foo(); 455106c3fb27SDimitry Andric * explicit(foo(2)) operator int(); 455206c3fb27SDimitry Andric * } 455306c3fb27SDimitry Andric * 455406c3fb27SDimitry Andric * This function will return 0 for the constructor and 1 for 455506c3fb27SDimitry Andric * the conversion function. 455606c3fb27SDimitry Andric */ 455706c3fb27SDimitry Andric CINDEX_LINKAGE unsigned clang_CXXMethod_isExplicit(CXCursor C); 455806c3fb27SDimitry Andric 455906c3fb27SDimitry Andric /** 45600b57cec5SDimitry Andric * Determine if a C++ record is abstract, i.e. whether a class or struct 45610b57cec5SDimitry Andric * has a pure virtual member function. 45620b57cec5SDimitry Andric */ 45630b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXXRecord_isAbstract(CXCursor C); 45640b57cec5SDimitry Andric 45650b57cec5SDimitry Andric /** 45660b57cec5SDimitry Andric * Determine if an enum declaration refers to a scoped enum. 45670b57cec5SDimitry Andric */ 45680b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_EnumDecl_isScoped(CXCursor C); 45690b57cec5SDimitry Andric 45700b57cec5SDimitry Andric /** 45710b57cec5SDimitry Andric * Determine if a C++ member function or member function template is 45720b57cec5SDimitry Andric * declared 'const'. 45730b57cec5SDimitry Andric */ 45740b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_CXXMethod_isConst(CXCursor C); 45750b57cec5SDimitry Andric 45760b57cec5SDimitry Andric /** 45770b57cec5SDimitry Andric * Given a cursor that represents a template, determine 45780b57cec5SDimitry Andric * the cursor kind of the specializations would be generated by instantiating 45790b57cec5SDimitry Andric * the template. 45800b57cec5SDimitry Andric * 45810b57cec5SDimitry Andric * This routine can be used to determine what flavor of function template, 45820b57cec5SDimitry Andric * class template, or class template partial specialization is stored in the 45830b57cec5SDimitry Andric * cursor. For example, it can describe whether a class template cursor is 45840b57cec5SDimitry Andric * declared with "struct", "class" or "union". 45850b57cec5SDimitry Andric * 45860b57cec5SDimitry Andric * \param C The cursor to query. This cursor should represent a template 45870b57cec5SDimitry Andric * declaration. 45880b57cec5SDimitry Andric * 45890b57cec5SDimitry Andric * \returns The cursor kind of the specializations that would be generated 45900b57cec5SDimitry Andric * by instantiating the template \p C. If \p C is not a template, returns 45910b57cec5SDimitry Andric * \c CXCursor_NoDeclFound. 45920b57cec5SDimitry Andric */ 45930b57cec5SDimitry Andric CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C); 45940b57cec5SDimitry Andric 45950b57cec5SDimitry Andric /** 45960b57cec5SDimitry Andric * Given a cursor that may represent a specialization or instantiation 45970b57cec5SDimitry Andric * of a template, retrieve the cursor that represents the template that it 45980b57cec5SDimitry Andric * specializes or from which it was instantiated. 45990b57cec5SDimitry Andric * 46000b57cec5SDimitry Andric * This routine determines the template involved both for explicit 46010b57cec5SDimitry Andric * specializations of templates and for implicit instantiations of the template, 46020b57cec5SDimitry Andric * both of which are referred to as "specializations". For a class template 46030b57cec5SDimitry Andric * specialization (e.g., \c std::vector<bool>), this routine will return 46040b57cec5SDimitry Andric * either the primary template (\c std::vector) or, if the specialization was 46050b57cec5SDimitry Andric * instantiated from a class template partial specialization, the class template 46060b57cec5SDimitry Andric * partial specialization. For a class template partial specialization and a 46070b57cec5SDimitry Andric * function template specialization (including instantiations), this 46080b57cec5SDimitry Andric * this routine will return the specialized template. 46090b57cec5SDimitry Andric * 46100b57cec5SDimitry Andric * For members of a class template (e.g., member functions, member classes, or 46110b57cec5SDimitry Andric * static data members), returns the specialized or instantiated member. 46120b57cec5SDimitry Andric * Although not strictly "templates" in the C++ language, members of class 46130b57cec5SDimitry Andric * templates have the same notions of specializations and instantiations that 46140b57cec5SDimitry Andric * templates do, so this routine treats them similarly. 46150b57cec5SDimitry Andric * 46160b57cec5SDimitry Andric * \param C A cursor that may be a specialization of a template or a member 46170b57cec5SDimitry Andric * of a template. 46180b57cec5SDimitry Andric * 46190b57cec5SDimitry Andric * \returns If the given cursor is a specialization or instantiation of a 46200b57cec5SDimitry Andric * template or a member thereof, the template or member that it specializes or 46210b57cec5SDimitry Andric * from which it was instantiated. Otherwise, returns a NULL cursor. 46220b57cec5SDimitry Andric */ 46230b57cec5SDimitry Andric CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C); 46240b57cec5SDimitry Andric 46250b57cec5SDimitry Andric /** 46260b57cec5SDimitry Andric * Given a cursor that references something else, return the source range 46270b57cec5SDimitry Andric * covering that reference. 46280b57cec5SDimitry Andric * 46290b57cec5SDimitry Andric * \param C A cursor pointing to a member reference, a declaration reference, or 46300b57cec5SDimitry Andric * an operator call. 46310b57cec5SDimitry Andric * \param NameFlags A bitset with three independent flags: 46320b57cec5SDimitry Andric * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and 46330b57cec5SDimitry Andric * CXNameRange_WantSinglePiece. 46340b57cec5SDimitry Andric * \param PieceIndex For contiguous names or when passing the flag 46350b57cec5SDimitry Andric * CXNameRange_WantSinglePiece, only one piece with index 0 is 46360b57cec5SDimitry Andric * available. When the CXNameRange_WantSinglePiece flag is not passed for a 46370b57cec5SDimitry Andric * non-contiguous names, this index can be used to retrieve the individual 46380b57cec5SDimitry Andric * pieces of the name. See also CXNameRange_WantSinglePiece. 46390b57cec5SDimitry Andric * 46400b57cec5SDimitry Andric * \returns The piece of the name pointed to by the given cursor. If there is no 46410b57cec5SDimitry Andric * name, or if the PieceIndex is out-of-range, a null-cursor will be returned. 46420b57cec5SDimitry Andric */ 46435ffd83dbSDimitry Andric CINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange( 46445ffd83dbSDimitry Andric CXCursor C, unsigned NameFlags, unsigned PieceIndex); 46450b57cec5SDimitry Andric 46460b57cec5SDimitry Andric enum CXNameRefFlags { 46470b57cec5SDimitry Andric /** 46480b57cec5SDimitry Andric * Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the 46490b57cec5SDimitry Andric * range. 46500b57cec5SDimitry Andric */ 46510b57cec5SDimitry Andric CXNameRange_WantQualifier = 0x1, 46520b57cec5SDimitry Andric 46530b57cec5SDimitry Andric /** 46540b57cec5SDimitry Andric * Include the explicit template arguments, e.g. \<int> in x.f<int>, 46550b57cec5SDimitry Andric * in the range. 46560b57cec5SDimitry Andric */ 46570b57cec5SDimitry Andric CXNameRange_WantTemplateArgs = 0x2, 46580b57cec5SDimitry Andric 46590b57cec5SDimitry Andric /** 46600b57cec5SDimitry Andric * If the name is non-contiguous, return the full spanning range. 46610b57cec5SDimitry Andric * 46620b57cec5SDimitry Andric * Non-contiguous names occur in Objective-C when a selector with two or more 46630b57cec5SDimitry Andric * parameters is used, or in C++ when using an operator: 46640b57cec5SDimitry Andric * \code 46650b57cec5SDimitry Andric * [object doSomething:here withValue:there]; // Objective-C 46660b57cec5SDimitry Andric * return some_vector[1]; // C++ 46670b57cec5SDimitry Andric * \endcode 46680b57cec5SDimitry Andric */ 46690b57cec5SDimitry Andric CXNameRange_WantSinglePiece = 0x4 46700b57cec5SDimitry Andric }; 46710b57cec5SDimitry Andric 46720b57cec5SDimitry Andric /** 46730b57cec5SDimitry Andric * @} 46740b57cec5SDimitry Andric */ 46750b57cec5SDimitry Andric 46760b57cec5SDimitry Andric /** 46770b57cec5SDimitry Andric * \defgroup CINDEX_LEX Token extraction and manipulation 46780b57cec5SDimitry Andric * 46790b57cec5SDimitry Andric * The routines in this group provide access to the tokens within a 46800b57cec5SDimitry Andric * translation unit, along with a semantic mapping of those tokens to 46810b57cec5SDimitry Andric * their corresponding cursors. 46820b57cec5SDimitry Andric * 46830b57cec5SDimitry Andric * @{ 46840b57cec5SDimitry Andric */ 46850b57cec5SDimitry Andric 46860b57cec5SDimitry Andric /** 46870b57cec5SDimitry Andric * Describes a kind of token. 46880b57cec5SDimitry Andric */ 46890b57cec5SDimitry Andric typedef enum CXTokenKind { 46900b57cec5SDimitry Andric /** 46910b57cec5SDimitry Andric * A token that contains some kind of punctuation. 46920b57cec5SDimitry Andric */ 46930b57cec5SDimitry Andric CXToken_Punctuation, 46940b57cec5SDimitry Andric 46950b57cec5SDimitry Andric /** 46960b57cec5SDimitry Andric * A language keyword. 46970b57cec5SDimitry Andric */ 46980b57cec5SDimitry Andric CXToken_Keyword, 46990b57cec5SDimitry Andric 47000b57cec5SDimitry Andric /** 47010b57cec5SDimitry Andric * An identifier (that is not a keyword). 47020b57cec5SDimitry Andric */ 47030b57cec5SDimitry Andric CXToken_Identifier, 47040b57cec5SDimitry Andric 47050b57cec5SDimitry Andric /** 47060b57cec5SDimitry Andric * A numeric, string, or character literal. 47070b57cec5SDimitry Andric */ 47080b57cec5SDimitry Andric CXToken_Literal, 47090b57cec5SDimitry Andric 47100b57cec5SDimitry Andric /** 47110b57cec5SDimitry Andric * A comment. 47120b57cec5SDimitry Andric */ 47130b57cec5SDimitry Andric CXToken_Comment 47140b57cec5SDimitry Andric } CXTokenKind; 47150b57cec5SDimitry Andric 47160b57cec5SDimitry Andric /** 47170b57cec5SDimitry Andric * Describes a single preprocessing token. 47180b57cec5SDimitry Andric */ 47190b57cec5SDimitry Andric typedef struct { 47200b57cec5SDimitry Andric unsigned int_data[4]; 47210b57cec5SDimitry Andric void *ptr_data; 47220b57cec5SDimitry Andric } CXToken; 47230b57cec5SDimitry Andric 47240b57cec5SDimitry Andric /** 47250b57cec5SDimitry Andric * Get the raw lexical token starting with the given location. 47260b57cec5SDimitry Andric * 47270b57cec5SDimitry Andric * \param TU the translation unit whose text is being tokenized. 47280b57cec5SDimitry Andric * 47290b57cec5SDimitry Andric * \param Location the source location with which the token starts. 47300b57cec5SDimitry Andric * 47310b57cec5SDimitry Andric * \returns The token starting with the given location or NULL if no such token 47320b57cec5SDimitry Andric * exist. The returned pointer must be freed with clang_disposeTokens before the 47330b57cec5SDimitry Andric * translation unit is destroyed. 47340b57cec5SDimitry Andric */ 47350b57cec5SDimitry Andric CINDEX_LINKAGE CXToken *clang_getToken(CXTranslationUnit TU, 47360b57cec5SDimitry Andric CXSourceLocation Location); 47370b57cec5SDimitry Andric 47380b57cec5SDimitry Andric /** 47390b57cec5SDimitry Andric * Determine the kind of the given token. 47400b57cec5SDimitry Andric */ 47410b57cec5SDimitry Andric CINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken); 47420b57cec5SDimitry Andric 47430b57cec5SDimitry Andric /** 47440b57cec5SDimitry Andric * Determine the spelling of the given token. 47450b57cec5SDimitry Andric * 47460b57cec5SDimitry Andric * The spelling of a token is the textual representation of that token, e.g., 47470b57cec5SDimitry Andric * the text of an identifier or keyword. 47480b57cec5SDimitry Andric */ 47490b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken); 47500b57cec5SDimitry Andric 47510b57cec5SDimitry Andric /** 47520b57cec5SDimitry Andric * Retrieve the source location of the given token. 47530b57cec5SDimitry Andric */ 47540b57cec5SDimitry Andric CINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit, 47550b57cec5SDimitry Andric CXToken); 47560b57cec5SDimitry Andric 47570b57cec5SDimitry Andric /** 47580b57cec5SDimitry Andric * Retrieve a source range that covers the given token. 47590b57cec5SDimitry Andric */ 47600b57cec5SDimitry Andric CINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken); 47610b57cec5SDimitry Andric 47620b57cec5SDimitry Andric /** 47630b57cec5SDimitry Andric * Tokenize the source code described by the given range into raw 47640b57cec5SDimitry Andric * lexical tokens. 47650b57cec5SDimitry Andric * 47660b57cec5SDimitry Andric * \param TU the translation unit whose text is being tokenized. 47670b57cec5SDimitry Andric * 47680b57cec5SDimitry Andric * \param Range the source range in which text should be tokenized. All of the 47690b57cec5SDimitry Andric * tokens produced by tokenization will fall within this source range, 47700b57cec5SDimitry Andric * 47710b57cec5SDimitry Andric * \param Tokens this pointer will be set to point to the array of tokens 47720b57cec5SDimitry Andric * that occur within the given source range. The returned pointer must be 47730b57cec5SDimitry Andric * freed with clang_disposeTokens() before the translation unit is destroyed. 47740b57cec5SDimitry Andric * 47750b57cec5SDimitry Andric * \param NumTokens will be set to the number of tokens in the \c *Tokens 47760b57cec5SDimitry Andric * array. 47770b57cec5SDimitry Andric * 47780b57cec5SDimitry Andric */ 47790b57cec5SDimitry Andric CINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range, 47800b57cec5SDimitry Andric CXToken **Tokens, unsigned *NumTokens); 47810b57cec5SDimitry Andric 47820b57cec5SDimitry Andric /** 47830b57cec5SDimitry Andric * Annotate the given set of tokens by providing cursors for each token 47840b57cec5SDimitry Andric * that can be mapped to a specific entity within the abstract syntax tree. 47850b57cec5SDimitry Andric * 47860b57cec5SDimitry Andric * This token-annotation routine is equivalent to invoking 47870b57cec5SDimitry Andric * clang_getCursor() for the source locations of each of the 47880b57cec5SDimitry Andric * tokens. The cursors provided are filtered, so that only those 47890b57cec5SDimitry Andric * cursors that have a direct correspondence to the token are 47900b57cec5SDimitry Andric * accepted. For example, given a function call \c f(x), 47910b57cec5SDimitry Andric * clang_getCursor() would provide the following cursors: 47920b57cec5SDimitry Andric * 47930b57cec5SDimitry Andric * * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'. 47940b57cec5SDimitry Andric * * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'. 47950b57cec5SDimitry Andric * * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'. 47960b57cec5SDimitry Andric * 47970b57cec5SDimitry Andric * Only the first and last of these cursors will occur within the 47980b57cec5SDimitry Andric * annotate, since the tokens "f" and "x' directly refer to a function 47990b57cec5SDimitry Andric * and a variable, respectively, but the parentheses are just a small 48000b57cec5SDimitry Andric * part of the full syntax of the function call expression, which is 48010b57cec5SDimitry Andric * not provided as an annotation. 48020b57cec5SDimitry Andric * 48030b57cec5SDimitry Andric * \param TU the translation unit that owns the given tokens. 48040b57cec5SDimitry Andric * 48050b57cec5SDimitry Andric * \param Tokens the set of tokens to annotate. 48060b57cec5SDimitry Andric * 48070b57cec5SDimitry Andric * \param NumTokens the number of tokens in \p Tokens. 48080b57cec5SDimitry Andric * 48090b57cec5SDimitry Andric * \param Cursors an array of \p NumTokens cursors, whose contents will be 48100b57cec5SDimitry Andric * replaced with the cursors corresponding to each token. 48110b57cec5SDimitry Andric */ 48125ffd83dbSDimitry Andric CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU, CXToken *Tokens, 48135ffd83dbSDimitry Andric unsigned NumTokens, CXCursor *Cursors); 48140b57cec5SDimitry Andric 48150b57cec5SDimitry Andric /** 48160b57cec5SDimitry Andric * Free the given set of tokens. 48170b57cec5SDimitry Andric */ 48185ffd83dbSDimitry Andric CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU, CXToken *Tokens, 48195ffd83dbSDimitry Andric unsigned NumTokens); 48200b57cec5SDimitry Andric 48210b57cec5SDimitry Andric /** 48220b57cec5SDimitry Andric * @} 48230b57cec5SDimitry Andric */ 48240b57cec5SDimitry Andric 48250b57cec5SDimitry Andric /** 48260b57cec5SDimitry Andric * \defgroup CINDEX_DEBUG Debugging facilities 48270b57cec5SDimitry Andric * 48280b57cec5SDimitry Andric * These routines are used for testing and debugging, only, and should not 48290b57cec5SDimitry Andric * be relied upon. 48300b57cec5SDimitry Andric * 48310b57cec5SDimitry Andric * @{ 48320b57cec5SDimitry Andric */ 48330b57cec5SDimitry Andric 48340b57cec5SDimitry Andric /* for debug/testing */ 48350b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind); 48365ffd83dbSDimitry Andric CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent( 48375ffd83dbSDimitry Andric CXCursor, const char **startBuf, const char **endBuf, unsigned *startLine, 48385ffd83dbSDimitry Andric unsigned *startColumn, unsigned *endLine, unsigned *endColumn); 48390b57cec5SDimitry Andric CINDEX_LINKAGE void clang_enableStackTraces(void); 48400b57cec5SDimitry Andric CINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void *), void *user_data, 48410b57cec5SDimitry Andric unsigned stack_size); 48420b57cec5SDimitry Andric 48430b57cec5SDimitry Andric /** 48440b57cec5SDimitry Andric * @} 48450b57cec5SDimitry Andric */ 48460b57cec5SDimitry Andric 48470b57cec5SDimitry Andric /** 48480b57cec5SDimitry Andric * \defgroup CINDEX_CODE_COMPLET Code completion 48490b57cec5SDimitry Andric * 48500b57cec5SDimitry Andric * Code completion involves taking an (incomplete) source file, along with 48510b57cec5SDimitry Andric * knowledge of where the user is actively editing that file, and suggesting 48520b57cec5SDimitry Andric * syntactically- and semantically-valid constructs that the user might want to 48530b57cec5SDimitry Andric * use at that particular point in the source code. These data structures and 48540b57cec5SDimitry Andric * routines provide support for code completion. 48550b57cec5SDimitry Andric * 48560b57cec5SDimitry Andric * @{ 48570b57cec5SDimitry Andric */ 48580b57cec5SDimitry Andric 48590b57cec5SDimitry Andric /** 48600b57cec5SDimitry Andric * A semantic string that describes a code-completion result. 48610b57cec5SDimitry Andric * 48620b57cec5SDimitry Andric * A semantic string that describes the formatting of a code-completion 48630b57cec5SDimitry Andric * result as a single "template" of text that should be inserted into the 48640b57cec5SDimitry Andric * source buffer when a particular code-completion result is selected. 48650b57cec5SDimitry Andric * Each semantic string is made up of some number of "chunks", each of which 48660b57cec5SDimitry Andric * contains some text along with a description of what that text means, e.g., 48670b57cec5SDimitry Andric * the name of the entity being referenced, whether the text chunk is part of 48680b57cec5SDimitry Andric * the template, or whether it is a "placeholder" that the user should replace 48690b57cec5SDimitry Andric * with actual code,of a specific kind. See \c CXCompletionChunkKind for a 48700b57cec5SDimitry Andric * description of the different kinds of chunks. 48710b57cec5SDimitry Andric */ 48720b57cec5SDimitry Andric typedef void *CXCompletionString; 48730b57cec5SDimitry Andric 48740b57cec5SDimitry Andric /** 48750b57cec5SDimitry Andric * A single result of code completion. 48760b57cec5SDimitry Andric */ 48770b57cec5SDimitry Andric typedef struct { 48780b57cec5SDimitry Andric /** 48790b57cec5SDimitry Andric * The kind of entity that this completion refers to. 48800b57cec5SDimitry Andric * 48810b57cec5SDimitry Andric * The cursor kind will be a macro, keyword, or a declaration (one of the 48820b57cec5SDimitry Andric * *Decl cursor kinds), describing the entity that the completion is 48830b57cec5SDimitry Andric * referring to. 48840b57cec5SDimitry Andric * 48850b57cec5SDimitry Andric * \todo In the future, we would like to provide a full cursor, to allow 48860b57cec5SDimitry Andric * the client to extract additional information from declaration. 48870b57cec5SDimitry Andric */ 48880b57cec5SDimitry Andric enum CXCursorKind CursorKind; 48890b57cec5SDimitry Andric 48900b57cec5SDimitry Andric /** 48910b57cec5SDimitry Andric * The code-completion string that describes how to insert this 48920b57cec5SDimitry Andric * code-completion result into the editing buffer. 48930b57cec5SDimitry Andric */ 48940b57cec5SDimitry Andric CXCompletionString CompletionString; 48950b57cec5SDimitry Andric } CXCompletionResult; 48960b57cec5SDimitry Andric 48970b57cec5SDimitry Andric /** 48980b57cec5SDimitry Andric * Describes a single piece of text within a code-completion string. 48990b57cec5SDimitry Andric * 49000b57cec5SDimitry Andric * Each "chunk" within a code-completion string (\c CXCompletionString) is 49010b57cec5SDimitry Andric * either a piece of text with a specific "kind" that describes how that text 49020b57cec5SDimitry Andric * should be interpreted by the client or is another completion string. 49030b57cec5SDimitry Andric */ 49040b57cec5SDimitry Andric enum CXCompletionChunkKind { 49050b57cec5SDimitry Andric /** 49060b57cec5SDimitry Andric * A code-completion string that describes "optional" text that 49070b57cec5SDimitry Andric * could be a part of the template (but is not required). 49080b57cec5SDimitry Andric * 49090b57cec5SDimitry Andric * The Optional chunk is the only kind of chunk that has a code-completion 49100b57cec5SDimitry Andric * string for its representation, which is accessible via 49110b57cec5SDimitry Andric * \c clang_getCompletionChunkCompletionString(). The code-completion string 49120b57cec5SDimitry Andric * describes an additional part of the template that is completely optional. 49130b57cec5SDimitry Andric * For example, optional chunks can be used to describe the placeholders for 49140b57cec5SDimitry Andric * arguments that match up with defaulted function parameters, e.g. given: 49150b57cec5SDimitry Andric * 49160b57cec5SDimitry Andric * \code 49170b57cec5SDimitry Andric * void f(int x, float y = 3.14, double z = 2.71828); 49180b57cec5SDimitry Andric * \endcode 49190b57cec5SDimitry Andric * 49200b57cec5SDimitry Andric * The code-completion string for this function would contain: 49210b57cec5SDimitry Andric * - a TypedText chunk for "f". 49220b57cec5SDimitry Andric * - a LeftParen chunk for "(". 49230b57cec5SDimitry Andric * - a Placeholder chunk for "int x" 49240b57cec5SDimitry Andric * - an Optional chunk containing the remaining defaulted arguments, e.g., 49250b57cec5SDimitry Andric * - a Comma chunk for "," 49260b57cec5SDimitry Andric * - a Placeholder chunk for "float y" 49270b57cec5SDimitry Andric * - an Optional chunk containing the last defaulted argument: 49280b57cec5SDimitry Andric * - a Comma chunk for "," 49290b57cec5SDimitry Andric * - a Placeholder chunk for "double z" 49300b57cec5SDimitry Andric * - a RightParen chunk for ")" 49310b57cec5SDimitry Andric * 49320b57cec5SDimitry Andric * There are many ways to handle Optional chunks. Two simple approaches are: 49330b57cec5SDimitry Andric * - Completely ignore optional chunks, in which case the template for the 49340b57cec5SDimitry Andric * function "f" would only include the first parameter ("int x"). 49350b57cec5SDimitry Andric * - Fully expand all optional chunks, in which case the template for the 49360b57cec5SDimitry Andric * function "f" would have all of the parameters. 49370b57cec5SDimitry Andric */ 49380b57cec5SDimitry Andric CXCompletionChunk_Optional, 49390b57cec5SDimitry Andric /** 49400b57cec5SDimitry Andric * Text that a user would be expected to type to get this 49410b57cec5SDimitry Andric * code-completion result. 49420b57cec5SDimitry Andric * 49430b57cec5SDimitry Andric * There will be exactly one "typed text" chunk in a semantic string, which 49440b57cec5SDimitry Andric * will typically provide the spelling of a keyword or the name of a 49450b57cec5SDimitry Andric * declaration that could be used at the current code point. Clients are 49460b57cec5SDimitry Andric * expected to filter the code-completion results based on the text in this 49470b57cec5SDimitry Andric * chunk. 49480b57cec5SDimitry Andric */ 49490b57cec5SDimitry Andric CXCompletionChunk_TypedText, 49500b57cec5SDimitry Andric /** 49510b57cec5SDimitry Andric * Text that should be inserted as part of a code-completion result. 49520b57cec5SDimitry Andric * 49530b57cec5SDimitry Andric * A "text" chunk represents text that is part of the template to be 49540b57cec5SDimitry Andric * inserted into user code should this particular code-completion result 49550b57cec5SDimitry Andric * be selected. 49560b57cec5SDimitry Andric */ 49570b57cec5SDimitry Andric CXCompletionChunk_Text, 49580b57cec5SDimitry Andric /** 49590b57cec5SDimitry Andric * Placeholder text that should be replaced by the user. 49600b57cec5SDimitry Andric * 49610b57cec5SDimitry Andric * A "placeholder" chunk marks a place where the user should insert text 49620b57cec5SDimitry Andric * into the code-completion template. For example, placeholders might mark 49630b57cec5SDimitry Andric * the function parameters for a function declaration, to indicate that the 49640b57cec5SDimitry Andric * user should provide arguments for each of those parameters. The actual 49650b57cec5SDimitry Andric * text in a placeholder is a suggestion for the text to display before 49660b57cec5SDimitry Andric * the user replaces the placeholder with real code. 49670b57cec5SDimitry Andric */ 49680b57cec5SDimitry Andric CXCompletionChunk_Placeholder, 49690b57cec5SDimitry Andric /** 49700b57cec5SDimitry Andric * Informative text that should be displayed but never inserted as 49710b57cec5SDimitry Andric * part of the template. 49720b57cec5SDimitry Andric * 49730b57cec5SDimitry Andric * An "informative" chunk contains annotations that can be displayed to 49740b57cec5SDimitry Andric * help the user decide whether a particular code-completion result is the 49750b57cec5SDimitry Andric * right option, but which is not part of the actual template to be inserted 49760b57cec5SDimitry Andric * by code completion. 49770b57cec5SDimitry Andric */ 49780b57cec5SDimitry Andric CXCompletionChunk_Informative, 49790b57cec5SDimitry Andric /** 49800b57cec5SDimitry Andric * Text that describes the current parameter when code-completion is 49810b57cec5SDimitry Andric * referring to function call, message send, or template specialization. 49820b57cec5SDimitry Andric * 49830b57cec5SDimitry Andric * A "current parameter" chunk occurs when code-completion is providing 49840b57cec5SDimitry Andric * information about a parameter corresponding to the argument at the 49850b57cec5SDimitry Andric * code-completion point. For example, given a function 49860b57cec5SDimitry Andric * 49870b57cec5SDimitry Andric * \code 49880b57cec5SDimitry Andric * int add(int x, int y); 49890b57cec5SDimitry Andric * \endcode 49900b57cec5SDimitry Andric * 49910b57cec5SDimitry Andric * and the source code \c add(, where the code-completion point is after the 49920b57cec5SDimitry Andric * "(", the code-completion string will contain a "current parameter" chunk 49930b57cec5SDimitry Andric * for "int x", indicating that the current argument will initialize that 49940b57cec5SDimitry Andric * parameter. After typing further, to \c add(17, (where the code-completion 49950b57cec5SDimitry Andric * point is after the ","), the code-completion string will contain a 49960b57cec5SDimitry Andric * "current parameter" chunk to "int y". 49970b57cec5SDimitry Andric */ 49980b57cec5SDimitry Andric CXCompletionChunk_CurrentParameter, 49990b57cec5SDimitry Andric /** 50000b57cec5SDimitry Andric * A left parenthesis ('('), used to initiate a function call or 50010b57cec5SDimitry Andric * signal the beginning of a function parameter list. 50020b57cec5SDimitry Andric */ 50030b57cec5SDimitry Andric CXCompletionChunk_LeftParen, 50040b57cec5SDimitry Andric /** 50050b57cec5SDimitry Andric * A right parenthesis (')'), used to finish a function call or 50060b57cec5SDimitry Andric * signal the end of a function parameter list. 50070b57cec5SDimitry Andric */ 50080b57cec5SDimitry Andric CXCompletionChunk_RightParen, 50090b57cec5SDimitry Andric /** 50100b57cec5SDimitry Andric * A left bracket ('['). 50110b57cec5SDimitry Andric */ 50120b57cec5SDimitry Andric CXCompletionChunk_LeftBracket, 50130b57cec5SDimitry Andric /** 50140b57cec5SDimitry Andric * A right bracket (']'). 50150b57cec5SDimitry Andric */ 50160b57cec5SDimitry Andric CXCompletionChunk_RightBracket, 50170b57cec5SDimitry Andric /** 50180b57cec5SDimitry Andric * A left brace ('{'). 50190b57cec5SDimitry Andric */ 50200b57cec5SDimitry Andric CXCompletionChunk_LeftBrace, 50210b57cec5SDimitry Andric /** 50220b57cec5SDimitry Andric * A right brace ('}'). 50230b57cec5SDimitry Andric */ 50240b57cec5SDimitry Andric CXCompletionChunk_RightBrace, 50250b57cec5SDimitry Andric /** 50260b57cec5SDimitry Andric * A left angle bracket ('<'). 50270b57cec5SDimitry Andric */ 50280b57cec5SDimitry Andric CXCompletionChunk_LeftAngle, 50290b57cec5SDimitry Andric /** 50300b57cec5SDimitry Andric * A right angle bracket ('>'). 50310b57cec5SDimitry Andric */ 50320b57cec5SDimitry Andric CXCompletionChunk_RightAngle, 50330b57cec5SDimitry Andric /** 50340b57cec5SDimitry Andric * A comma separator (','). 50350b57cec5SDimitry Andric */ 50360b57cec5SDimitry Andric CXCompletionChunk_Comma, 50370b57cec5SDimitry Andric /** 50380b57cec5SDimitry Andric * Text that specifies the result type of a given result. 50390b57cec5SDimitry Andric * 50400b57cec5SDimitry Andric * This special kind of informative chunk is not meant to be inserted into 50410b57cec5SDimitry Andric * the text buffer. Rather, it is meant to illustrate the type that an 50420b57cec5SDimitry Andric * expression using the given completion string would have. 50430b57cec5SDimitry Andric */ 50440b57cec5SDimitry Andric CXCompletionChunk_ResultType, 50450b57cec5SDimitry Andric /** 50460b57cec5SDimitry Andric * A colon (':'). 50470b57cec5SDimitry Andric */ 50480b57cec5SDimitry Andric CXCompletionChunk_Colon, 50490b57cec5SDimitry Andric /** 50500b57cec5SDimitry Andric * A semicolon (';'). 50510b57cec5SDimitry Andric */ 50520b57cec5SDimitry Andric CXCompletionChunk_SemiColon, 50530b57cec5SDimitry Andric /** 50540b57cec5SDimitry Andric * An '=' sign. 50550b57cec5SDimitry Andric */ 50560b57cec5SDimitry Andric CXCompletionChunk_Equal, 50570b57cec5SDimitry Andric /** 50580b57cec5SDimitry Andric * Horizontal space (' '). 50590b57cec5SDimitry Andric */ 50600b57cec5SDimitry Andric CXCompletionChunk_HorizontalSpace, 50610b57cec5SDimitry Andric /** 50620b57cec5SDimitry Andric * Vertical space ('\\n'), after which it is generally a good idea to 50630b57cec5SDimitry Andric * perform indentation. 50640b57cec5SDimitry Andric */ 50650b57cec5SDimitry Andric CXCompletionChunk_VerticalSpace 50660b57cec5SDimitry Andric }; 50670b57cec5SDimitry Andric 50680b57cec5SDimitry Andric /** 50690b57cec5SDimitry Andric * Determine the kind of a particular chunk within a completion string. 50700b57cec5SDimitry Andric * 50710b57cec5SDimitry Andric * \param completion_string the completion string to query. 50720b57cec5SDimitry Andric * 50730b57cec5SDimitry Andric * \param chunk_number the 0-based index of the chunk in the completion string. 50740b57cec5SDimitry Andric * 50750b57cec5SDimitry Andric * \returns the kind of the chunk at the index \c chunk_number. 50760b57cec5SDimitry Andric */ 50770b57cec5SDimitry Andric CINDEX_LINKAGE enum CXCompletionChunkKind 50780b57cec5SDimitry Andric clang_getCompletionChunkKind(CXCompletionString completion_string, 50790b57cec5SDimitry Andric unsigned chunk_number); 50800b57cec5SDimitry Andric 50810b57cec5SDimitry Andric /** 50820b57cec5SDimitry Andric * Retrieve the text associated with a particular chunk within a 50830b57cec5SDimitry Andric * completion string. 50840b57cec5SDimitry Andric * 50850b57cec5SDimitry Andric * \param completion_string the completion string to query. 50860b57cec5SDimitry Andric * 50870b57cec5SDimitry Andric * \param chunk_number the 0-based index of the chunk in the completion string. 50880b57cec5SDimitry Andric * 50890b57cec5SDimitry Andric * \returns the text associated with the chunk at index \c chunk_number. 50900b57cec5SDimitry Andric */ 50915ffd83dbSDimitry Andric CINDEX_LINKAGE CXString clang_getCompletionChunkText( 50925ffd83dbSDimitry Andric CXCompletionString completion_string, unsigned chunk_number); 50930b57cec5SDimitry Andric 50940b57cec5SDimitry Andric /** 50950b57cec5SDimitry Andric * Retrieve the completion string associated with a particular chunk 50960b57cec5SDimitry Andric * within a completion string. 50970b57cec5SDimitry Andric * 50980b57cec5SDimitry Andric * \param completion_string the completion string to query. 50990b57cec5SDimitry Andric * 51000b57cec5SDimitry Andric * \param chunk_number the 0-based index of the chunk in the completion string. 51010b57cec5SDimitry Andric * 51020b57cec5SDimitry Andric * \returns the completion string associated with the chunk at index 51030b57cec5SDimitry Andric * \c chunk_number. 51040b57cec5SDimitry Andric */ 51055ffd83dbSDimitry Andric CINDEX_LINKAGE CXCompletionString clang_getCompletionChunkCompletionString( 51065ffd83dbSDimitry Andric CXCompletionString completion_string, unsigned chunk_number); 51070b57cec5SDimitry Andric 51080b57cec5SDimitry Andric /** 51090b57cec5SDimitry Andric * Retrieve the number of chunks in the given code-completion string. 51100b57cec5SDimitry Andric */ 51110b57cec5SDimitry Andric CINDEX_LINKAGE unsigned 51120b57cec5SDimitry Andric clang_getNumCompletionChunks(CXCompletionString completion_string); 51130b57cec5SDimitry Andric 51140b57cec5SDimitry Andric /** 51150b57cec5SDimitry Andric * Determine the priority of this code completion. 51160b57cec5SDimitry Andric * 51170b57cec5SDimitry Andric * The priority of a code completion indicates how likely it is that this 51180b57cec5SDimitry Andric * particular completion is the completion that the user will select. The 51190b57cec5SDimitry Andric * priority is selected by various internal heuristics. 51200b57cec5SDimitry Andric * 51210b57cec5SDimitry Andric * \param completion_string The completion string to query. 51220b57cec5SDimitry Andric * 51230b57cec5SDimitry Andric * \returns The priority of this completion string. Smaller values indicate 51240b57cec5SDimitry Andric * higher-priority (more likely) completions. 51250b57cec5SDimitry Andric */ 51260b57cec5SDimitry Andric CINDEX_LINKAGE unsigned 51270b57cec5SDimitry Andric clang_getCompletionPriority(CXCompletionString completion_string); 51280b57cec5SDimitry Andric 51290b57cec5SDimitry Andric /** 51300b57cec5SDimitry Andric * Determine the availability of the entity that this code-completion 51310b57cec5SDimitry Andric * string refers to. 51320b57cec5SDimitry Andric * 51330b57cec5SDimitry Andric * \param completion_string The completion string to query. 51340b57cec5SDimitry Andric * 51350b57cec5SDimitry Andric * \returns The availability of the completion string. 51360b57cec5SDimitry Andric */ 51370b57cec5SDimitry Andric CINDEX_LINKAGE enum CXAvailabilityKind 51380b57cec5SDimitry Andric clang_getCompletionAvailability(CXCompletionString completion_string); 51390b57cec5SDimitry Andric 51400b57cec5SDimitry Andric /** 51410b57cec5SDimitry Andric * Retrieve the number of annotations associated with the given 51420b57cec5SDimitry Andric * completion string. 51430b57cec5SDimitry Andric * 51440b57cec5SDimitry Andric * \param completion_string the completion string to query. 51450b57cec5SDimitry Andric * 51460b57cec5SDimitry Andric * \returns the number of annotations associated with the given completion 51470b57cec5SDimitry Andric * string. 51480b57cec5SDimitry Andric */ 51490b57cec5SDimitry Andric CINDEX_LINKAGE unsigned 51500b57cec5SDimitry Andric clang_getCompletionNumAnnotations(CXCompletionString completion_string); 51510b57cec5SDimitry Andric 51520b57cec5SDimitry Andric /** 51530b57cec5SDimitry Andric * Retrieve the annotation associated with the given completion string. 51540b57cec5SDimitry Andric * 51550b57cec5SDimitry Andric * \param completion_string the completion string to query. 51560b57cec5SDimitry Andric * 51570b57cec5SDimitry Andric * \param annotation_number the 0-based index of the annotation of the 51580b57cec5SDimitry Andric * completion string. 51590b57cec5SDimitry Andric * 51600b57cec5SDimitry Andric * \returns annotation string associated with the completion at index 51610b57cec5SDimitry Andric * \c annotation_number, or a NULL string if that annotation is not available. 51620b57cec5SDimitry Andric */ 51635ffd83dbSDimitry Andric CINDEX_LINKAGE CXString clang_getCompletionAnnotation( 51645ffd83dbSDimitry Andric CXCompletionString completion_string, unsigned annotation_number); 51650b57cec5SDimitry Andric 51660b57cec5SDimitry Andric /** 51670b57cec5SDimitry Andric * Retrieve the parent context of the given completion string. 51680b57cec5SDimitry Andric * 51690b57cec5SDimitry Andric * The parent context of a completion string is the semantic parent of 51700b57cec5SDimitry Andric * the declaration (if any) that the code completion represents. For example, 51710b57cec5SDimitry Andric * a code completion for an Objective-C method would have the method's class 51720b57cec5SDimitry Andric * or protocol as its context. 51730b57cec5SDimitry Andric * 51740b57cec5SDimitry Andric * \param completion_string The code completion string whose parent is 51750b57cec5SDimitry Andric * being queried. 51760b57cec5SDimitry Andric * 51770b57cec5SDimitry Andric * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL. 51780b57cec5SDimitry Andric * 51790b57cec5SDimitry Andric * \returns The name of the completion parent, e.g., "NSObject" if 51800b57cec5SDimitry Andric * the completion string represents a method in the NSObject class. 51810b57cec5SDimitry Andric */ 51825ffd83dbSDimitry Andric CINDEX_LINKAGE CXString clang_getCompletionParent( 51835ffd83dbSDimitry Andric CXCompletionString completion_string, enum CXCursorKind *kind); 51840b57cec5SDimitry Andric 51850b57cec5SDimitry Andric /** 51860b57cec5SDimitry Andric * Retrieve the brief documentation comment attached to the declaration 51870b57cec5SDimitry Andric * that corresponds to the given completion string. 51880b57cec5SDimitry Andric */ 51890b57cec5SDimitry Andric CINDEX_LINKAGE CXString 51900b57cec5SDimitry Andric clang_getCompletionBriefComment(CXCompletionString completion_string); 51910b57cec5SDimitry Andric 51920b57cec5SDimitry Andric /** 51930b57cec5SDimitry Andric * Retrieve a completion string for an arbitrary declaration or macro 51940b57cec5SDimitry Andric * definition cursor. 51950b57cec5SDimitry Andric * 51960b57cec5SDimitry Andric * \param cursor The cursor to query. 51970b57cec5SDimitry Andric * 51980b57cec5SDimitry Andric * \returns A non-context-sensitive completion string for declaration and macro 51990b57cec5SDimitry Andric * definition cursors, or NULL for other kinds of cursors. 52000b57cec5SDimitry Andric */ 52010b57cec5SDimitry Andric CINDEX_LINKAGE CXCompletionString 52020b57cec5SDimitry Andric clang_getCursorCompletionString(CXCursor cursor); 52030b57cec5SDimitry Andric 52040b57cec5SDimitry Andric /** 52050b57cec5SDimitry Andric * Contains the results of code-completion. 52060b57cec5SDimitry Andric * 52070b57cec5SDimitry Andric * This data structure contains the results of code completion, as 52080b57cec5SDimitry Andric * produced by \c clang_codeCompleteAt(). Its contents must be freed by 52090b57cec5SDimitry Andric * \c clang_disposeCodeCompleteResults. 52100b57cec5SDimitry Andric */ 52110b57cec5SDimitry Andric typedef struct { 52120b57cec5SDimitry Andric /** 52130b57cec5SDimitry Andric * The code-completion results. 52140b57cec5SDimitry Andric */ 52150b57cec5SDimitry Andric CXCompletionResult *Results; 52160b57cec5SDimitry Andric 52170b57cec5SDimitry Andric /** 52180b57cec5SDimitry Andric * The number of code-completion results stored in the 52190b57cec5SDimitry Andric * \c Results array. 52200b57cec5SDimitry Andric */ 52210b57cec5SDimitry Andric unsigned NumResults; 52220b57cec5SDimitry Andric } CXCodeCompleteResults; 52230b57cec5SDimitry Andric 52240b57cec5SDimitry Andric /** 52250b57cec5SDimitry Andric * Retrieve the number of fix-its for the given completion index. 52260b57cec5SDimitry Andric * 52270b57cec5SDimitry Andric * Calling this makes sense only if CXCodeComplete_IncludeCompletionsWithFixIts 52280b57cec5SDimitry Andric * option was set. 52290b57cec5SDimitry Andric * 52300b57cec5SDimitry Andric * \param results The structure keeping all completion results 52310b57cec5SDimitry Andric * 52320b57cec5SDimitry Andric * \param completion_index The index of the completion 52330b57cec5SDimitry Andric * 52340b57cec5SDimitry Andric * \return The number of fix-its which must be applied before the completion at 52350b57cec5SDimitry Andric * completion_index can be applied 52360b57cec5SDimitry Andric */ 52370b57cec5SDimitry Andric CINDEX_LINKAGE unsigned 52380b57cec5SDimitry Andric clang_getCompletionNumFixIts(CXCodeCompleteResults *results, 52390b57cec5SDimitry Andric unsigned completion_index); 52400b57cec5SDimitry Andric 52410b57cec5SDimitry Andric /** 52420b57cec5SDimitry Andric * Fix-its that *must* be applied before inserting the text for the 52430b57cec5SDimitry Andric * corresponding completion. 52440b57cec5SDimitry Andric * 52450b57cec5SDimitry Andric * By default, clang_codeCompleteAt() only returns completions with empty 52460b57cec5SDimitry Andric * fix-its. Extra completions with non-empty fix-its should be explicitly 52470b57cec5SDimitry Andric * requested by setting CXCodeComplete_IncludeCompletionsWithFixIts. 52480b57cec5SDimitry Andric * 52490b57cec5SDimitry Andric * For the clients to be able to compute position of the cursor after applying 52500b57cec5SDimitry Andric * fix-its, the following conditions are guaranteed to hold for 52510b57cec5SDimitry Andric * replacement_range of the stored fix-its: 52520b57cec5SDimitry Andric * - Ranges in the fix-its are guaranteed to never contain the completion 52530b57cec5SDimitry Andric * point (or identifier under completion point, if any) inside them, except 52540b57cec5SDimitry Andric * at the start or at the end of the range. 52550b57cec5SDimitry Andric * - If a fix-it range starts or ends with completion point (or starts or 52560b57cec5SDimitry Andric * ends after the identifier under completion point), it will contain at 52570b57cec5SDimitry Andric * least one character. It allows to unambiguously recompute completion 52580b57cec5SDimitry Andric * point after applying the fix-it. 52590b57cec5SDimitry Andric * 52600b57cec5SDimitry Andric * The intuition is that provided fix-its change code around the identifier we 52610b57cec5SDimitry Andric * complete, but are not allowed to touch the identifier itself or the 52620b57cec5SDimitry Andric * completion point. One example of completions with corrections are the ones 52630b57cec5SDimitry Andric * replacing '.' with '->' and vice versa: 52640b57cec5SDimitry Andric * 52650b57cec5SDimitry Andric * std::unique_ptr<std::vector<int>> vec_ptr; 52660b57cec5SDimitry Andric * In 'vec_ptr.^', one of the completions is 'push_back', it requires 52670b57cec5SDimitry Andric * replacing '.' with '->'. 52680b57cec5SDimitry Andric * In 'vec_ptr->^', one of the completions is 'release', it requires 52690b57cec5SDimitry Andric * replacing '->' with '.'. 52700b57cec5SDimitry Andric * 52710b57cec5SDimitry Andric * \param results The structure keeping all completion results 52720b57cec5SDimitry Andric * 52730b57cec5SDimitry Andric * \param completion_index The index of the completion 52740b57cec5SDimitry Andric * 52750b57cec5SDimitry Andric * \param fixit_index The index of the fix-it for the completion at 52760b57cec5SDimitry Andric * completion_index 52770b57cec5SDimitry Andric * 52780b57cec5SDimitry Andric * \param replacement_range The fix-it range that must be replaced before the 52790b57cec5SDimitry Andric * completion at completion_index can be applied 52800b57cec5SDimitry Andric * 52810b57cec5SDimitry Andric * \returns The fix-it string that must replace the code at replacement_range 52820b57cec5SDimitry Andric * before the completion at completion_index can be applied 52830b57cec5SDimitry Andric */ 52840b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getCompletionFixIt( 52850b57cec5SDimitry Andric CXCodeCompleteResults *results, unsigned completion_index, 52860b57cec5SDimitry Andric unsigned fixit_index, CXSourceRange *replacement_range); 52870b57cec5SDimitry Andric 52880b57cec5SDimitry Andric /** 52890b57cec5SDimitry Andric * Flags that can be passed to \c clang_codeCompleteAt() to 52900b57cec5SDimitry Andric * modify its behavior. 52910b57cec5SDimitry Andric * 52920b57cec5SDimitry Andric * The enumerators in this enumeration can be bitwise-OR'd together to 52930b57cec5SDimitry Andric * provide multiple options to \c clang_codeCompleteAt(). 52940b57cec5SDimitry Andric */ 52950b57cec5SDimitry Andric enum CXCodeComplete_Flags { 52960b57cec5SDimitry Andric /** 52970b57cec5SDimitry Andric * Whether to include macros within the set of code 52980b57cec5SDimitry Andric * completions returned. 52990b57cec5SDimitry Andric */ 53000b57cec5SDimitry Andric CXCodeComplete_IncludeMacros = 0x01, 53010b57cec5SDimitry Andric 53020b57cec5SDimitry Andric /** 53030b57cec5SDimitry Andric * Whether to include code patterns for language constructs 53040b57cec5SDimitry Andric * within the set of code completions, e.g., for loops. 53050b57cec5SDimitry Andric */ 53060b57cec5SDimitry Andric CXCodeComplete_IncludeCodePatterns = 0x02, 53070b57cec5SDimitry Andric 53080b57cec5SDimitry Andric /** 53090b57cec5SDimitry Andric * Whether to include brief documentation within the set of code 53100b57cec5SDimitry Andric * completions returned. 53110b57cec5SDimitry Andric */ 53120b57cec5SDimitry Andric CXCodeComplete_IncludeBriefComments = 0x04, 53130b57cec5SDimitry Andric 53140b57cec5SDimitry Andric /** 53150b57cec5SDimitry Andric * Whether to speed up completion by omitting top- or namespace-level entities 53160b57cec5SDimitry Andric * defined in the preamble. There's no guarantee any particular entity is 53170b57cec5SDimitry Andric * omitted. This may be useful if the headers are indexed externally. 53180b57cec5SDimitry Andric */ 53190b57cec5SDimitry Andric CXCodeComplete_SkipPreamble = 0x08, 53200b57cec5SDimitry Andric 53210b57cec5SDimitry Andric /** 53220b57cec5SDimitry Andric * Whether to include completions with small 53230b57cec5SDimitry Andric * fix-its, e.g. change '.' to '->' on member access, etc. 53240b57cec5SDimitry Andric */ 53250b57cec5SDimitry Andric CXCodeComplete_IncludeCompletionsWithFixIts = 0x10 53260b57cec5SDimitry Andric }; 53270b57cec5SDimitry Andric 53280b57cec5SDimitry Andric /** 53290b57cec5SDimitry Andric * Bits that represent the context under which completion is occurring. 53300b57cec5SDimitry Andric * 53310b57cec5SDimitry Andric * The enumerators in this enumeration may be bitwise-OR'd together if multiple 53320b57cec5SDimitry Andric * contexts are occurring simultaneously. 53330b57cec5SDimitry Andric */ 53340b57cec5SDimitry Andric enum CXCompletionContext { 53350b57cec5SDimitry Andric /** 53360b57cec5SDimitry Andric * The context for completions is unexposed, as only Clang results 53370b57cec5SDimitry Andric * should be included. (This is equivalent to having no context bits set.) 53380b57cec5SDimitry Andric */ 53390b57cec5SDimitry Andric CXCompletionContext_Unexposed = 0, 53400b57cec5SDimitry Andric 53410b57cec5SDimitry Andric /** 53420b57cec5SDimitry Andric * Completions for any possible type should be included in the results. 53430b57cec5SDimitry Andric */ 53440b57cec5SDimitry Andric CXCompletionContext_AnyType = 1 << 0, 53450b57cec5SDimitry Andric 53460b57cec5SDimitry Andric /** 53470b57cec5SDimitry Andric * Completions for any possible value (variables, function calls, etc.) 53480b57cec5SDimitry Andric * should be included in the results. 53490b57cec5SDimitry Andric */ 53500b57cec5SDimitry Andric CXCompletionContext_AnyValue = 1 << 1, 53510b57cec5SDimitry Andric /** 53520b57cec5SDimitry Andric * Completions for values that resolve to an Objective-C object should 53530b57cec5SDimitry Andric * be included in the results. 53540b57cec5SDimitry Andric */ 53550b57cec5SDimitry Andric CXCompletionContext_ObjCObjectValue = 1 << 2, 53560b57cec5SDimitry Andric /** 53570b57cec5SDimitry Andric * Completions for values that resolve to an Objective-C selector 53580b57cec5SDimitry Andric * should be included in the results. 53590b57cec5SDimitry Andric */ 53600b57cec5SDimitry Andric CXCompletionContext_ObjCSelectorValue = 1 << 3, 53610b57cec5SDimitry Andric /** 53620b57cec5SDimitry Andric * Completions for values that resolve to a C++ class type should be 53630b57cec5SDimitry Andric * included in the results. 53640b57cec5SDimitry Andric */ 53650b57cec5SDimitry Andric CXCompletionContext_CXXClassTypeValue = 1 << 4, 53660b57cec5SDimitry Andric 53670b57cec5SDimitry Andric /** 53680b57cec5SDimitry Andric * Completions for fields of the member being accessed using the dot 53690b57cec5SDimitry Andric * operator should be included in the results. 53700b57cec5SDimitry Andric */ 53710b57cec5SDimitry Andric CXCompletionContext_DotMemberAccess = 1 << 5, 53720b57cec5SDimitry Andric /** 53730b57cec5SDimitry Andric * Completions for fields of the member being accessed using the arrow 53740b57cec5SDimitry Andric * operator should be included in the results. 53750b57cec5SDimitry Andric */ 53760b57cec5SDimitry Andric CXCompletionContext_ArrowMemberAccess = 1 << 6, 53770b57cec5SDimitry Andric /** 53780b57cec5SDimitry Andric * Completions for properties of the Objective-C object being accessed 53790b57cec5SDimitry Andric * using the dot operator should be included in the results. 53800b57cec5SDimitry Andric */ 53810b57cec5SDimitry Andric CXCompletionContext_ObjCPropertyAccess = 1 << 7, 53820b57cec5SDimitry Andric 53830b57cec5SDimitry Andric /** 53840b57cec5SDimitry Andric * Completions for enum tags should be included in the results. 53850b57cec5SDimitry Andric */ 53860b57cec5SDimitry Andric CXCompletionContext_EnumTag = 1 << 8, 53870b57cec5SDimitry Andric /** 53880b57cec5SDimitry Andric * Completions for union tags should be included in the results. 53890b57cec5SDimitry Andric */ 53900b57cec5SDimitry Andric CXCompletionContext_UnionTag = 1 << 9, 53910b57cec5SDimitry Andric /** 53920b57cec5SDimitry Andric * Completions for struct tags should be included in the results. 53930b57cec5SDimitry Andric */ 53940b57cec5SDimitry Andric CXCompletionContext_StructTag = 1 << 10, 53950b57cec5SDimitry Andric 53960b57cec5SDimitry Andric /** 53970b57cec5SDimitry Andric * Completions for C++ class names should be included in the results. 53980b57cec5SDimitry Andric */ 53990b57cec5SDimitry Andric CXCompletionContext_ClassTag = 1 << 11, 54000b57cec5SDimitry Andric /** 54010b57cec5SDimitry Andric * Completions for C++ namespaces and namespace aliases should be 54020b57cec5SDimitry Andric * included in the results. 54030b57cec5SDimitry Andric */ 54040b57cec5SDimitry Andric CXCompletionContext_Namespace = 1 << 12, 54050b57cec5SDimitry Andric /** 54060b57cec5SDimitry Andric * Completions for C++ nested name specifiers should be included in 54070b57cec5SDimitry Andric * the results. 54080b57cec5SDimitry Andric */ 54090b57cec5SDimitry Andric CXCompletionContext_NestedNameSpecifier = 1 << 13, 54100b57cec5SDimitry Andric 54110b57cec5SDimitry Andric /** 54120b57cec5SDimitry Andric * Completions for Objective-C interfaces (classes) should be included 54130b57cec5SDimitry Andric * in the results. 54140b57cec5SDimitry Andric */ 54150b57cec5SDimitry Andric CXCompletionContext_ObjCInterface = 1 << 14, 54160b57cec5SDimitry Andric /** 54170b57cec5SDimitry Andric * Completions for Objective-C protocols should be included in 54180b57cec5SDimitry Andric * the results. 54190b57cec5SDimitry Andric */ 54200b57cec5SDimitry Andric CXCompletionContext_ObjCProtocol = 1 << 15, 54210b57cec5SDimitry Andric /** 54220b57cec5SDimitry Andric * Completions for Objective-C categories should be included in 54230b57cec5SDimitry Andric * the results. 54240b57cec5SDimitry Andric */ 54250b57cec5SDimitry Andric CXCompletionContext_ObjCCategory = 1 << 16, 54260b57cec5SDimitry Andric /** 54270b57cec5SDimitry Andric * Completions for Objective-C instance messages should be included 54280b57cec5SDimitry Andric * in the results. 54290b57cec5SDimitry Andric */ 54300b57cec5SDimitry Andric CXCompletionContext_ObjCInstanceMessage = 1 << 17, 54310b57cec5SDimitry Andric /** 54320b57cec5SDimitry Andric * Completions for Objective-C class messages should be included in 54330b57cec5SDimitry Andric * the results. 54340b57cec5SDimitry Andric */ 54350b57cec5SDimitry Andric CXCompletionContext_ObjCClassMessage = 1 << 18, 54360b57cec5SDimitry Andric /** 54370b57cec5SDimitry Andric * Completions for Objective-C selector names should be included in 54380b57cec5SDimitry Andric * the results. 54390b57cec5SDimitry Andric */ 54400b57cec5SDimitry Andric CXCompletionContext_ObjCSelectorName = 1 << 19, 54410b57cec5SDimitry Andric 54420b57cec5SDimitry Andric /** 54430b57cec5SDimitry Andric * Completions for preprocessor macro names should be included in 54440b57cec5SDimitry Andric * the results. 54450b57cec5SDimitry Andric */ 54460b57cec5SDimitry Andric CXCompletionContext_MacroName = 1 << 20, 54470b57cec5SDimitry Andric 54480b57cec5SDimitry Andric /** 54490b57cec5SDimitry Andric * Natural language completions should be included in the results. 54500b57cec5SDimitry Andric */ 54510b57cec5SDimitry Andric CXCompletionContext_NaturalLanguage = 1 << 21, 54520b57cec5SDimitry Andric 54530b57cec5SDimitry Andric /** 54540b57cec5SDimitry Andric * #include file completions should be included in the results. 54550b57cec5SDimitry Andric */ 54560b57cec5SDimitry Andric CXCompletionContext_IncludedFile = 1 << 22, 54570b57cec5SDimitry Andric 54580b57cec5SDimitry Andric /** 54590b57cec5SDimitry Andric * The current context is unknown, so set all contexts. 54600b57cec5SDimitry Andric */ 54610b57cec5SDimitry Andric CXCompletionContext_Unknown = ((1 << 23) - 1) 54620b57cec5SDimitry Andric }; 54630b57cec5SDimitry Andric 54640b57cec5SDimitry Andric /** 54650b57cec5SDimitry Andric * Returns a default set of code-completion options that can be 54660b57cec5SDimitry Andric * passed to\c clang_codeCompleteAt(). 54670b57cec5SDimitry Andric */ 54680b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void); 54690b57cec5SDimitry Andric 54700b57cec5SDimitry Andric /** 54710b57cec5SDimitry Andric * Perform code completion at a given location in a translation unit. 54720b57cec5SDimitry Andric * 54730b57cec5SDimitry Andric * This function performs code completion at a particular file, line, and 54740b57cec5SDimitry Andric * column within source code, providing results that suggest potential 54750b57cec5SDimitry Andric * code snippets based on the context of the completion. The basic model 54760b57cec5SDimitry Andric * for code completion is that Clang will parse a complete source file, 54770b57cec5SDimitry Andric * performing syntax checking up to the location where code-completion has 54780b57cec5SDimitry Andric * been requested. At that point, a special code-completion token is passed 54790b57cec5SDimitry Andric * to the parser, which recognizes this token and determines, based on the 54800b57cec5SDimitry Andric * current location in the C/Objective-C/C++ grammar and the state of 54810b57cec5SDimitry Andric * semantic analysis, what completions to provide. These completions are 54820b57cec5SDimitry Andric * returned via a new \c CXCodeCompleteResults structure. 54830b57cec5SDimitry Andric * 54840b57cec5SDimitry Andric * Code completion itself is meant to be triggered by the client when the 54850b57cec5SDimitry Andric * user types punctuation characters or whitespace, at which point the 54860b57cec5SDimitry Andric * code-completion location will coincide with the cursor. For example, if \c p 54870b57cec5SDimitry Andric * is a pointer, code-completion might be triggered after the "-" and then 54880b57cec5SDimitry Andric * after the ">" in \c p->. When the code-completion location is after the ">", 54890b57cec5SDimitry Andric * the completion results will provide, e.g., the members of the struct that 54900b57cec5SDimitry Andric * "p" points to. The client is responsible for placing the cursor at the 54910b57cec5SDimitry Andric * beginning of the token currently being typed, then filtering the results 54920b57cec5SDimitry Andric * based on the contents of the token. For example, when code-completing for 54930b57cec5SDimitry Andric * the expression \c p->get, the client should provide the location just after 54940b57cec5SDimitry Andric * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the 54950b57cec5SDimitry Andric * client can filter the results based on the current token text ("get"), only 54960b57cec5SDimitry Andric * showing those results that start with "get". The intent of this interface 54970b57cec5SDimitry Andric * is to separate the relatively high-latency acquisition of code-completion 54980b57cec5SDimitry Andric * results from the filtering of results on a per-character basis, which must 54990b57cec5SDimitry Andric * have a lower latency. 55000b57cec5SDimitry Andric * 55010b57cec5SDimitry Andric * \param TU The translation unit in which code-completion should 55020b57cec5SDimitry Andric * occur. The source files for this translation unit need not be 55030b57cec5SDimitry Andric * completely up-to-date (and the contents of those source files may 55040b57cec5SDimitry Andric * be overridden via \p unsaved_files). Cursors referring into the 55050b57cec5SDimitry Andric * translation unit may be invalidated by this invocation. 55060b57cec5SDimitry Andric * 55070b57cec5SDimitry Andric * \param complete_filename The name of the source file where code 55080b57cec5SDimitry Andric * completion should be performed. This filename may be any file 55090b57cec5SDimitry Andric * included in the translation unit. 55100b57cec5SDimitry Andric * 55110b57cec5SDimitry Andric * \param complete_line The line at which code-completion should occur. 55120b57cec5SDimitry Andric * 55130b57cec5SDimitry Andric * \param complete_column The column at which code-completion should occur. 55140b57cec5SDimitry Andric * Note that the column should point just after the syntactic construct that 55150b57cec5SDimitry Andric * initiated code completion, and not in the middle of a lexical token. 55160b57cec5SDimitry Andric * 55170b57cec5SDimitry Andric * \param unsaved_files the Files that have not yet been saved to disk 55180b57cec5SDimitry Andric * but may be required for parsing or code completion, including the 55190b57cec5SDimitry Andric * contents of those files. The contents and name of these files (as 55200b57cec5SDimitry Andric * specified by CXUnsavedFile) are copied when necessary, so the 55210b57cec5SDimitry Andric * client only needs to guarantee their validity until the call to 55220b57cec5SDimitry Andric * this function returns. 55230b57cec5SDimitry Andric * 55240b57cec5SDimitry Andric * \param num_unsaved_files The number of unsaved file entries in \p 55250b57cec5SDimitry Andric * unsaved_files. 55260b57cec5SDimitry Andric * 55270b57cec5SDimitry Andric * \param options Extra options that control the behavior of code 55280b57cec5SDimitry Andric * completion, expressed as a bitwise OR of the enumerators of the 55290b57cec5SDimitry Andric * CXCodeComplete_Flags enumeration. The 55300b57cec5SDimitry Andric * \c clang_defaultCodeCompleteOptions() function returns a default set 55310b57cec5SDimitry Andric * of code-completion options. 55320b57cec5SDimitry Andric * 55330b57cec5SDimitry Andric * \returns If successful, a new \c CXCodeCompleteResults structure 55340b57cec5SDimitry Andric * containing code-completion results, which should eventually be 55350b57cec5SDimitry Andric * freed with \c clang_disposeCodeCompleteResults(). If code 55360b57cec5SDimitry Andric * completion fails, returns NULL. 55370b57cec5SDimitry Andric */ 55380b57cec5SDimitry Andric CINDEX_LINKAGE 55395ffd83dbSDimitry Andric CXCodeCompleteResults * 55405ffd83dbSDimitry Andric clang_codeCompleteAt(CXTranslationUnit TU, const char *complete_filename, 55415ffd83dbSDimitry Andric unsigned complete_line, unsigned complete_column, 55420b57cec5SDimitry Andric struct CXUnsavedFile *unsaved_files, 55435ffd83dbSDimitry Andric unsigned num_unsaved_files, unsigned options); 55440b57cec5SDimitry Andric 55450b57cec5SDimitry Andric /** 55460b57cec5SDimitry Andric * Sort the code-completion results in case-insensitive alphabetical 55470b57cec5SDimitry Andric * order. 55480b57cec5SDimitry Andric * 55490b57cec5SDimitry Andric * \param Results The set of results to sort. 55500b57cec5SDimitry Andric * \param NumResults The number of results in \p Results. 55510b57cec5SDimitry Andric */ 55520b57cec5SDimitry Andric CINDEX_LINKAGE 55530b57cec5SDimitry Andric void clang_sortCodeCompletionResults(CXCompletionResult *Results, 55540b57cec5SDimitry Andric unsigned NumResults); 55550b57cec5SDimitry Andric 55560b57cec5SDimitry Andric /** 55570b57cec5SDimitry Andric * Free the given set of code-completion results. 55580b57cec5SDimitry Andric */ 55590b57cec5SDimitry Andric CINDEX_LINKAGE 55600b57cec5SDimitry Andric void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results); 55610b57cec5SDimitry Andric 55620b57cec5SDimitry Andric /** 55630b57cec5SDimitry Andric * Determine the number of diagnostics produced prior to the 55640b57cec5SDimitry Andric * location where code completion was performed. 55650b57cec5SDimitry Andric */ 55660b57cec5SDimitry Andric CINDEX_LINKAGE 55670b57cec5SDimitry Andric unsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results); 55680b57cec5SDimitry Andric 55690b57cec5SDimitry Andric /** 55700b57cec5SDimitry Andric * Retrieve a diagnostic associated with the given code completion. 55710b57cec5SDimitry Andric * 55720b57cec5SDimitry Andric * \param Results the code completion results to query. 55730b57cec5SDimitry Andric * \param Index the zero-based diagnostic number to retrieve. 55740b57cec5SDimitry Andric * 55750b57cec5SDimitry Andric * \returns the requested diagnostic. This diagnostic must be freed 55760b57cec5SDimitry Andric * via a call to \c clang_disposeDiagnostic(). 55770b57cec5SDimitry Andric */ 55780b57cec5SDimitry Andric CINDEX_LINKAGE 55790b57cec5SDimitry Andric CXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results, 55800b57cec5SDimitry Andric unsigned Index); 55810b57cec5SDimitry Andric 55820b57cec5SDimitry Andric /** 55830b57cec5SDimitry Andric * Determines what completions are appropriate for the context 55840b57cec5SDimitry Andric * the given code completion. 55850b57cec5SDimitry Andric * 55860b57cec5SDimitry Andric * \param Results the code completion results to query 55870b57cec5SDimitry Andric * 55880b57cec5SDimitry Andric * \returns the kinds of completions that are appropriate for use 55890b57cec5SDimitry Andric * along with the given code completion results. 55900b57cec5SDimitry Andric */ 55910b57cec5SDimitry Andric CINDEX_LINKAGE 55925ffd83dbSDimitry Andric unsigned long long 55935ffd83dbSDimitry Andric clang_codeCompleteGetContexts(CXCodeCompleteResults *Results); 55940b57cec5SDimitry Andric 55950b57cec5SDimitry Andric /** 55960b57cec5SDimitry Andric * Returns the cursor kind for the container for the current code 55970b57cec5SDimitry Andric * completion context. The container is only guaranteed to be set for 55980b57cec5SDimitry Andric * contexts where a container exists (i.e. member accesses or Objective-C 55990b57cec5SDimitry Andric * message sends); if there is not a container, this function will return 56000b57cec5SDimitry Andric * CXCursor_InvalidCode. 56010b57cec5SDimitry Andric * 56020b57cec5SDimitry Andric * \param Results the code completion results to query 56030b57cec5SDimitry Andric * 56040b57cec5SDimitry Andric * \param IsIncomplete on return, this value will be false if Clang has complete 56050b57cec5SDimitry Andric * information about the container. If Clang does not have complete 56060b57cec5SDimitry Andric * information, this value will be true. 56070b57cec5SDimitry Andric * 56080b57cec5SDimitry Andric * \returns the container kind, or CXCursor_InvalidCode if there is not a 56090b57cec5SDimitry Andric * container 56100b57cec5SDimitry Andric */ 56110b57cec5SDimitry Andric CINDEX_LINKAGE 56125ffd83dbSDimitry Andric enum CXCursorKind 56135ffd83dbSDimitry Andric clang_codeCompleteGetContainerKind(CXCodeCompleteResults *Results, 56140b57cec5SDimitry Andric unsigned *IsIncomplete); 56150b57cec5SDimitry Andric 56160b57cec5SDimitry Andric /** 56170b57cec5SDimitry Andric * Returns the USR for the container for the current code completion 56180b57cec5SDimitry Andric * context. If there is not a container for the current context, this 56190b57cec5SDimitry Andric * function will return the empty string. 56200b57cec5SDimitry Andric * 56210b57cec5SDimitry Andric * \param Results the code completion results to query 56220b57cec5SDimitry Andric * 56230b57cec5SDimitry Andric * \returns the USR for the container 56240b57cec5SDimitry Andric */ 56250b57cec5SDimitry Andric CINDEX_LINKAGE 56260b57cec5SDimitry Andric CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results); 56270b57cec5SDimitry Andric 56280b57cec5SDimitry Andric /** 56290b57cec5SDimitry Andric * Returns the currently-entered selector for an Objective-C message 56300b57cec5SDimitry Andric * send, formatted like "initWithFoo:bar:". Only guaranteed to return a 56310b57cec5SDimitry Andric * non-empty string for CXCompletionContext_ObjCInstanceMessage and 56320b57cec5SDimitry Andric * CXCompletionContext_ObjCClassMessage. 56330b57cec5SDimitry Andric * 56340b57cec5SDimitry Andric * \param Results the code completion results to query 56350b57cec5SDimitry Andric * 56360b57cec5SDimitry Andric * \returns the selector (or partial selector) that has been entered thus far 56370b57cec5SDimitry Andric * for an Objective-C message send. 56380b57cec5SDimitry Andric */ 56390b57cec5SDimitry Andric CINDEX_LINKAGE 56400b57cec5SDimitry Andric CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results); 56410b57cec5SDimitry Andric 56420b57cec5SDimitry Andric /** 56430b57cec5SDimitry Andric * @} 56440b57cec5SDimitry Andric */ 56450b57cec5SDimitry Andric 56460b57cec5SDimitry Andric /** 56470b57cec5SDimitry Andric * \defgroup CINDEX_MISC Miscellaneous utility functions 56480b57cec5SDimitry Andric * 56490b57cec5SDimitry Andric * @{ 56500b57cec5SDimitry Andric */ 56510b57cec5SDimitry Andric 56520b57cec5SDimitry Andric /** 56530b57cec5SDimitry Andric * Return a version string, suitable for showing to a user, but not 56540b57cec5SDimitry Andric * intended to be parsed (the format is not guaranteed to be stable). 56550b57cec5SDimitry Andric */ 56560b57cec5SDimitry Andric CINDEX_LINKAGE CXString clang_getClangVersion(void); 56570b57cec5SDimitry Andric 56580b57cec5SDimitry Andric /** 56590b57cec5SDimitry Andric * Enable/disable crash recovery. 56600b57cec5SDimitry Andric * 56610b57cec5SDimitry Andric * \param isEnabled Flag to indicate if crash recovery is enabled. A non-zero 56620b57cec5SDimitry Andric * value enables crash recovery, while 0 disables it. 56630b57cec5SDimitry Andric */ 56640b57cec5SDimitry Andric CINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled); 56650b57cec5SDimitry Andric 56660b57cec5SDimitry Andric /** 56670b57cec5SDimitry Andric * Visitor invoked for each file in a translation unit 56680b57cec5SDimitry Andric * (used with clang_getInclusions()). 56690b57cec5SDimitry Andric * 56700b57cec5SDimitry Andric * This visitor function will be invoked by clang_getInclusions() for each 56710b57cec5SDimitry Andric * file included (either at the top-level or by \#include directives) within 56720b57cec5SDimitry Andric * a translation unit. The first argument is the file being included, and 56730b57cec5SDimitry Andric * the second and third arguments provide the inclusion stack. The 56740b57cec5SDimitry Andric * array is sorted in order of immediate inclusion. For example, 56750b57cec5SDimitry Andric * the first element refers to the location that included 'included_file'. 56760b57cec5SDimitry Andric */ 56770b57cec5SDimitry Andric typedef void (*CXInclusionVisitor)(CXFile included_file, 56780b57cec5SDimitry Andric CXSourceLocation *inclusion_stack, 56790b57cec5SDimitry Andric unsigned include_len, 56800b57cec5SDimitry Andric CXClientData client_data); 56810b57cec5SDimitry Andric 56820b57cec5SDimitry Andric /** 56830b57cec5SDimitry Andric * Visit the set of preprocessor inclusions in a translation unit. 56840b57cec5SDimitry Andric * The visitor function is called with the provided data for every included 56850b57cec5SDimitry Andric * file. This does not include headers included by the PCH file (unless one 56860b57cec5SDimitry Andric * is inspecting the inclusions in the PCH file itself). 56870b57cec5SDimitry Andric */ 56880b57cec5SDimitry Andric CINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu, 56890b57cec5SDimitry Andric CXInclusionVisitor visitor, 56900b57cec5SDimitry Andric CXClientData client_data); 56910b57cec5SDimitry Andric 56920b57cec5SDimitry Andric typedef enum { 56930b57cec5SDimitry Andric CXEval_Int = 1, 56940b57cec5SDimitry Andric CXEval_Float = 2, 56950b57cec5SDimitry Andric CXEval_ObjCStrLiteral = 3, 56960b57cec5SDimitry Andric CXEval_StrLiteral = 4, 56970b57cec5SDimitry Andric CXEval_CFStr = 5, 56980b57cec5SDimitry Andric CXEval_Other = 6, 56990b57cec5SDimitry Andric 57000b57cec5SDimitry Andric CXEval_UnExposed = 0 57010b57cec5SDimitry Andric 57020b57cec5SDimitry Andric } CXEvalResultKind; 57030b57cec5SDimitry Andric 57040b57cec5SDimitry Andric /** 57050b57cec5SDimitry Andric * Evaluation result of a cursor 57060b57cec5SDimitry Andric */ 57070b57cec5SDimitry Andric typedef void *CXEvalResult; 57080b57cec5SDimitry Andric 57090b57cec5SDimitry Andric /** 57100b57cec5SDimitry Andric * If cursor is a statement declaration tries to evaluate the 57110b57cec5SDimitry Andric * statement and if its variable, tries to evaluate its initializer, 57120b57cec5SDimitry Andric * into its corresponding type. 57135ffd83dbSDimitry Andric * If it's an expression, tries to evaluate the expression. 57140b57cec5SDimitry Andric */ 57150b57cec5SDimitry Andric CINDEX_LINKAGE CXEvalResult clang_Cursor_Evaluate(CXCursor C); 57160b57cec5SDimitry Andric 57170b57cec5SDimitry Andric /** 57180b57cec5SDimitry Andric * Returns the kind of the evaluated result. 57190b57cec5SDimitry Andric */ 57200b57cec5SDimitry Andric CINDEX_LINKAGE CXEvalResultKind clang_EvalResult_getKind(CXEvalResult E); 57210b57cec5SDimitry Andric 57220b57cec5SDimitry Andric /** 57230b57cec5SDimitry Andric * Returns the evaluation result as integer if the 57240b57cec5SDimitry Andric * kind is Int. 57250b57cec5SDimitry Andric */ 57260b57cec5SDimitry Andric CINDEX_LINKAGE int clang_EvalResult_getAsInt(CXEvalResult E); 57270b57cec5SDimitry Andric 57280b57cec5SDimitry Andric /** 57290b57cec5SDimitry Andric * Returns the evaluation result as a long long integer if the 57300b57cec5SDimitry Andric * kind is Int. This prevents overflows that may happen if the result is 57310b57cec5SDimitry Andric * returned with clang_EvalResult_getAsInt. 57320b57cec5SDimitry Andric */ 57330b57cec5SDimitry Andric CINDEX_LINKAGE long long clang_EvalResult_getAsLongLong(CXEvalResult E); 57340b57cec5SDimitry Andric 57350b57cec5SDimitry Andric /** 57360b57cec5SDimitry Andric * Returns a non-zero value if the kind is Int and the evaluation 57370b57cec5SDimitry Andric * result resulted in an unsigned integer. 57380b57cec5SDimitry Andric */ 57390b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_EvalResult_isUnsignedInt(CXEvalResult E); 57400b57cec5SDimitry Andric 57410b57cec5SDimitry Andric /** 57420b57cec5SDimitry Andric * Returns the evaluation result as an unsigned integer if 57430b57cec5SDimitry Andric * the kind is Int and clang_EvalResult_isUnsignedInt is non-zero. 57440b57cec5SDimitry Andric */ 57455ffd83dbSDimitry Andric CINDEX_LINKAGE unsigned long long 57465ffd83dbSDimitry Andric clang_EvalResult_getAsUnsigned(CXEvalResult E); 57470b57cec5SDimitry Andric 57480b57cec5SDimitry Andric /** 57490b57cec5SDimitry Andric * Returns the evaluation result as double if the 57500b57cec5SDimitry Andric * kind is double. 57510b57cec5SDimitry Andric */ 57520b57cec5SDimitry Andric CINDEX_LINKAGE double clang_EvalResult_getAsDouble(CXEvalResult E); 57530b57cec5SDimitry Andric 57540b57cec5SDimitry Andric /** 57550b57cec5SDimitry Andric * Returns the evaluation result as a constant string if the 57560b57cec5SDimitry Andric * kind is other than Int or float. User must not free this pointer, 57570b57cec5SDimitry Andric * instead call clang_EvalResult_dispose on the CXEvalResult returned 57580b57cec5SDimitry Andric * by clang_Cursor_Evaluate. 57590b57cec5SDimitry Andric */ 57600b57cec5SDimitry Andric CINDEX_LINKAGE const char *clang_EvalResult_getAsStr(CXEvalResult E); 57610b57cec5SDimitry Andric 57620b57cec5SDimitry Andric /** 57630b57cec5SDimitry Andric * Disposes the created Eval memory. 57640b57cec5SDimitry Andric */ 57650b57cec5SDimitry Andric CINDEX_LINKAGE void clang_EvalResult_dispose(CXEvalResult E); 57660b57cec5SDimitry Andric /** 57670b57cec5SDimitry Andric * @} 57680b57cec5SDimitry Andric */ 57690b57cec5SDimitry Andric 57700b57cec5SDimitry Andric /** \defgroup CINDEX_REMAPPING Remapping functions 57710b57cec5SDimitry Andric * 57720b57cec5SDimitry Andric * @{ 57730b57cec5SDimitry Andric */ 57740b57cec5SDimitry Andric 57750b57cec5SDimitry Andric /** 57760b57cec5SDimitry Andric * A remapping of original source files and their translated files. 57770b57cec5SDimitry Andric */ 57780b57cec5SDimitry Andric typedef void *CXRemapping; 57790b57cec5SDimitry Andric 57800b57cec5SDimitry Andric /** 57810b57cec5SDimitry Andric * Retrieve a remapping. 57820b57cec5SDimitry Andric * 57830b57cec5SDimitry Andric * \param path the path that contains metadata about remappings. 57840b57cec5SDimitry Andric * 57850b57cec5SDimitry Andric * \returns the requested remapping. This remapping must be freed 57860b57cec5SDimitry Andric * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. 57870b57cec5SDimitry Andric */ 57880b57cec5SDimitry Andric CINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path); 57890b57cec5SDimitry Andric 57900b57cec5SDimitry Andric /** 57910b57cec5SDimitry Andric * Retrieve a remapping. 57920b57cec5SDimitry Andric * 57930b57cec5SDimitry Andric * \param filePaths pointer to an array of file paths containing remapping info. 57940b57cec5SDimitry Andric * 57950b57cec5SDimitry Andric * \param numFiles number of file paths. 57960b57cec5SDimitry Andric * 57970b57cec5SDimitry Andric * \returns the requested remapping. This remapping must be freed 57980b57cec5SDimitry Andric * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. 57990b57cec5SDimitry Andric */ 58000b57cec5SDimitry Andric CINDEX_LINKAGE 58010b57cec5SDimitry Andric CXRemapping clang_getRemappingsFromFileList(const char **filePaths, 58020b57cec5SDimitry Andric unsigned numFiles); 58030b57cec5SDimitry Andric 58040b57cec5SDimitry Andric /** 58050b57cec5SDimitry Andric * Determine the number of remappings. 58060b57cec5SDimitry Andric */ 58070b57cec5SDimitry Andric CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping); 58080b57cec5SDimitry Andric 58090b57cec5SDimitry Andric /** 58100b57cec5SDimitry Andric * Get the original and the associated filename from the remapping. 58110b57cec5SDimitry Andric * 58120b57cec5SDimitry Andric * \param original If non-NULL, will be set to the original filename. 58130b57cec5SDimitry Andric * 58140b57cec5SDimitry Andric * \param transformed If non-NULL, will be set to the filename that the original 58150b57cec5SDimitry Andric * is associated with. 58160b57cec5SDimitry Andric */ 58170b57cec5SDimitry Andric CINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index, 58185ffd83dbSDimitry Andric CXString *original, 58195ffd83dbSDimitry Andric CXString *transformed); 58200b57cec5SDimitry Andric 58210b57cec5SDimitry Andric /** 58220b57cec5SDimitry Andric * Dispose the remapping. 58230b57cec5SDimitry Andric */ 58240b57cec5SDimitry Andric CINDEX_LINKAGE void clang_remap_dispose(CXRemapping); 58250b57cec5SDimitry Andric 58260b57cec5SDimitry Andric /** 58270b57cec5SDimitry Andric * @} 58280b57cec5SDimitry Andric */ 58290b57cec5SDimitry Andric 58300b57cec5SDimitry Andric /** \defgroup CINDEX_HIGH Higher level API functions 58310b57cec5SDimitry Andric * 58320b57cec5SDimitry Andric * @{ 58330b57cec5SDimitry Andric */ 58340b57cec5SDimitry Andric 58355ffd83dbSDimitry Andric enum CXVisitorResult { CXVisit_Break, CXVisit_Continue }; 58360b57cec5SDimitry Andric 58370b57cec5SDimitry Andric typedef struct CXCursorAndRangeVisitor { 58380b57cec5SDimitry Andric void *context; 58390b57cec5SDimitry Andric enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange); 58400b57cec5SDimitry Andric } CXCursorAndRangeVisitor; 58410b57cec5SDimitry Andric 58420b57cec5SDimitry Andric typedef enum { 58430b57cec5SDimitry Andric /** 58440b57cec5SDimitry Andric * Function returned successfully. 58450b57cec5SDimitry Andric */ 58460b57cec5SDimitry Andric CXResult_Success = 0, 58470b57cec5SDimitry Andric /** 58480b57cec5SDimitry Andric * One of the parameters was invalid for the function. 58490b57cec5SDimitry Andric */ 58500b57cec5SDimitry Andric CXResult_Invalid = 1, 58510b57cec5SDimitry Andric /** 58520b57cec5SDimitry Andric * The function was terminated by a callback (e.g. it returned 58530b57cec5SDimitry Andric * CXVisit_Break) 58540b57cec5SDimitry Andric */ 58550b57cec5SDimitry Andric CXResult_VisitBreak = 2 58560b57cec5SDimitry Andric 58570b57cec5SDimitry Andric } CXResult; 58580b57cec5SDimitry Andric 58590b57cec5SDimitry Andric /** 58600b57cec5SDimitry Andric * Find references of a declaration in a specific file. 58610b57cec5SDimitry Andric * 58620b57cec5SDimitry Andric * \param cursor pointing to a declaration or a reference of one. 58630b57cec5SDimitry Andric * 58640b57cec5SDimitry Andric * \param file to search for references. 58650b57cec5SDimitry Andric * 58660b57cec5SDimitry Andric * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for 58670b57cec5SDimitry Andric * each reference found. 58680b57cec5SDimitry Andric * The CXSourceRange will point inside the file; if the reference is inside 58690b57cec5SDimitry Andric * a macro (and not a macro argument) the CXSourceRange will be invalid. 58700b57cec5SDimitry Andric * 58710b57cec5SDimitry Andric * \returns one of the CXResult enumerators. 58720b57cec5SDimitry Andric */ 58735ffd83dbSDimitry Andric CINDEX_LINKAGE CXResult clang_findReferencesInFile( 58745ffd83dbSDimitry Andric CXCursor cursor, CXFile file, CXCursorAndRangeVisitor visitor); 58750b57cec5SDimitry Andric 58760b57cec5SDimitry Andric /** 58770b57cec5SDimitry Andric * Find #import/#include directives in a specific file. 58780b57cec5SDimitry Andric * 58790b57cec5SDimitry Andric * \param TU translation unit containing the file to query. 58800b57cec5SDimitry Andric * 58810b57cec5SDimitry Andric * \param file to search for #import/#include directives. 58820b57cec5SDimitry Andric * 58830b57cec5SDimitry Andric * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for 58840b57cec5SDimitry Andric * each directive found. 58850b57cec5SDimitry Andric * 58860b57cec5SDimitry Andric * \returns one of the CXResult enumerators. 58870b57cec5SDimitry Andric */ 58885ffd83dbSDimitry Andric CINDEX_LINKAGE CXResult clang_findIncludesInFile( 58895ffd83dbSDimitry Andric CXTranslationUnit TU, CXFile file, CXCursorAndRangeVisitor visitor); 58900b57cec5SDimitry Andric 58910b57cec5SDimitry Andric #if __has_feature(blocks) 58925ffd83dbSDimitry Andric typedef enum CXVisitorResult (^CXCursorAndRangeVisitorBlock)(CXCursor, 58935ffd83dbSDimitry Andric CXSourceRange); 589406c3fb27SDimitry Andric #else 589506c3fb27SDimitry Andric typedef struct _CXCursorAndRangeVisitorBlock *CXCursorAndRangeVisitorBlock; 589606c3fb27SDimitry Andric #endif 58970b57cec5SDimitry Andric 58980b57cec5SDimitry Andric CINDEX_LINKAGE 58990b57cec5SDimitry Andric CXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile, 59000b57cec5SDimitry Andric CXCursorAndRangeVisitorBlock); 59010b57cec5SDimitry Andric 59020b57cec5SDimitry Andric CINDEX_LINKAGE 59030b57cec5SDimitry Andric CXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile, 59040b57cec5SDimitry Andric CXCursorAndRangeVisitorBlock); 59050b57cec5SDimitry Andric 59060b57cec5SDimitry Andric /** 59070b57cec5SDimitry Andric * The client's data object that is associated with a CXFile. 59080b57cec5SDimitry Andric */ 59090b57cec5SDimitry Andric typedef void *CXIdxClientFile; 59100b57cec5SDimitry Andric 59110b57cec5SDimitry Andric /** 59120b57cec5SDimitry Andric * The client's data object that is associated with a semantic entity. 59130b57cec5SDimitry Andric */ 59140b57cec5SDimitry Andric typedef void *CXIdxClientEntity; 59150b57cec5SDimitry Andric 59160b57cec5SDimitry Andric /** 59170b57cec5SDimitry Andric * The client's data object that is associated with a semantic container 59180b57cec5SDimitry Andric * of entities. 59190b57cec5SDimitry Andric */ 59200b57cec5SDimitry Andric typedef void *CXIdxClientContainer; 59210b57cec5SDimitry Andric 59220b57cec5SDimitry Andric /** 59230b57cec5SDimitry Andric * The client's data object that is associated with an AST file (PCH 59240b57cec5SDimitry Andric * or module). 59250b57cec5SDimitry Andric */ 59260b57cec5SDimitry Andric typedef void *CXIdxClientASTFile; 59270b57cec5SDimitry Andric 59280b57cec5SDimitry Andric /** 59290b57cec5SDimitry Andric * Source location passed to index callbacks. 59300b57cec5SDimitry Andric */ 59310b57cec5SDimitry Andric typedef struct { 59320b57cec5SDimitry Andric void *ptr_data[2]; 59330b57cec5SDimitry Andric unsigned int_data; 59340b57cec5SDimitry Andric } CXIdxLoc; 59350b57cec5SDimitry Andric 59360b57cec5SDimitry Andric /** 59370b57cec5SDimitry Andric * Data for ppIncludedFile callback. 59380b57cec5SDimitry Andric */ 59390b57cec5SDimitry Andric typedef struct { 59400b57cec5SDimitry Andric /** 59410b57cec5SDimitry Andric * Location of '#' in the \#include/\#import directive. 59420b57cec5SDimitry Andric */ 59430b57cec5SDimitry Andric CXIdxLoc hashLoc; 59440b57cec5SDimitry Andric /** 59450b57cec5SDimitry Andric * Filename as written in the \#include/\#import directive. 59460b57cec5SDimitry Andric */ 59470b57cec5SDimitry Andric const char *filename; 59480b57cec5SDimitry Andric /** 59490b57cec5SDimitry Andric * The actual file that the \#include/\#import directive resolved to. 59500b57cec5SDimitry Andric */ 59510b57cec5SDimitry Andric CXFile file; 59520b57cec5SDimitry Andric int isImport; 59530b57cec5SDimitry Andric int isAngled; 59540b57cec5SDimitry Andric /** 59550b57cec5SDimitry Andric * Non-zero if the directive was automatically turned into a module 59560b57cec5SDimitry Andric * import. 59570b57cec5SDimitry Andric */ 59580b57cec5SDimitry Andric int isModuleImport; 59590b57cec5SDimitry Andric } CXIdxIncludedFileInfo; 59600b57cec5SDimitry Andric 59610b57cec5SDimitry Andric /** 59620b57cec5SDimitry Andric * Data for IndexerCallbacks#importedASTFile. 59630b57cec5SDimitry Andric */ 59640b57cec5SDimitry Andric typedef struct { 59650b57cec5SDimitry Andric /** 59660b57cec5SDimitry Andric * Top level AST file containing the imported PCH, module or submodule. 59670b57cec5SDimitry Andric */ 59680b57cec5SDimitry Andric CXFile file; 59690b57cec5SDimitry Andric /** 59700b57cec5SDimitry Andric * The imported module or NULL if the AST file is a PCH. 59710b57cec5SDimitry Andric */ 59720b57cec5SDimitry Andric CXModule module; 59730b57cec5SDimitry Andric /** 59740b57cec5SDimitry Andric * Location where the file is imported. Applicable only for modules. 59750b57cec5SDimitry Andric */ 59760b57cec5SDimitry Andric CXIdxLoc loc; 59770b57cec5SDimitry Andric /** 59780b57cec5SDimitry Andric * Non-zero if an inclusion directive was automatically turned into 59790b57cec5SDimitry Andric * a module import. Applicable only for modules. 59800b57cec5SDimitry Andric */ 59810b57cec5SDimitry Andric int isImplicit; 59820b57cec5SDimitry Andric 59830b57cec5SDimitry Andric } CXIdxImportedASTFileInfo; 59840b57cec5SDimitry Andric 59850b57cec5SDimitry Andric typedef enum { 59860b57cec5SDimitry Andric CXIdxEntity_Unexposed = 0, 59870b57cec5SDimitry Andric CXIdxEntity_Typedef = 1, 59880b57cec5SDimitry Andric CXIdxEntity_Function = 2, 59890b57cec5SDimitry Andric CXIdxEntity_Variable = 3, 59900b57cec5SDimitry Andric CXIdxEntity_Field = 4, 59910b57cec5SDimitry Andric CXIdxEntity_EnumConstant = 5, 59920b57cec5SDimitry Andric 59930b57cec5SDimitry Andric CXIdxEntity_ObjCClass = 6, 59940b57cec5SDimitry Andric CXIdxEntity_ObjCProtocol = 7, 59950b57cec5SDimitry Andric CXIdxEntity_ObjCCategory = 8, 59960b57cec5SDimitry Andric 59970b57cec5SDimitry Andric CXIdxEntity_ObjCInstanceMethod = 9, 59980b57cec5SDimitry Andric CXIdxEntity_ObjCClassMethod = 10, 59990b57cec5SDimitry Andric CXIdxEntity_ObjCProperty = 11, 60000b57cec5SDimitry Andric CXIdxEntity_ObjCIvar = 12, 60010b57cec5SDimitry Andric 60020b57cec5SDimitry Andric CXIdxEntity_Enum = 13, 60030b57cec5SDimitry Andric CXIdxEntity_Struct = 14, 60040b57cec5SDimitry Andric CXIdxEntity_Union = 15, 60050b57cec5SDimitry Andric 60060b57cec5SDimitry Andric CXIdxEntity_CXXClass = 16, 60070b57cec5SDimitry Andric CXIdxEntity_CXXNamespace = 17, 60080b57cec5SDimitry Andric CXIdxEntity_CXXNamespaceAlias = 18, 60090b57cec5SDimitry Andric CXIdxEntity_CXXStaticVariable = 19, 60100b57cec5SDimitry Andric CXIdxEntity_CXXStaticMethod = 20, 60110b57cec5SDimitry Andric CXIdxEntity_CXXInstanceMethod = 21, 60120b57cec5SDimitry Andric CXIdxEntity_CXXConstructor = 22, 60130b57cec5SDimitry Andric CXIdxEntity_CXXDestructor = 23, 60140b57cec5SDimitry Andric CXIdxEntity_CXXConversionFunction = 24, 60150b57cec5SDimitry Andric CXIdxEntity_CXXTypeAlias = 25, 601681ad6265SDimitry Andric CXIdxEntity_CXXInterface = 26, 601781ad6265SDimitry Andric CXIdxEntity_CXXConcept = 27 60180b57cec5SDimitry Andric 60190b57cec5SDimitry Andric } CXIdxEntityKind; 60200b57cec5SDimitry Andric 60210b57cec5SDimitry Andric typedef enum { 60220b57cec5SDimitry Andric CXIdxEntityLang_None = 0, 60230b57cec5SDimitry Andric CXIdxEntityLang_C = 1, 60240b57cec5SDimitry Andric CXIdxEntityLang_ObjC = 2, 60250b57cec5SDimitry Andric CXIdxEntityLang_CXX = 3, 60260b57cec5SDimitry Andric CXIdxEntityLang_Swift = 4 60270b57cec5SDimitry Andric } CXIdxEntityLanguage; 60280b57cec5SDimitry Andric 60290b57cec5SDimitry Andric /** 60300b57cec5SDimitry Andric * Extra C++ template information for an entity. This can apply to: 60310b57cec5SDimitry Andric * CXIdxEntity_Function 60320b57cec5SDimitry Andric * CXIdxEntity_CXXClass 60330b57cec5SDimitry Andric * CXIdxEntity_CXXStaticMethod 60340b57cec5SDimitry Andric * CXIdxEntity_CXXInstanceMethod 60350b57cec5SDimitry Andric * CXIdxEntity_CXXConstructor 60360b57cec5SDimitry Andric * CXIdxEntity_CXXConversionFunction 60370b57cec5SDimitry Andric * CXIdxEntity_CXXTypeAlias 60380b57cec5SDimitry Andric */ 60390b57cec5SDimitry Andric typedef enum { 60400b57cec5SDimitry Andric CXIdxEntity_NonTemplate = 0, 60410b57cec5SDimitry Andric CXIdxEntity_Template = 1, 60420b57cec5SDimitry Andric CXIdxEntity_TemplatePartialSpecialization = 2, 60430b57cec5SDimitry Andric CXIdxEntity_TemplateSpecialization = 3 60440b57cec5SDimitry Andric } CXIdxEntityCXXTemplateKind; 60450b57cec5SDimitry Andric 60460b57cec5SDimitry Andric typedef enum { 60470b57cec5SDimitry Andric CXIdxAttr_Unexposed = 0, 60480b57cec5SDimitry Andric CXIdxAttr_IBAction = 1, 60490b57cec5SDimitry Andric CXIdxAttr_IBOutlet = 2, 60500b57cec5SDimitry Andric CXIdxAttr_IBOutletCollection = 3 60510b57cec5SDimitry Andric } CXIdxAttrKind; 60520b57cec5SDimitry Andric 60530b57cec5SDimitry Andric typedef struct { 60540b57cec5SDimitry Andric CXIdxAttrKind kind; 60550b57cec5SDimitry Andric CXCursor cursor; 60560b57cec5SDimitry Andric CXIdxLoc loc; 60570b57cec5SDimitry Andric } CXIdxAttrInfo; 60580b57cec5SDimitry Andric 60590b57cec5SDimitry Andric typedef struct { 60600b57cec5SDimitry Andric CXIdxEntityKind kind; 60610b57cec5SDimitry Andric CXIdxEntityCXXTemplateKind templateKind; 60620b57cec5SDimitry Andric CXIdxEntityLanguage lang; 60630b57cec5SDimitry Andric const char *name; 60640b57cec5SDimitry Andric const char *USR; 60650b57cec5SDimitry Andric CXCursor cursor; 60660b57cec5SDimitry Andric const CXIdxAttrInfo *const *attributes; 60670b57cec5SDimitry Andric unsigned numAttributes; 60680b57cec5SDimitry Andric } CXIdxEntityInfo; 60690b57cec5SDimitry Andric 60700b57cec5SDimitry Andric typedef struct { 60710b57cec5SDimitry Andric CXCursor cursor; 60720b57cec5SDimitry Andric } CXIdxContainerInfo; 60730b57cec5SDimitry Andric 60740b57cec5SDimitry Andric typedef struct { 60750b57cec5SDimitry Andric const CXIdxAttrInfo *attrInfo; 60760b57cec5SDimitry Andric const CXIdxEntityInfo *objcClass; 60770b57cec5SDimitry Andric CXCursor classCursor; 60780b57cec5SDimitry Andric CXIdxLoc classLoc; 60790b57cec5SDimitry Andric } CXIdxIBOutletCollectionAttrInfo; 60800b57cec5SDimitry Andric 60815ffd83dbSDimitry Andric typedef enum { CXIdxDeclFlag_Skipped = 0x1 } CXIdxDeclInfoFlags; 60820b57cec5SDimitry Andric 60830b57cec5SDimitry Andric typedef struct { 60840b57cec5SDimitry Andric const CXIdxEntityInfo *entityInfo; 60850b57cec5SDimitry Andric CXCursor cursor; 60860b57cec5SDimitry Andric CXIdxLoc loc; 60870b57cec5SDimitry Andric const CXIdxContainerInfo *semanticContainer; 60880b57cec5SDimitry Andric /** 60890b57cec5SDimitry Andric * Generally same as #semanticContainer but can be different in 60900b57cec5SDimitry Andric * cases like out-of-line C++ member functions. 60910b57cec5SDimitry Andric */ 60920b57cec5SDimitry Andric const CXIdxContainerInfo *lexicalContainer; 60930b57cec5SDimitry Andric int isRedeclaration; 60940b57cec5SDimitry Andric int isDefinition; 60950b57cec5SDimitry Andric int isContainer; 60960b57cec5SDimitry Andric const CXIdxContainerInfo *declAsContainer; 60970b57cec5SDimitry Andric /** 60980b57cec5SDimitry Andric * Whether the declaration exists in code or was created implicitly 60990b57cec5SDimitry Andric * by the compiler, e.g. implicit Objective-C methods for properties. 61000b57cec5SDimitry Andric */ 61010b57cec5SDimitry Andric int isImplicit; 61020b57cec5SDimitry Andric const CXIdxAttrInfo *const *attributes; 61030b57cec5SDimitry Andric unsigned numAttributes; 61040b57cec5SDimitry Andric 61050b57cec5SDimitry Andric unsigned flags; 61060b57cec5SDimitry Andric 61070b57cec5SDimitry Andric } CXIdxDeclInfo; 61080b57cec5SDimitry Andric 61090b57cec5SDimitry Andric typedef enum { 61100b57cec5SDimitry Andric CXIdxObjCContainer_ForwardRef = 0, 61110b57cec5SDimitry Andric CXIdxObjCContainer_Interface = 1, 61120b57cec5SDimitry Andric CXIdxObjCContainer_Implementation = 2 61130b57cec5SDimitry Andric } CXIdxObjCContainerKind; 61140b57cec5SDimitry Andric 61150b57cec5SDimitry Andric typedef struct { 61160b57cec5SDimitry Andric const CXIdxDeclInfo *declInfo; 61170b57cec5SDimitry Andric CXIdxObjCContainerKind kind; 61180b57cec5SDimitry Andric } CXIdxObjCContainerDeclInfo; 61190b57cec5SDimitry Andric 61200b57cec5SDimitry Andric typedef struct { 61210b57cec5SDimitry Andric const CXIdxEntityInfo *base; 61220b57cec5SDimitry Andric CXCursor cursor; 61230b57cec5SDimitry Andric CXIdxLoc loc; 61240b57cec5SDimitry Andric } CXIdxBaseClassInfo; 61250b57cec5SDimitry Andric 61260b57cec5SDimitry Andric typedef struct { 61270b57cec5SDimitry Andric const CXIdxEntityInfo *protocol; 61280b57cec5SDimitry Andric CXCursor cursor; 61290b57cec5SDimitry Andric CXIdxLoc loc; 61300b57cec5SDimitry Andric } CXIdxObjCProtocolRefInfo; 61310b57cec5SDimitry Andric 61320b57cec5SDimitry Andric typedef struct { 61330b57cec5SDimitry Andric const CXIdxObjCProtocolRefInfo *const *protocols; 61340b57cec5SDimitry Andric unsigned numProtocols; 61350b57cec5SDimitry Andric } CXIdxObjCProtocolRefListInfo; 61360b57cec5SDimitry Andric 61370b57cec5SDimitry Andric typedef struct { 61380b57cec5SDimitry Andric const CXIdxObjCContainerDeclInfo *containerInfo; 61390b57cec5SDimitry Andric const CXIdxBaseClassInfo *superInfo; 61400b57cec5SDimitry Andric const CXIdxObjCProtocolRefListInfo *protocols; 61410b57cec5SDimitry Andric } CXIdxObjCInterfaceDeclInfo; 61420b57cec5SDimitry Andric 61430b57cec5SDimitry Andric typedef struct { 61440b57cec5SDimitry Andric const CXIdxObjCContainerDeclInfo *containerInfo; 61450b57cec5SDimitry Andric const CXIdxEntityInfo *objcClass; 61460b57cec5SDimitry Andric CXCursor classCursor; 61470b57cec5SDimitry Andric CXIdxLoc classLoc; 61480b57cec5SDimitry Andric const CXIdxObjCProtocolRefListInfo *protocols; 61490b57cec5SDimitry Andric } CXIdxObjCCategoryDeclInfo; 61500b57cec5SDimitry Andric 61510b57cec5SDimitry Andric typedef struct { 61520b57cec5SDimitry Andric const CXIdxDeclInfo *declInfo; 61530b57cec5SDimitry Andric const CXIdxEntityInfo *getter; 61540b57cec5SDimitry Andric const CXIdxEntityInfo *setter; 61550b57cec5SDimitry Andric } CXIdxObjCPropertyDeclInfo; 61560b57cec5SDimitry Andric 61570b57cec5SDimitry Andric typedef struct { 61580b57cec5SDimitry Andric const CXIdxDeclInfo *declInfo; 61590b57cec5SDimitry Andric const CXIdxBaseClassInfo *const *bases; 61600b57cec5SDimitry Andric unsigned numBases; 61610b57cec5SDimitry Andric } CXIdxCXXClassDeclInfo; 61620b57cec5SDimitry Andric 61630b57cec5SDimitry Andric /** 61640b57cec5SDimitry Andric * Data for IndexerCallbacks#indexEntityReference. 61650b57cec5SDimitry Andric * 61660b57cec5SDimitry Andric * This may be deprecated in a future version as this duplicates 61670b57cec5SDimitry Andric * the \c CXSymbolRole_Implicit bit in \c CXSymbolRole. 61680b57cec5SDimitry Andric */ 61690b57cec5SDimitry Andric typedef enum { 61700b57cec5SDimitry Andric /** 61710b57cec5SDimitry Andric * The entity is referenced directly in user's code. 61720b57cec5SDimitry Andric */ 61730b57cec5SDimitry Andric CXIdxEntityRef_Direct = 1, 61740b57cec5SDimitry Andric /** 61750b57cec5SDimitry Andric * An implicit reference, e.g. a reference of an Objective-C method 61760b57cec5SDimitry Andric * via the dot syntax. 61770b57cec5SDimitry Andric */ 61780b57cec5SDimitry Andric CXIdxEntityRef_Implicit = 2 61790b57cec5SDimitry Andric } CXIdxEntityRefKind; 61800b57cec5SDimitry Andric 61810b57cec5SDimitry Andric /** 61820b57cec5SDimitry Andric * Roles that are attributed to symbol occurrences. 61830b57cec5SDimitry Andric * 61840b57cec5SDimitry Andric * Internal: this currently mirrors low 9 bits of clang::index::SymbolRole with 61850b57cec5SDimitry Andric * higher bits zeroed. These high bits may be exposed in the future. 61860b57cec5SDimitry Andric */ 61870b57cec5SDimitry Andric typedef enum { 61880b57cec5SDimitry Andric CXSymbolRole_None = 0, 61890b57cec5SDimitry Andric CXSymbolRole_Declaration = 1 << 0, 61900b57cec5SDimitry Andric CXSymbolRole_Definition = 1 << 1, 61910b57cec5SDimitry Andric CXSymbolRole_Reference = 1 << 2, 61920b57cec5SDimitry Andric CXSymbolRole_Read = 1 << 3, 61930b57cec5SDimitry Andric CXSymbolRole_Write = 1 << 4, 61940b57cec5SDimitry Andric CXSymbolRole_Call = 1 << 5, 61950b57cec5SDimitry Andric CXSymbolRole_Dynamic = 1 << 6, 61960b57cec5SDimitry Andric CXSymbolRole_AddressOf = 1 << 7, 61970b57cec5SDimitry Andric CXSymbolRole_Implicit = 1 << 8 61980b57cec5SDimitry Andric } CXSymbolRole; 61990b57cec5SDimitry Andric 62000b57cec5SDimitry Andric /** 62010b57cec5SDimitry Andric * Data for IndexerCallbacks#indexEntityReference. 62020b57cec5SDimitry Andric */ 62030b57cec5SDimitry Andric typedef struct { 62040b57cec5SDimitry Andric CXIdxEntityRefKind kind; 62050b57cec5SDimitry Andric /** 62060b57cec5SDimitry Andric * Reference cursor. 62070b57cec5SDimitry Andric */ 62080b57cec5SDimitry Andric CXCursor cursor; 62090b57cec5SDimitry Andric CXIdxLoc loc; 62100b57cec5SDimitry Andric /** 62110b57cec5SDimitry Andric * The entity that gets referenced. 62120b57cec5SDimitry Andric */ 62130b57cec5SDimitry Andric const CXIdxEntityInfo *referencedEntity; 62140b57cec5SDimitry Andric /** 62150b57cec5SDimitry Andric * Immediate "parent" of the reference. For example: 62160b57cec5SDimitry Andric * 62170b57cec5SDimitry Andric * \code 62180b57cec5SDimitry Andric * Foo *var; 62190b57cec5SDimitry Andric * \endcode 62200b57cec5SDimitry Andric * 62210b57cec5SDimitry Andric * The parent of reference of type 'Foo' is the variable 'var'. 62220b57cec5SDimitry Andric * For references inside statement bodies of functions/methods, 62230b57cec5SDimitry Andric * the parentEntity will be the function/method. 62240b57cec5SDimitry Andric */ 62250b57cec5SDimitry Andric const CXIdxEntityInfo *parentEntity; 62260b57cec5SDimitry Andric /** 62270b57cec5SDimitry Andric * Lexical container context of the reference. 62280b57cec5SDimitry Andric */ 62290b57cec5SDimitry Andric const CXIdxContainerInfo *container; 62300b57cec5SDimitry Andric /** 62310b57cec5SDimitry Andric * Sets of symbol roles of the reference. 62320b57cec5SDimitry Andric */ 62330b57cec5SDimitry Andric CXSymbolRole role; 62340b57cec5SDimitry Andric } CXIdxEntityRefInfo; 62350b57cec5SDimitry Andric 62360b57cec5SDimitry Andric /** 62370b57cec5SDimitry Andric * A group of callbacks used by #clang_indexSourceFile and 62380b57cec5SDimitry Andric * #clang_indexTranslationUnit. 62390b57cec5SDimitry Andric */ 62400b57cec5SDimitry Andric typedef struct { 62410b57cec5SDimitry Andric /** 62420b57cec5SDimitry Andric * Called periodically to check whether indexing should be aborted. 62430b57cec5SDimitry Andric * Should return 0 to continue, and non-zero to abort. 62440b57cec5SDimitry Andric */ 62450b57cec5SDimitry Andric int (*abortQuery)(CXClientData client_data, void *reserved); 62460b57cec5SDimitry Andric 62470b57cec5SDimitry Andric /** 62480b57cec5SDimitry Andric * Called at the end of indexing; passes the complete diagnostic set. 62490b57cec5SDimitry Andric */ 62505ffd83dbSDimitry Andric void (*diagnostic)(CXClientData client_data, CXDiagnosticSet, void *reserved); 62510b57cec5SDimitry Andric 62525ffd83dbSDimitry Andric CXIdxClientFile (*enteredMainFile)(CXClientData client_data, CXFile mainFile, 62535ffd83dbSDimitry Andric void *reserved); 62540b57cec5SDimitry Andric 62550b57cec5SDimitry Andric /** 62560b57cec5SDimitry Andric * Called when a file gets \#included/\#imported. 62570b57cec5SDimitry Andric */ 62580b57cec5SDimitry Andric CXIdxClientFile (*ppIncludedFile)(CXClientData client_data, 62590b57cec5SDimitry Andric const CXIdxIncludedFileInfo *); 62600b57cec5SDimitry Andric 62610b57cec5SDimitry Andric /** 62620b57cec5SDimitry Andric * Called when a AST file (PCH or module) gets imported. 62630b57cec5SDimitry Andric * 62640b57cec5SDimitry Andric * AST files will not get indexed (there will not be callbacks to index all 62650b57cec5SDimitry Andric * the entities in an AST file). The recommended action is that, if the AST 62660b57cec5SDimitry Andric * file is not already indexed, to initiate a new indexing job specific to 62670b57cec5SDimitry Andric * the AST file. 62680b57cec5SDimitry Andric */ 62690b57cec5SDimitry Andric CXIdxClientASTFile (*importedASTFile)(CXClientData client_data, 62700b57cec5SDimitry Andric const CXIdxImportedASTFileInfo *); 62710b57cec5SDimitry Andric 62720b57cec5SDimitry Andric /** 62730b57cec5SDimitry Andric * Called at the beginning of indexing a translation unit. 62740b57cec5SDimitry Andric */ 62750b57cec5SDimitry Andric CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data, 62760b57cec5SDimitry Andric void *reserved); 62770b57cec5SDimitry Andric 62785ffd83dbSDimitry Andric void (*indexDeclaration)(CXClientData client_data, const CXIdxDeclInfo *); 62790b57cec5SDimitry Andric 62800b57cec5SDimitry Andric /** 62810b57cec5SDimitry Andric * Called to index a reference of an entity. 62820b57cec5SDimitry Andric */ 62830b57cec5SDimitry Andric void (*indexEntityReference)(CXClientData client_data, 62840b57cec5SDimitry Andric const CXIdxEntityRefInfo *); 62850b57cec5SDimitry Andric 62860b57cec5SDimitry Andric } IndexerCallbacks; 62870b57cec5SDimitry Andric 62880b57cec5SDimitry Andric CINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind); 62890b57cec5SDimitry Andric CINDEX_LINKAGE const CXIdxObjCContainerDeclInfo * 62900b57cec5SDimitry Andric clang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *); 62910b57cec5SDimitry Andric 62920b57cec5SDimitry Andric CINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo * 62930b57cec5SDimitry Andric clang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *); 62940b57cec5SDimitry Andric 62950b57cec5SDimitry Andric CINDEX_LINKAGE 62960b57cec5SDimitry Andric const CXIdxObjCCategoryDeclInfo * 62970b57cec5SDimitry Andric clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *); 62980b57cec5SDimitry Andric 62990b57cec5SDimitry Andric CINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo * 63000b57cec5SDimitry Andric clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *); 63010b57cec5SDimitry Andric 63020b57cec5SDimitry Andric CINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo * 63030b57cec5SDimitry Andric clang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *); 63040b57cec5SDimitry Andric 63050b57cec5SDimitry Andric CINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo * 63060b57cec5SDimitry Andric clang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *); 63070b57cec5SDimitry Andric 63080b57cec5SDimitry Andric CINDEX_LINKAGE const CXIdxCXXClassDeclInfo * 63090b57cec5SDimitry Andric clang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *); 63100b57cec5SDimitry Andric 63110b57cec5SDimitry Andric /** 63120b57cec5SDimitry Andric * For retrieving a custom CXIdxClientContainer attached to a 63130b57cec5SDimitry Andric * container. 63140b57cec5SDimitry Andric */ 63150b57cec5SDimitry Andric CINDEX_LINKAGE CXIdxClientContainer 63160b57cec5SDimitry Andric clang_index_getClientContainer(const CXIdxContainerInfo *); 63170b57cec5SDimitry Andric 63180b57cec5SDimitry Andric /** 63190b57cec5SDimitry Andric * For setting a custom CXIdxClientContainer attached to a 63200b57cec5SDimitry Andric * container. 63210b57cec5SDimitry Andric */ 63225ffd83dbSDimitry Andric CINDEX_LINKAGE void clang_index_setClientContainer(const CXIdxContainerInfo *, 63235ffd83dbSDimitry Andric CXIdxClientContainer); 63240b57cec5SDimitry Andric 63250b57cec5SDimitry Andric /** 63260b57cec5SDimitry Andric * For retrieving a custom CXIdxClientEntity attached to an entity. 63270b57cec5SDimitry Andric */ 63280b57cec5SDimitry Andric CINDEX_LINKAGE CXIdxClientEntity 63290b57cec5SDimitry Andric clang_index_getClientEntity(const CXIdxEntityInfo *); 63300b57cec5SDimitry Andric 63310b57cec5SDimitry Andric /** 63320b57cec5SDimitry Andric * For setting a custom CXIdxClientEntity attached to an entity. 63330b57cec5SDimitry Andric */ 63345ffd83dbSDimitry Andric CINDEX_LINKAGE void clang_index_setClientEntity(const CXIdxEntityInfo *, 63355ffd83dbSDimitry Andric CXIdxClientEntity); 63360b57cec5SDimitry Andric 63370b57cec5SDimitry Andric /** 63380b57cec5SDimitry Andric * An indexing action/session, to be applied to one or multiple 63390b57cec5SDimitry Andric * translation units. 63400b57cec5SDimitry Andric */ 63410b57cec5SDimitry Andric typedef void *CXIndexAction; 63420b57cec5SDimitry Andric 63430b57cec5SDimitry Andric /** 63440b57cec5SDimitry Andric * An indexing action/session, to be applied to one or multiple 63450b57cec5SDimitry Andric * translation units. 63460b57cec5SDimitry Andric * 63470b57cec5SDimitry Andric * \param CIdx The index object with which the index action will be associated. 63480b57cec5SDimitry Andric */ 63490b57cec5SDimitry Andric CINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx); 63500b57cec5SDimitry Andric 63510b57cec5SDimitry Andric /** 63520b57cec5SDimitry Andric * Destroy the given index action. 63530b57cec5SDimitry Andric * 63540b57cec5SDimitry Andric * The index action must not be destroyed until all of the translation units 63550b57cec5SDimitry Andric * created within that index action have been destroyed. 63560b57cec5SDimitry Andric */ 63570b57cec5SDimitry Andric CINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction); 63580b57cec5SDimitry Andric 63590b57cec5SDimitry Andric typedef enum { 63600b57cec5SDimitry Andric /** 63610b57cec5SDimitry Andric * Used to indicate that no special indexing options are needed. 63620b57cec5SDimitry Andric */ 63630b57cec5SDimitry Andric CXIndexOpt_None = 0x0, 63640b57cec5SDimitry Andric 63650b57cec5SDimitry Andric /** 63660b57cec5SDimitry Andric * Used to indicate that IndexerCallbacks#indexEntityReference should 63670b57cec5SDimitry Andric * be invoked for only one reference of an entity per source file that does 63680b57cec5SDimitry Andric * not also include a declaration/definition of the entity. 63690b57cec5SDimitry Andric */ 63700b57cec5SDimitry Andric CXIndexOpt_SuppressRedundantRefs = 0x1, 63710b57cec5SDimitry Andric 63720b57cec5SDimitry Andric /** 63730b57cec5SDimitry Andric * Function-local symbols should be indexed. If this is not set 63740b57cec5SDimitry Andric * function-local symbols will be ignored. 63750b57cec5SDimitry Andric */ 63760b57cec5SDimitry Andric CXIndexOpt_IndexFunctionLocalSymbols = 0x2, 63770b57cec5SDimitry Andric 63780b57cec5SDimitry Andric /** 63790b57cec5SDimitry Andric * Implicit function/class template instantiations should be indexed. 63800b57cec5SDimitry Andric * If this is not set, implicit instantiations will be ignored. 63810b57cec5SDimitry Andric */ 63820b57cec5SDimitry Andric CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4, 63830b57cec5SDimitry Andric 63840b57cec5SDimitry Andric /** 63850b57cec5SDimitry Andric * Suppress all compiler warnings when parsing for indexing. 63860b57cec5SDimitry Andric */ 63870b57cec5SDimitry Andric CXIndexOpt_SuppressWarnings = 0x8, 63880b57cec5SDimitry Andric 63890b57cec5SDimitry Andric /** 63900b57cec5SDimitry Andric * Skip a function/method body that was already parsed during an 63910b57cec5SDimitry Andric * indexing session associated with a \c CXIndexAction object. 63920b57cec5SDimitry Andric * Bodies in system headers are always skipped. 63930b57cec5SDimitry Andric */ 63940b57cec5SDimitry Andric CXIndexOpt_SkipParsedBodiesInSession = 0x10 63950b57cec5SDimitry Andric 63960b57cec5SDimitry Andric } CXIndexOptFlags; 63970b57cec5SDimitry Andric 63980b57cec5SDimitry Andric /** 63990b57cec5SDimitry Andric * Index the given source file and the translation unit corresponding 64000b57cec5SDimitry Andric * to that file via callbacks implemented through #IndexerCallbacks. 64010b57cec5SDimitry Andric * 64020b57cec5SDimitry Andric * \param client_data pointer data supplied by the client, which will 64030b57cec5SDimitry Andric * be passed to the invoked callbacks. 64040b57cec5SDimitry Andric * 64050b57cec5SDimitry Andric * \param index_callbacks Pointer to indexing callbacks that the client 64060b57cec5SDimitry Andric * implements. 64070b57cec5SDimitry Andric * 64080b57cec5SDimitry Andric * \param index_callbacks_size Size of #IndexerCallbacks structure that gets 64090b57cec5SDimitry Andric * passed in index_callbacks. 64100b57cec5SDimitry Andric * 64110b57cec5SDimitry Andric * \param index_options A bitmask of options that affects how indexing is 64120b57cec5SDimitry Andric * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags. 64130b57cec5SDimitry Andric * 64140b57cec5SDimitry Andric * \param[out] out_TU pointer to store a \c CXTranslationUnit that can be 64150b57cec5SDimitry Andric * reused after indexing is finished. Set to \c NULL if you do not require it. 64160b57cec5SDimitry Andric * 64170b57cec5SDimitry Andric * \returns 0 on success or if there were errors from which the compiler could 64180b57cec5SDimitry Andric * recover. If there is a failure from which there is no recovery, returns 64190b57cec5SDimitry Andric * a non-zero \c CXErrorCode. 64200b57cec5SDimitry Andric * 64210b57cec5SDimitry Andric * The rest of the parameters are the same as #clang_parseTranslationUnit. 64220b57cec5SDimitry Andric */ 64235ffd83dbSDimitry Andric CINDEX_LINKAGE int clang_indexSourceFile( 64245ffd83dbSDimitry Andric CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks, 64255ffd83dbSDimitry Andric unsigned index_callbacks_size, unsigned index_options, 64265ffd83dbSDimitry Andric const char *source_filename, const char *const *command_line_args, 64275ffd83dbSDimitry Andric int num_command_line_args, struct CXUnsavedFile *unsaved_files, 64285ffd83dbSDimitry Andric unsigned num_unsaved_files, CXTranslationUnit *out_TU, unsigned TU_options); 64290b57cec5SDimitry Andric 64300b57cec5SDimitry Andric /** 64310b57cec5SDimitry Andric * Same as clang_indexSourceFile but requires a full command line 64320b57cec5SDimitry Andric * for \c command_line_args including argv[0]. This is useful if the standard 64330b57cec5SDimitry Andric * library paths are relative to the binary. 64340b57cec5SDimitry Andric */ 64350b57cec5SDimitry Andric CINDEX_LINKAGE int clang_indexSourceFileFullArgv( 64360b57cec5SDimitry Andric CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks, 64370b57cec5SDimitry Andric unsigned index_callbacks_size, unsigned index_options, 64380b57cec5SDimitry Andric const char *source_filename, const char *const *command_line_args, 64390b57cec5SDimitry Andric int num_command_line_args, struct CXUnsavedFile *unsaved_files, 64400b57cec5SDimitry Andric unsigned num_unsaved_files, CXTranslationUnit *out_TU, unsigned TU_options); 64410b57cec5SDimitry Andric 64420b57cec5SDimitry Andric /** 64430b57cec5SDimitry Andric * Index the given translation unit via callbacks implemented through 64440b57cec5SDimitry Andric * #IndexerCallbacks. 64450b57cec5SDimitry Andric * 64460b57cec5SDimitry Andric * The order of callback invocations is not guaranteed to be the same as 64470b57cec5SDimitry Andric * when indexing a source file. The high level order will be: 64480b57cec5SDimitry Andric * 64490b57cec5SDimitry Andric * -Preprocessor callbacks invocations 64500b57cec5SDimitry Andric * -Declaration/reference callbacks invocations 64510b57cec5SDimitry Andric * -Diagnostic callback invocations 64520b57cec5SDimitry Andric * 64530b57cec5SDimitry Andric * The parameters are the same as #clang_indexSourceFile. 64540b57cec5SDimitry Andric * 64550b57cec5SDimitry Andric * \returns If there is a failure from which there is no recovery, returns 64560b57cec5SDimitry Andric * non-zero, otherwise returns 0. 64570b57cec5SDimitry Andric */ 64585ffd83dbSDimitry Andric CINDEX_LINKAGE int clang_indexTranslationUnit( 64595ffd83dbSDimitry Andric CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks, 64605ffd83dbSDimitry Andric unsigned index_callbacks_size, unsigned index_options, CXTranslationUnit); 64610b57cec5SDimitry Andric 64620b57cec5SDimitry Andric /** 64630b57cec5SDimitry Andric * Retrieve the CXIdxFile, file, line, column, and offset represented by 64640b57cec5SDimitry Andric * the given CXIdxLoc. 64650b57cec5SDimitry Andric * 64660b57cec5SDimitry Andric * If the location refers into a macro expansion, retrieves the 64670b57cec5SDimitry Andric * location of the macro expansion and if it refers into a macro argument 64680b57cec5SDimitry Andric * retrieves the location of the argument. 64690b57cec5SDimitry Andric */ 64700b57cec5SDimitry Andric CINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc, 64710b57cec5SDimitry Andric CXIdxClientFile *indexFile, 64725ffd83dbSDimitry Andric CXFile *file, unsigned *line, 64730b57cec5SDimitry Andric unsigned *column, 64740b57cec5SDimitry Andric unsigned *offset); 64750b57cec5SDimitry Andric 64760b57cec5SDimitry Andric /** 64770b57cec5SDimitry Andric * Retrieve the CXSourceLocation represented by the given CXIdxLoc. 64780b57cec5SDimitry Andric */ 64790b57cec5SDimitry Andric CINDEX_LINKAGE 64800b57cec5SDimitry Andric CXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc); 64810b57cec5SDimitry Andric 64820b57cec5SDimitry Andric /** 64830b57cec5SDimitry Andric * Visitor invoked for each field found by a traversal. 64840b57cec5SDimitry Andric * 64850b57cec5SDimitry Andric * This visitor function will be invoked for each field found by 64860b57cec5SDimitry Andric * \c clang_Type_visitFields. Its first argument is the cursor being 64870b57cec5SDimitry Andric * visited, its second argument is the client data provided to 64880b57cec5SDimitry Andric * \c clang_Type_visitFields. 64890b57cec5SDimitry Andric * 64900b57cec5SDimitry Andric * The visitor should return one of the \c CXVisitorResult values 64910b57cec5SDimitry Andric * to direct \c clang_Type_visitFields. 64920b57cec5SDimitry Andric */ 64930b57cec5SDimitry Andric typedef enum CXVisitorResult (*CXFieldVisitor)(CXCursor C, 64940b57cec5SDimitry Andric CXClientData client_data); 64950b57cec5SDimitry Andric 64960b57cec5SDimitry Andric /** 64970b57cec5SDimitry Andric * Visit the fields of a particular type. 64980b57cec5SDimitry Andric * 64990b57cec5SDimitry Andric * This function visits all the direct fields of the given cursor, 65000b57cec5SDimitry Andric * invoking the given \p visitor function with the cursors of each 65010b57cec5SDimitry Andric * visited field. The traversal may be ended prematurely, if 65020b57cec5SDimitry Andric * the visitor returns \c CXFieldVisit_Break. 65030b57cec5SDimitry Andric * 65040b57cec5SDimitry Andric * \param T the record type whose field may be visited. 65050b57cec5SDimitry Andric * 65060b57cec5SDimitry Andric * \param visitor the visitor function that will be invoked for each 65070b57cec5SDimitry Andric * field of \p T. 65080b57cec5SDimitry Andric * 65090b57cec5SDimitry Andric * \param client_data pointer data supplied by the client, which will 65100b57cec5SDimitry Andric * be passed to the visitor each time it is invoked. 65110b57cec5SDimitry Andric * 65120b57cec5SDimitry Andric * \returns a non-zero value if the traversal was terminated 65130b57cec5SDimitry Andric * prematurely by the visitor returning \c CXFieldVisit_Break. 65140b57cec5SDimitry Andric */ 65155ffd83dbSDimitry Andric CINDEX_LINKAGE unsigned clang_Type_visitFields(CXType T, CXFieldVisitor visitor, 65160b57cec5SDimitry Andric CXClientData client_data); 65170b57cec5SDimitry Andric 65180b57cec5SDimitry Andric /** 651906c3fb27SDimitry Andric * Describes the kind of binary operators. 652006c3fb27SDimitry Andric */ 652106c3fb27SDimitry Andric enum CXBinaryOperatorKind { 652206c3fb27SDimitry Andric /** This value describes cursors which are not binary operators. */ 652306c3fb27SDimitry Andric CXBinaryOperator_Invalid, 652406c3fb27SDimitry Andric /** C++ Pointer - to - member operator. */ 652506c3fb27SDimitry Andric CXBinaryOperator_PtrMemD, 652606c3fb27SDimitry Andric /** C++ Pointer - to - member operator. */ 652706c3fb27SDimitry Andric CXBinaryOperator_PtrMemI, 652806c3fb27SDimitry Andric /** Multiplication operator. */ 652906c3fb27SDimitry Andric CXBinaryOperator_Mul, 653006c3fb27SDimitry Andric /** Division operator. */ 653106c3fb27SDimitry Andric CXBinaryOperator_Div, 653206c3fb27SDimitry Andric /** Remainder operator. */ 653306c3fb27SDimitry Andric CXBinaryOperator_Rem, 653406c3fb27SDimitry Andric /** Addition operator. */ 653506c3fb27SDimitry Andric CXBinaryOperator_Add, 653606c3fb27SDimitry Andric /** Subtraction operator. */ 653706c3fb27SDimitry Andric CXBinaryOperator_Sub, 653806c3fb27SDimitry Andric /** Bitwise shift left operator. */ 653906c3fb27SDimitry Andric CXBinaryOperator_Shl, 654006c3fb27SDimitry Andric /** Bitwise shift right operator. */ 654106c3fb27SDimitry Andric CXBinaryOperator_Shr, 654206c3fb27SDimitry Andric /** C++ three-way comparison (spaceship) operator. */ 654306c3fb27SDimitry Andric CXBinaryOperator_Cmp, 654406c3fb27SDimitry Andric /** Less than operator. */ 654506c3fb27SDimitry Andric CXBinaryOperator_LT, 654606c3fb27SDimitry Andric /** Greater than operator. */ 654706c3fb27SDimitry Andric CXBinaryOperator_GT, 654806c3fb27SDimitry Andric /** Less or equal operator. */ 654906c3fb27SDimitry Andric CXBinaryOperator_LE, 655006c3fb27SDimitry Andric /** Greater or equal operator. */ 655106c3fb27SDimitry Andric CXBinaryOperator_GE, 655206c3fb27SDimitry Andric /** Equal operator. */ 655306c3fb27SDimitry Andric CXBinaryOperator_EQ, 655406c3fb27SDimitry Andric /** Not equal operator. */ 655506c3fb27SDimitry Andric CXBinaryOperator_NE, 655606c3fb27SDimitry Andric /** Bitwise AND operator. */ 655706c3fb27SDimitry Andric CXBinaryOperator_And, 655806c3fb27SDimitry Andric /** Bitwise XOR operator. */ 655906c3fb27SDimitry Andric CXBinaryOperator_Xor, 656006c3fb27SDimitry Andric /** Bitwise OR operator. */ 656106c3fb27SDimitry Andric CXBinaryOperator_Or, 656206c3fb27SDimitry Andric /** Logical AND operator. */ 656306c3fb27SDimitry Andric CXBinaryOperator_LAnd, 656406c3fb27SDimitry Andric /** Logical OR operator. */ 656506c3fb27SDimitry Andric CXBinaryOperator_LOr, 656606c3fb27SDimitry Andric /** Assignment operator. */ 656706c3fb27SDimitry Andric CXBinaryOperator_Assign, 656806c3fb27SDimitry Andric /** Multiplication assignment operator. */ 656906c3fb27SDimitry Andric CXBinaryOperator_MulAssign, 657006c3fb27SDimitry Andric /** Division assignment operator. */ 657106c3fb27SDimitry Andric CXBinaryOperator_DivAssign, 657206c3fb27SDimitry Andric /** Remainder assignment operator. */ 657306c3fb27SDimitry Andric CXBinaryOperator_RemAssign, 657406c3fb27SDimitry Andric /** Addition assignment operator. */ 657506c3fb27SDimitry Andric CXBinaryOperator_AddAssign, 657606c3fb27SDimitry Andric /** Subtraction assignment operator. */ 657706c3fb27SDimitry Andric CXBinaryOperator_SubAssign, 657806c3fb27SDimitry Andric /** Bitwise shift left assignment operator. */ 657906c3fb27SDimitry Andric CXBinaryOperator_ShlAssign, 658006c3fb27SDimitry Andric /** Bitwise shift right assignment operator. */ 658106c3fb27SDimitry Andric CXBinaryOperator_ShrAssign, 658206c3fb27SDimitry Andric /** Bitwise AND assignment operator. */ 658306c3fb27SDimitry Andric CXBinaryOperator_AndAssign, 658406c3fb27SDimitry Andric /** Bitwise XOR assignment operator. */ 658506c3fb27SDimitry Andric CXBinaryOperator_XorAssign, 658606c3fb27SDimitry Andric /** Bitwise OR assignment operator. */ 658706c3fb27SDimitry Andric CXBinaryOperator_OrAssign, 658806c3fb27SDimitry Andric /** Comma operator. */ 658906c3fb27SDimitry Andric CXBinaryOperator_Comma 659006c3fb27SDimitry Andric }; 659106c3fb27SDimitry Andric 659206c3fb27SDimitry Andric /** 659306c3fb27SDimitry Andric * Retrieve the spelling of a given CXBinaryOperatorKind. 659406c3fb27SDimitry Andric */ 659506c3fb27SDimitry Andric CINDEX_LINKAGE CXString 659606c3fb27SDimitry Andric clang_getBinaryOperatorKindSpelling(enum CXBinaryOperatorKind kind); 659706c3fb27SDimitry Andric 659806c3fb27SDimitry Andric /** 659906c3fb27SDimitry Andric * Retrieve the binary operator kind of this cursor. 660006c3fb27SDimitry Andric * 660106c3fb27SDimitry Andric * If this cursor is not a binary operator then returns Invalid. 660206c3fb27SDimitry Andric */ 660306c3fb27SDimitry Andric CINDEX_LINKAGE enum CXBinaryOperatorKind 660406c3fb27SDimitry Andric clang_getCursorBinaryOperatorKind(CXCursor cursor); 660506c3fb27SDimitry Andric 660606c3fb27SDimitry Andric /** 660706c3fb27SDimitry Andric * Describes the kind of unary operators. 660806c3fb27SDimitry Andric */ 660906c3fb27SDimitry Andric enum CXUnaryOperatorKind { 661006c3fb27SDimitry Andric /** This value describes cursors which are not unary operators. */ 661106c3fb27SDimitry Andric CXUnaryOperator_Invalid, 661206c3fb27SDimitry Andric /** Postfix increment operator. */ 661306c3fb27SDimitry Andric CXUnaryOperator_PostInc, 661406c3fb27SDimitry Andric /** Postfix decrement operator. */ 661506c3fb27SDimitry Andric CXUnaryOperator_PostDec, 661606c3fb27SDimitry Andric /** Prefix increment operator. */ 661706c3fb27SDimitry Andric CXUnaryOperator_PreInc, 661806c3fb27SDimitry Andric /** Prefix decrement operator. */ 661906c3fb27SDimitry Andric CXUnaryOperator_PreDec, 662006c3fb27SDimitry Andric /** Address of operator. */ 662106c3fb27SDimitry Andric CXUnaryOperator_AddrOf, 662206c3fb27SDimitry Andric /** Dereference operator. */ 662306c3fb27SDimitry Andric CXUnaryOperator_Deref, 662406c3fb27SDimitry Andric /** Plus operator. */ 662506c3fb27SDimitry Andric CXUnaryOperator_Plus, 662606c3fb27SDimitry Andric /** Minus operator. */ 662706c3fb27SDimitry Andric CXUnaryOperator_Minus, 662806c3fb27SDimitry Andric /** Not operator. */ 662906c3fb27SDimitry Andric CXUnaryOperator_Not, 663006c3fb27SDimitry Andric /** LNot operator. */ 663106c3fb27SDimitry Andric CXUnaryOperator_LNot, 663206c3fb27SDimitry Andric /** "__real expr" operator. */ 663306c3fb27SDimitry Andric CXUnaryOperator_Real, 663406c3fb27SDimitry Andric /** "__imag expr" operator. */ 663506c3fb27SDimitry Andric CXUnaryOperator_Imag, 663606c3fb27SDimitry Andric /** __extension__ marker operator. */ 663706c3fb27SDimitry Andric CXUnaryOperator_Extension, 663806c3fb27SDimitry Andric /** C++ co_await operator. */ 663906c3fb27SDimitry Andric CXUnaryOperator_Coawait 664006c3fb27SDimitry Andric }; 664106c3fb27SDimitry Andric 664206c3fb27SDimitry Andric /** 664306c3fb27SDimitry Andric * Retrieve the spelling of a given CXUnaryOperatorKind. 664406c3fb27SDimitry Andric */ 664506c3fb27SDimitry Andric CINDEX_LINKAGE CXString 664606c3fb27SDimitry Andric clang_getUnaryOperatorKindSpelling(enum CXUnaryOperatorKind kind); 664706c3fb27SDimitry Andric 664806c3fb27SDimitry Andric /** 664906c3fb27SDimitry Andric * Retrieve the unary operator kind of this cursor. 665006c3fb27SDimitry Andric * 665106c3fb27SDimitry Andric * If this cursor is not a unary operator then returns Invalid. 665206c3fb27SDimitry Andric */ 665306c3fb27SDimitry Andric CINDEX_LINKAGE enum CXUnaryOperatorKind 665406c3fb27SDimitry Andric clang_getCursorUnaryOperatorKind(CXCursor cursor); 665506c3fb27SDimitry Andric 665606c3fb27SDimitry Andric /** 66570b57cec5SDimitry Andric * @} 66580b57cec5SDimitry Andric */ 66590b57cec5SDimitry Andric 66600b57cec5SDimitry Andric /** 66610b57cec5SDimitry Andric * @} 66620b57cec5SDimitry Andric */ 66630b57cec5SDimitry Andric 6664480093f4SDimitry Andric LLVM_CLANG_C_EXTERN_C_END 6665480093f4SDimitry Andric 66660b57cec5SDimitry Andric #endif 6667