Path: blob/main/contrib/llvm-project/clang/include/clang-c/Index.h
35233 views
/*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\1|* *|2|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|3|* Exceptions. *|4|* See https://llvm.org/LICENSE.txt for license information. *|5|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|6|* *|7|*===----------------------------------------------------------------------===*|8|* *|9|* This header provides a public interface to a Clang library for extracting *|10|* high-level symbol information from source files without exposing the full *|11|* Clang C++ API. *|12|* *|13\*===----------------------------------------------------------------------===*/1415#ifndef LLVM_CLANG_C_INDEX_H16#define LLVM_CLANG_C_INDEX_H1718#include "clang-c/BuildSystem.h"19#include "clang-c/CXDiagnostic.h"20#include "clang-c/CXErrorCode.h"21#include "clang-c/CXFile.h"22#include "clang-c/CXSourceLocation.h"23#include "clang-c/CXString.h"24#include "clang-c/ExternC.h"25#include "clang-c/Platform.h"2627/**28* The version constants for the libclang API.29* CINDEX_VERSION_MINOR should increase when there are API additions.30* CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes.31*32* The policy about the libclang API was always to keep it source and ABI33* compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.34*/35#define CINDEX_VERSION_MAJOR 036#define CINDEX_VERSION_MINOR 643738#define CINDEX_VERSION_ENCODE(major, minor) (((major)*10000) + ((minor)*1))3940#define CINDEX_VERSION \41CINDEX_VERSION_ENCODE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR)4243#define CINDEX_VERSION_STRINGIZE_(major, minor) #major "." #minor44#define CINDEX_VERSION_STRINGIZE(major, minor) \45CINDEX_VERSION_STRINGIZE_(major, minor)4647#define CINDEX_VERSION_STRING \48CINDEX_VERSION_STRINGIZE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR)4950#ifndef __has_feature51#define __has_feature(feature) 052#endif5354LLVM_CLANG_C_EXTERN_C_BEGIN5556/** \defgroup CINDEX libclang: C Interface to Clang57*58* The C Interface to Clang provides a relatively small API that exposes59* facilities for parsing source code into an abstract syntax tree (AST),60* loading already-parsed ASTs, traversing the AST, associating61* physical source locations with elements within the AST, and other62* facilities that support Clang-based development tools.63*64* This C interface to Clang will never provide all of the information65* representation stored in Clang's C++ AST, nor should it: the intent is to66* maintain an API that is relatively stable from one release to the next,67* providing only the basic functionality needed to support development tools.68*69* To avoid namespace pollution, data types are prefixed with "CX" and70* functions are prefixed with "clang_".71*72* @{73*/7475/**76* An "index" that consists of a set of translation units that would77* typically be linked together into an executable or library.78*/79typedef void *CXIndex;8081/**82* An opaque type representing target information for a given translation83* unit.84*/85typedef struct CXTargetInfoImpl *CXTargetInfo;8687/**88* A single translation unit, which resides in an index.89*/90typedef struct CXTranslationUnitImpl *CXTranslationUnit;9192/**93* Opaque pointer representing client data that will be passed through94* to various callbacks and visitors.95*/96typedef void *CXClientData;9798/**99* Provides the contents of a file that has not yet been saved to disk.100*101* Each CXUnsavedFile instance provides the name of a file on the102* system along with the current contents of that file that have not103* yet been saved to disk.104*/105struct CXUnsavedFile {106/**107* The file whose contents have not yet been saved.108*109* This file must already exist in the file system.110*/111const char *Filename;112113/**114* A buffer containing the unsaved contents of this file.115*/116const char *Contents;117118/**119* The length of the unsaved contents of this buffer.120*/121unsigned long Length;122};123124/**125* Describes the availability of a particular entity, which indicates126* whether the use of this entity will result in a warning or error due to127* it being deprecated or unavailable.128*/129enum CXAvailabilityKind {130/**131* The entity is available.132*/133CXAvailability_Available,134/**135* The entity is available, but has been deprecated (and its use is136* not recommended).137*/138CXAvailability_Deprecated,139/**140* The entity is not available; any use of it will be an error.141*/142CXAvailability_NotAvailable,143/**144* The entity is available, but not accessible; any use of it will be145* an error.146*/147CXAvailability_NotAccessible148};149150/**151* Describes a version number of the form major.minor.subminor.152*/153typedef struct CXVersion {154/**155* The major version number, e.g., the '10' in '10.7.3'. A negative156* value indicates that there is no version number at all.157*/158int Major;159/**160* The minor version number, e.g., the '7' in '10.7.3'. This value161* will be negative if no minor version number was provided, e.g., for162* version '10'.163*/164int Minor;165/**166* The subminor version number, e.g., the '3' in '10.7.3'. This value167* will be negative if no minor or subminor version number was provided,168* e.g., in version '10' or '10.7'.169*/170int Subminor;171} CXVersion;172173/**174* Describes the exception specification of a cursor.175*176* A negative value indicates that the cursor is not a function declaration.177*/178enum CXCursor_ExceptionSpecificationKind {179/**180* The cursor has no exception specification.181*/182CXCursor_ExceptionSpecificationKind_None,183184/**185* The cursor has exception specification throw()186*/187CXCursor_ExceptionSpecificationKind_DynamicNone,188189/**190* The cursor has exception specification throw(T1, T2)191*/192CXCursor_ExceptionSpecificationKind_Dynamic,193194/**195* The cursor has exception specification throw(...).196*/197CXCursor_ExceptionSpecificationKind_MSAny,198199/**200* The cursor has exception specification basic noexcept.201*/202CXCursor_ExceptionSpecificationKind_BasicNoexcept,203204/**205* The cursor has exception specification computed noexcept.206*/207CXCursor_ExceptionSpecificationKind_ComputedNoexcept,208209/**210* The exception specification has not yet been evaluated.211*/212CXCursor_ExceptionSpecificationKind_Unevaluated,213214/**215* The exception specification has not yet been instantiated.216*/217CXCursor_ExceptionSpecificationKind_Uninstantiated,218219/**220* The exception specification has not been parsed yet.221*/222CXCursor_ExceptionSpecificationKind_Unparsed,223224/**225* The cursor has a __declspec(nothrow) exception specification.226*/227CXCursor_ExceptionSpecificationKind_NoThrow228};229230/**231* Provides a shared context for creating translation units.232*233* It provides two options:234*235* - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"236* declarations (when loading any new translation units). A "local" declaration237* is one that belongs in the translation unit itself and not in a precompiled238* header that was used by the translation unit. If zero, all declarations239* will be enumerated.240*241* Here is an example:242*243* \code244* // excludeDeclsFromPCH = 1, displayDiagnostics=1245* Idx = clang_createIndex(1, 1);246*247* // IndexTest.pch was produced with the following command:248* // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"249* TU = clang_createTranslationUnit(Idx, "IndexTest.pch");250*251* // This will load all the symbols from 'IndexTest.pch'252* clang_visitChildren(clang_getTranslationUnitCursor(TU),253* TranslationUnitVisitor, 0);254* clang_disposeTranslationUnit(TU);255*256* // This will load all the symbols from 'IndexTest.c', excluding symbols257* // from 'IndexTest.pch'.258* char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };259* TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,260* 0, 0);261* clang_visitChildren(clang_getTranslationUnitCursor(TU),262* TranslationUnitVisitor, 0);263* clang_disposeTranslationUnit(TU);264* \endcode265*266* This process of creating the 'pch', loading it separately, and using it (via267* -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks268* (which gives the indexer the same performance benefit as the compiler).269*/270CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,271int displayDiagnostics);272273/**274* Destroy the given index.275*276* The index must not be destroyed until all of the translation units created277* within that index have been destroyed.278*/279CINDEX_LINKAGE void clang_disposeIndex(CXIndex index);280281typedef enum {282/**283* Use the default value of an option that may depend on the process284* environment.285*/286CXChoice_Default = 0,287/**288* Enable the option.289*/290CXChoice_Enabled = 1,291/**292* Disable the option.293*/294CXChoice_Disabled = 2295} CXChoice;296297typedef enum {298/**299* Used to indicate that no special CXIndex options are needed.300*/301CXGlobalOpt_None = 0x0,302303/**304* Used to indicate that threads that libclang creates for indexing305* purposes should use background priority.306*307* Affects #clang_indexSourceFile, #clang_indexTranslationUnit,308* #clang_parseTranslationUnit, #clang_saveTranslationUnit.309*/310CXGlobalOpt_ThreadBackgroundPriorityForIndexing = 0x1,311312/**313* Used to indicate that threads that libclang creates for editing314* purposes should use background priority.315*316* Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt,317* #clang_annotateTokens318*/319CXGlobalOpt_ThreadBackgroundPriorityForEditing = 0x2,320321/**322* Used to indicate that all threads that libclang creates should use323* background priority.324*/325CXGlobalOpt_ThreadBackgroundPriorityForAll =326CXGlobalOpt_ThreadBackgroundPriorityForIndexing |327CXGlobalOpt_ThreadBackgroundPriorityForEditing328329} CXGlobalOptFlags;330331/**332* Index initialization options.333*334* 0 is the default value of each member of this struct except for Size.335* Initialize the struct in one of the following three ways to avoid adapting336* code each time a new member is added to it:337* \code338* CXIndexOptions Opts;339* memset(&Opts, 0, sizeof(Opts));340* Opts.Size = sizeof(CXIndexOptions);341* \endcode342* or explicitly initialize the first data member and zero-initialize the rest:343* \code344* CXIndexOptions Opts = { sizeof(CXIndexOptions) };345* \endcode346* or to prevent the -Wmissing-field-initializers warning for the above version:347* \code348* CXIndexOptions Opts{};349* Opts.Size = sizeof(CXIndexOptions);350* \endcode351*/352typedef struct CXIndexOptions {353/**354* The size of struct CXIndexOptions used for option versioning.355*356* Always initialize this member to sizeof(CXIndexOptions), or assign357* sizeof(CXIndexOptions) to it right after creating a CXIndexOptions object.358*/359unsigned Size;360/**361* A CXChoice enumerator that specifies the indexing priority policy.362* \sa CXGlobalOpt_ThreadBackgroundPriorityForIndexing363*/364unsigned char ThreadBackgroundPriorityForIndexing;365/**366* A CXChoice enumerator that specifies the editing priority policy.367* \sa CXGlobalOpt_ThreadBackgroundPriorityForEditing368*/369unsigned char ThreadBackgroundPriorityForEditing;370/**371* \see clang_createIndex()372*/373unsigned ExcludeDeclarationsFromPCH : 1;374/**375* \see clang_createIndex()376*/377unsigned DisplayDiagnostics : 1;378/**379* Store PCH in memory. If zero, PCH are stored in temporary files.380*/381unsigned StorePreamblesInMemory : 1;382unsigned /*Reserved*/ : 13;383384/**385* The path to a directory, in which to store temporary PCH files. If null or386* empty, the default system temporary directory is used. These PCH files are387* deleted on clean exit but stay on disk if the program crashes or is killed.388*389* This option is ignored if \a StorePreamblesInMemory is non-zero.390*391* Libclang does not create the directory at the specified path in the file392* system. Therefore it must exist, or storing PCH files will fail.393*/394const char *PreambleStoragePath;395/**396* Specifies a path which will contain log files for certain libclang397* invocations. A null value implies that libclang invocations are not logged.398*/399const char *InvocationEmissionPath;400} CXIndexOptions;401402/**403* Provides a shared context for creating translation units.404*405* Call this function instead of clang_createIndex() if you need to configure406* the additional options in CXIndexOptions.407*408* \returns The created index or null in case of error, such as an unsupported409* value of options->Size.410*411* For example:412* \code413* CXIndex createIndex(const char *ApplicationTemporaryPath) {414* const int ExcludeDeclarationsFromPCH = 1;415* const int DisplayDiagnostics = 1;416* CXIndex Idx;417* #if CINDEX_VERSION_MINOR >= 64418* CXIndexOptions Opts;419* memset(&Opts, 0, sizeof(Opts));420* Opts.Size = sizeof(CXIndexOptions);421* Opts.ThreadBackgroundPriorityForIndexing = 1;422* Opts.ExcludeDeclarationsFromPCH = ExcludeDeclarationsFromPCH;423* Opts.DisplayDiagnostics = DisplayDiagnostics;424* Opts.PreambleStoragePath = ApplicationTemporaryPath;425* Idx = clang_createIndexWithOptions(&Opts);426* if (Idx)427* return Idx;428* fprintf(stderr,429* "clang_createIndexWithOptions() failed. "430* "CINDEX_VERSION_MINOR = %d, sizeof(CXIndexOptions) = %u\n",431* CINDEX_VERSION_MINOR, Opts.Size);432* #else433* (void)ApplicationTemporaryPath;434* #endif435* Idx = clang_createIndex(ExcludeDeclarationsFromPCH, DisplayDiagnostics);436* clang_CXIndex_setGlobalOptions(437* Idx, clang_CXIndex_getGlobalOptions(Idx) |438* CXGlobalOpt_ThreadBackgroundPriorityForIndexing);439* return Idx;440* }441* \endcode442*443* \sa clang_createIndex()444*/445CINDEX_LINKAGE CXIndex446clang_createIndexWithOptions(const CXIndexOptions *options);447448/**449* Sets general options associated with a CXIndex.450*451* This function is DEPRECATED. Set452* CXIndexOptions::ThreadBackgroundPriorityForIndexing and/or453* CXIndexOptions::ThreadBackgroundPriorityForEditing and call454* clang_createIndexWithOptions() instead.455*456* For example:457* \code458* CXIndex idx = ...;459* clang_CXIndex_setGlobalOptions(idx,460* clang_CXIndex_getGlobalOptions(idx) |461* CXGlobalOpt_ThreadBackgroundPriorityForIndexing);462* \endcode463*464* \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.465*/466CINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options);467468/**469* Gets the general options associated with a CXIndex.470*471* This function allows to obtain the final option values used by libclang after472* specifying the option policies via CXChoice enumerators.473*474* \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that475* are associated with the given CXIndex object.476*/477CINDEX_LINKAGE unsigned clang_CXIndex_getGlobalOptions(CXIndex);478479/**480* Sets the invocation emission path option in a CXIndex.481*482* This function is DEPRECATED. Set CXIndexOptions::InvocationEmissionPath and483* call clang_createIndexWithOptions() instead.484*485* The invocation emission path specifies a path which will contain log486* files for certain libclang invocations. A null value (default) implies that487* libclang invocations are not logged..488*/489CINDEX_LINKAGE void490clang_CXIndex_setInvocationEmissionPathOption(CXIndex, const char *Path);491492/**493* Determine whether the given header is guarded against494* multiple inclusions, either with the conventional495* \#ifndef/\#define/\#endif macro guards or with \#pragma once.496*/497CINDEX_LINKAGE unsigned clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu,498CXFile file);499500/**501* Retrieve a file handle within the given translation unit.502*503* \param tu the translation unit504*505* \param file_name the name of the file.506*507* \returns the file handle for the named file in the translation unit \p tu,508* or a NULL file handle if the file was not a part of this translation unit.509*/510CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu,511const char *file_name);512513/**514* Retrieve the buffer associated with the given file.515*516* \param tu the translation unit517*518* \param file the file for which to retrieve the buffer.519*520* \param size [out] if non-NULL, will be set to the size of the buffer.521*522* \returns a pointer to the buffer in memory that holds the contents of523* \p file, or a NULL pointer when the file is not loaded.524*/525CINDEX_LINKAGE const char *clang_getFileContents(CXTranslationUnit tu,526CXFile file, size_t *size);527528/**529* Retrieves the source location associated with a given file/line/column530* in a particular translation unit.531*/532CINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu,533CXFile file, unsigned line,534unsigned column);535/**536* Retrieves the source location associated with a given character offset537* in a particular translation unit.538*/539CINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu,540CXFile file,541unsigned offset);542543/**544* Retrieve all ranges that were skipped by the preprocessor.545*546* The preprocessor will skip lines when they are surrounded by an547* if/ifdef/ifndef directive whose condition does not evaluate to true.548*/549CINDEX_LINKAGE CXSourceRangeList *clang_getSkippedRanges(CXTranslationUnit tu,550CXFile file);551552/**553* Retrieve all ranges from all files that were skipped by the554* preprocessor.555*556* The preprocessor will skip lines when they are surrounded by an557* if/ifdef/ifndef directive whose condition does not evaluate to true.558*/559CINDEX_LINKAGE CXSourceRangeList *560clang_getAllSkippedRanges(CXTranslationUnit tu);561562/**563* Determine the number of diagnostics produced for the given564* translation unit.565*/566CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit);567568/**569* Retrieve a diagnostic associated with the given translation unit.570*571* \param Unit the translation unit to query.572* \param Index the zero-based diagnostic number to retrieve.573*574* \returns the requested diagnostic. This diagnostic must be freed575* via a call to \c clang_disposeDiagnostic().576*/577CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit,578unsigned Index);579580/**581* Retrieve the complete set of diagnostics associated with a582* translation unit.583*584* \param Unit the translation unit to query.585*/586CINDEX_LINKAGE CXDiagnosticSet587clang_getDiagnosticSetFromTU(CXTranslationUnit Unit);588589/**590* \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation591*592* The routines in this group provide the ability to create and destroy593* translation units from files, either by parsing the contents of the files or594* by reading in a serialized representation of a translation unit.595*596* @{597*/598599/**600* Get the original translation unit source file name.601*/602CINDEX_LINKAGE CXString603clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);604605/**606* Return the CXTranslationUnit for a given source file and the provided607* command line arguments one would pass to the compiler.608*609* Note: The 'source_filename' argument is optional. If the caller provides a610* NULL pointer, the name of the source file is expected to reside in the611* specified command line arguments.612*613* Note: When encountered in 'clang_command_line_args', the following options614* are ignored:615*616* '-c'617* '-emit-ast'618* '-fsyntax-only'619* '-o \<output file>' (both '-o' and '\<output file>' are ignored)620*621* \param CIdx The index object with which the translation unit will be622* associated.623*624* \param source_filename The name of the source file to load, or NULL if the625* source file is included in \p clang_command_line_args.626*627* \param num_clang_command_line_args The number of command-line arguments in628* \p clang_command_line_args.629*630* \param clang_command_line_args The command-line arguments that would be631* passed to the \c clang executable if it were being invoked out-of-process.632* These command-line options will be parsed and will affect how the translation633* unit is parsed. Note that the following options are ignored: '-c',634* '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'.635*636* \param num_unsaved_files the number of unsaved file entries in \p637* unsaved_files.638*639* \param unsaved_files the files that have not yet been saved to disk640* but may be required for code completion, including the contents of641* those files. The contents and name of these files (as specified by642* CXUnsavedFile) are copied when necessary, so the client only needs to643* guarantee their validity until the call to this function returns.644*/645CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile(646CXIndex CIdx, const char *source_filename, int num_clang_command_line_args,647const char *const *clang_command_line_args, unsigned num_unsaved_files,648struct CXUnsavedFile *unsaved_files);649650/**651* Same as \c clang_createTranslationUnit2, but returns652* the \c CXTranslationUnit instead of an error code. In case of an error this653* routine returns a \c NULL \c CXTranslationUnit, without further detailed654* error codes.655*/656CINDEX_LINKAGE CXTranslationUnit657clang_createTranslationUnit(CXIndex CIdx, const char *ast_filename);658659/**660* Create a translation unit from an AST file (\c -emit-ast).661*662* \param[out] out_TU A non-NULL pointer to store the created663* \c CXTranslationUnit.664*665* \returns Zero on success, otherwise returns an error code.666*/667CINDEX_LINKAGE enum CXErrorCode668clang_createTranslationUnit2(CXIndex CIdx, const char *ast_filename,669CXTranslationUnit *out_TU);670671/**672* Flags that control the creation of translation units.673*674* The enumerators in this enumeration type are meant to be bitwise675* ORed together to specify which options should be used when676* constructing the translation unit.677*/678enum CXTranslationUnit_Flags {679/**680* Used to indicate that no special translation-unit options are681* needed.682*/683CXTranslationUnit_None = 0x0,684685/**686* Used to indicate that the parser should construct a "detailed"687* preprocessing record, including all macro definitions and instantiations.688*689* Constructing a detailed preprocessing record requires more memory690* and time to parse, since the information contained in the record691* is usually not retained. However, it can be useful for692* applications that require more detailed information about the693* behavior of the preprocessor.694*/695CXTranslationUnit_DetailedPreprocessingRecord = 0x01,696697/**698* Used to indicate that the translation unit is incomplete.699*700* When a translation unit is considered "incomplete", semantic701* analysis that is typically performed at the end of the702* translation unit will be suppressed. For example, this suppresses703* the completion of tentative declarations in C and of704* instantiation of implicitly-instantiation function templates in705* C++. This option is typically used when parsing a header with the706* intent of producing a precompiled header.707*/708CXTranslationUnit_Incomplete = 0x02,709710/**711* Used to indicate that the translation unit should be built with an712* implicit precompiled header for the preamble.713*714* An implicit precompiled header is used as an optimization when a715* particular translation unit is likely to be reparsed many times716* when the sources aren't changing that often. In this case, an717* implicit precompiled header will be built containing all of the718* initial includes at the top of the main file (what we refer to as719* the "preamble" of the file). In subsequent parses, if the720* preamble or the files in it have not changed, \c721* clang_reparseTranslationUnit() will re-use the implicit722* precompiled header to improve parsing performance.723*/724CXTranslationUnit_PrecompiledPreamble = 0x04,725726/**727* Used to indicate that the translation unit should cache some728* code-completion results with each reparse of the source file.729*730* Caching of code-completion results is a performance optimization that731* introduces some overhead to reparsing but improves the performance of732* code-completion operations.733*/734CXTranslationUnit_CacheCompletionResults = 0x08,735736/**737* Used to indicate that the translation unit will be serialized with738* \c clang_saveTranslationUnit.739*740* This option is typically used when parsing a header with the intent of741* producing a precompiled header.742*/743CXTranslationUnit_ForSerialization = 0x10,744745/**746* DEPRECATED: Enabled chained precompiled preambles in C++.747*748* Note: this is a *temporary* option that is available only while749* we are testing C++ precompiled preamble support. It is deprecated.750*/751CXTranslationUnit_CXXChainedPCH = 0x20,752753/**754* Used to indicate that function/method bodies should be skipped while755* parsing.756*757* This option can be used to search for declarations/definitions while758* ignoring the usages.759*/760CXTranslationUnit_SkipFunctionBodies = 0x40,761762/**763* Used to indicate that brief documentation comments should be764* included into the set of code completions returned from this translation765* unit.766*/767CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 0x80,768769/**770* Used to indicate that the precompiled preamble should be created on771* the first parse. Otherwise it will be created on the first reparse. This772* trades runtime on the first parse (serializing the preamble takes time) for773* reduced runtime on the second parse (can now reuse the preamble).774*/775CXTranslationUnit_CreatePreambleOnFirstParse = 0x100,776777/**778* Do not stop processing when fatal errors are encountered.779*780* When fatal errors are encountered while parsing a translation unit,781* semantic analysis is typically stopped early when compiling code. A common782* source for fatal errors are unresolvable include files. For the783* purposes of an IDE, this is undesirable behavior and as much information784* as possible should be reported. Use this flag to enable this behavior.785*/786CXTranslationUnit_KeepGoing = 0x200,787788/**789* Sets the preprocessor in a mode for parsing a single file only.790*/791CXTranslationUnit_SingleFileParse = 0x400,792793/**794* Used in combination with CXTranslationUnit_SkipFunctionBodies to795* constrain the skipping of function bodies to the preamble.796*797* The function bodies of the main file are not skipped.798*/799CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 0x800,800801/**802* Used to indicate that attributed types should be included in CXType.803*/804CXTranslationUnit_IncludeAttributedTypes = 0x1000,805806/**807* Used to indicate that implicit attributes should be visited.808*/809CXTranslationUnit_VisitImplicitAttributes = 0x2000,810811/**812* Used to indicate that non-errors from included files should be ignored.813*814* If set, clang_getDiagnosticSetFromTU() will not report e.g. warnings from815* included files anymore. This speeds up clang_getDiagnosticSetFromTU() for816* the case where these warnings are not of interest, as for an IDE for817* example, which typically shows only the diagnostics in the main file.818*/819CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000,820821/**822* Tells the preprocessor not to skip excluded conditional blocks.823*/824CXTranslationUnit_RetainExcludedConditionalBlocks = 0x8000825};826827/**828* Returns the set of flags that is suitable for parsing a translation829* unit that is being edited.830*831* The set of flags returned provide options for \c clang_parseTranslationUnit()832* to indicate that the translation unit is likely to be reparsed many times,833* either explicitly (via \c clang_reparseTranslationUnit()) or implicitly834* (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag835* set contains an unspecified set of optimizations (e.g., the precompiled836* preamble) geared toward improving the performance of these routines. The837* set of optimizations enabled may change from one version to the next.838*/839CINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void);840841/**842* Same as \c clang_parseTranslationUnit2, but returns843* the \c CXTranslationUnit instead of an error code. In case of an error this844* routine returns a \c NULL \c CXTranslationUnit, without further detailed845* error codes.846*/847CINDEX_LINKAGE CXTranslationUnit clang_parseTranslationUnit(848CXIndex CIdx, const char *source_filename,849const char *const *command_line_args, int num_command_line_args,850struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,851unsigned options);852853/**854* Parse the given source file and the translation unit corresponding855* to that file.856*857* This routine is the main entry point for the Clang C API, providing the858* ability to parse a source file into a translation unit that can then be859* queried by other functions in the API. This routine accepts a set of860* command-line arguments so that the compilation can be configured in the same861* way that the compiler is configured on the command line.862*863* \param CIdx The index object with which the translation unit will be864* associated.865*866* \param source_filename The name of the source file to load, or NULL if the867* source file is included in \c command_line_args.868*869* \param command_line_args The command-line arguments that would be870* passed to the \c clang executable if it were being invoked out-of-process.871* These command-line options will be parsed and will affect how the translation872* unit is parsed. Note that the following options are ignored: '-c',873* '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'.874*875* \param num_command_line_args The number of command-line arguments in876* \c command_line_args.877*878* \param unsaved_files the files that have not yet been saved to disk879* but may be required for parsing, including the contents of880* those files. The contents and name of these files (as specified by881* CXUnsavedFile) are copied when necessary, so the client only needs to882* guarantee their validity until the call to this function returns.883*884* \param num_unsaved_files the number of unsaved file entries in \p885* unsaved_files.886*887* \param options A bitmask of options that affects how the translation unit888* is managed but not its compilation. This should be a bitwise OR of the889* CXTranslationUnit_XXX flags.890*891* \param[out] out_TU A non-NULL pointer to store the created892* \c CXTranslationUnit, describing the parsed code and containing any893* diagnostics produced by the compiler.894*895* \returns Zero on success, otherwise returns an error code.896*/897CINDEX_LINKAGE enum CXErrorCode clang_parseTranslationUnit2(898CXIndex CIdx, const char *source_filename,899const char *const *command_line_args, int num_command_line_args,900struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,901unsigned options, CXTranslationUnit *out_TU);902903/**904* Same as clang_parseTranslationUnit2 but requires a full command line905* for \c command_line_args including argv[0]. This is useful if the standard906* library paths are relative to the binary.907*/908CINDEX_LINKAGE enum CXErrorCode clang_parseTranslationUnit2FullArgv(909CXIndex CIdx, const char *source_filename,910const char *const *command_line_args, int num_command_line_args,911struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,912unsigned options, CXTranslationUnit *out_TU);913914/**915* Flags that control how translation units are saved.916*917* The enumerators in this enumeration type are meant to be bitwise918* ORed together to specify which options should be used when919* saving the translation unit.920*/921enum CXSaveTranslationUnit_Flags {922/**923* Used to indicate that no special saving options are needed.924*/925CXSaveTranslationUnit_None = 0x0926};927928/**929* Returns the set of flags that is suitable for saving a translation930* unit.931*932* The set of flags returned provide options for933* \c clang_saveTranslationUnit() by default. The returned flag934* set contains an unspecified set of options that save translation units with935* the most commonly-requested data.936*/937CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU);938939/**940* Describes the kind of error that occurred (if any) in a call to941* \c clang_saveTranslationUnit().942*/943enum CXSaveError {944/**945* Indicates that no error occurred while saving a translation unit.946*/947CXSaveError_None = 0,948949/**950* Indicates that an unknown error occurred while attempting to save951* the file.952*953* This error typically indicates that file I/O failed when attempting to954* write the file.955*/956CXSaveError_Unknown = 1,957958/**959* Indicates that errors during translation prevented this attempt960* to save the translation unit.961*962* Errors that prevent the translation unit from being saved can be963* extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().964*/965CXSaveError_TranslationErrors = 2,966967/**968* Indicates that the translation unit to be saved was somehow969* invalid (e.g., NULL).970*/971CXSaveError_InvalidTU = 3972};973974/**975* Saves a translation unit into a serialized representation of976* that translation unit on disk.977*978* Any translation unit that was parsed without error can be saved979* into a file. The translation unit can then be deserialized into a980* new \c CXTranslationUnit with \c clang_createTranslationUnit() or,981* if it is an incomplete translation unit that corresponds to a982* header, used as a precompiled header when parsing other translation983* units.984*985* \param TU The translation unit to save.986*987* \param FileName The file to which the translation unit will be saved.988*989* \param options A bitmask of options that affects how the translation unit990* is saved. This should be a bitwise OR of the991* CXSaveTranslationUnit_XXX flags.992*993* \returns A value that will match one of the enumerators of the CXSaveError994* enumeration. Zero (CXSaveError_None) indicates that the translation unit was995* saved successfully, while a non-zero value indicates that a problem occurred.996*/997CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU,998const char *FileName,999unsigned options);10001001/**1002* Suspend a translation unit in order to free memory associated with it.1003*1004* A suspended translation unit uses significantly less memory but on the other1005* side does not support any other calls than \c clang_reparseTranslationUnit1006* to resume it or \c clang_disposeTranslationUnit to dispose it completely.1007*/1008CINDEX_LINKAGE unsigned clang_suspendTranslationUnit(CXTranslationUnit);10091010/**1011* Destroy the specified CXTranslationUnit object.1012*/1013CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);10141015/**1016* Flags that control the reparsing of translation units.1017*1018* The enumerators in this enumeration type are meant to be bitwise1019* ORed together to specify which options should be used when1020* reparsing the translation unit.1021*/1022enum CXReparse_Flags {1023/**1024* Used to indicate that no special reparsing options are needed.1025*/1026CXReparse_None = 0x01027};10281029/**1030* Returns the set of flags that is suitable for reparsing a translation1031* unit.1032*1033* The set of flags returned provide options for1034* \c clang_reparseTranslationUnit() by default. The returned flag1035* set contains an unspecified set of optimizations geared toward common uses1036* of reparsing. The set of optimizations enabled may change from one version1037* to the next.1038*/1039CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);10401041/**1042* Reparse the source files that produced this translation unit.1043*1044* This routine can be used to re-parse the source files that originally1045* created the given translation unit, for example because those source files1046* have changed (either on disk or as passed via \p unsaved_files). The1047* source code will be reparsed with the same command-line options as it1048* was originally parsed.1049*1050* Reparsing a translation unit invalidates all cursors and source locations1051* that refer into that translation unit. This makes reparsing a translation1052* unit semantically equivalent to destroying the translation unit and then1053* creating a new translation unit with the same command-line arguments.1054* However, it may be more efficient to reparse a translation1055* unit using this routine.1056*1057* \param TU The translation unit whose contents will be re-parsed. The1058* translation unit must originally have been built with1059* \c clang_createTranslationUnitFromSourceFile().1060*1061* \param num_unsaved_files The number of unsaved file entries in \p1062* unsaved_files.1063*1064* \param unsaved_files The files that have not yet been saved to disk1065* but may be required for parsing, including the contents of1066* those files. The contents and name of these files (as specified by1067* CXUnsavedFile) are copied when necessary, so the client only needs to1068* guarantee their validity until the call to this function returns.1069*1070* \param options A bitset of options composed of the flags in CXReparse_Flags.1071* The function \c clang_defaultReparseOptions() produces a default set of1072* options recommended for most uses, based on the translation unit.1073*1074* \returns 0 if the sources could be reparsed. A non-zero error code will be1075* returned if reparsing was impossible, such that the translation unit is1076* invalid. In such cases, the only valid call for \c TU is1077* \c clang_disposeTranslationUnit(TU). The error codes returned by this1078* routine are described by the \c CXErrorCode enum.1079*/1080CINDEX_LINKAGE int1081clang_reparseTranslationUnit(CXTranslationUnit TU, unsigned num_unsaved_files,1082struct CXUnsavedFile *unsaved_files,1083unsigned options);10841085/**1086* Categorizes how memory is being used by a translation unit.1087*/1088enum CXTUResourceUsageKind {1089CXTUResourceUsage_AST = 1,1090CXTUResourceUsage_Identifiers = 2,1091CXTUResourceUsage_Selectors = 3,1092CXTUResourceUsage_GlobalCompletionResults = 4,1093CXTUResourceUsage_SourceManagerContentCache = 5,1094CXTUResourceUsage_AST_SideTables = 6,1095CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7,1096CXTUResourceUsage_SourceManager_Membuffer_MMap = 8,1097CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9,1098CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10,1099CXTUResourceUsage_Preprocessor = 11,1100CXTUResourceUsage_PreprocessingRecord = 12,1101CXTUResourceUsage_SourceManager_DataStructures = 13,1102CXTUResourceUsage_Preprocessor_HeaderSearch = 14,1103CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST,1104CXTUResourceUsage_MEMORY_IN_BYTES_END =1105CXTUResourceUsage_Preprocessor_HeaderSearch,11061107CXTUResourceUsage_First = CXTUResourceUsage_AST,1108CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch1109};11101111/**1112* Returns the human-readable null-terminated C string that represents1113* the name of the memory category. This string should never be freed.1114*/1115CINDEX_LINKAGE1116const char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind);11171118typedef struct CXTUResourceUsageEntry {1119/* The memory usage category. */1120enum CXTUResourceUsageKind kind;1121/* Amount of resources used.1122The units will depend on the resource kind. */1123unsigned long amount;1124} CXTUResourceUsageEntry;11251126/**1127* The memory usage of a CXTranslationUnit, broken into categories.1128*/1129typedef struct CXTUResourceUsage {1130/* Private data member, used for queries. */1131void *data;11321133/* The number of entries in the 'entries' array. */1134unsigned numEntries;11351136/* An array of key-value pairs, representing the breakdown of memory1137usage. */1138CXTUResourceUsageEntry *entries;11391140} CXTUResourceUsage;11411142/**1143* Return the memory usage of a translation unit. This object1144* should be released with clang_disposeCXTUResourceUsage().1145*/1146CINDEX_LINKAGE CXTUResourceUsage1147clang_getCXTUResourceUsage(CXTranslationUnit TU);11481149CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage);11501151/**1152* Get target information for this translation unit.1153*1154* The CXTargetInfo object cannot outlive the CXTranslationUnit object.1155*/1156CINDEX_LINKAGE CXTargetInfo1157clang_getTranslationUnitTargetInfo(CXTranslationUnit CTUnit);11581159/**1160* Destroy the CXTargetInfo object.1161*/1162CINDEX_LINKAGE void clang_TargetInfo_dispose(CXTargetInfo Info);11631164/**1165* Get the normalized target triple as a string.1166*1167* Returns the empty string in case of any error.1168*/1169CINDEX_LINKAGE CXString clang_TargetInfo_getTriple(CXTargetInfo Info);11701171/**1172* Get the pointer width of the target in bits.1173*1174* Returns -1 in case of error.1175*/1176CINDEX_LINKAGE int clang_TargetInfo_getPointerWidth(CXTargetInfo Info);11771178/**1179* @}1180*/11811182/**1183* Describes the kind of entity that a cursor refers to.1184*/1185enum CXCursorKind {1186/* Declarations */1187/**1188* A declaration whose specific kind is not exposed via this1189* interface.1190*1191* Unexposed declarations have the same operations as any other kind1192* of declaration; one can extract their location information,1193* spelling, find their definitions, etc. However, the specific kind1194* of the declaration is not reported.1195*/1196CXCursor_UnexposedDecl = 1,1197/** A C or C++ struct. */1198CXCursor_StructDecl = 2,1199/** A C or C++ union. */1200CXCursor_UnionDecl = 3,1201/** A C++ class. */1202CXCursor_ClassDecl = 4,1203/** An enumeration. */1204CXCursor_EnumDecl = 5,1205/**1206* A field (in C) or non-static data member (in C++) in a1207* struct, union, or C++ class.1208*/1209CXCursor_FieldDecl = 6,1210/** An enumerator constant. */1211CXCursor_EnumConstantDecl = 7,1212/** A function. */1213CXCursor_FunctionDecl = 8,1214/** A variable. */1215CXCursor_VarDecl = 9,1216/** A function or method parameter. */1217CXCursor_ParmDecl = 10,1218/** An Objective-C \@interface. */1219CXCursor_ObjCInterfaceDecl = 11,1220/** An Objective-C \@interface for a category. */1221CXCursor_ObjCCategoryDecl = 12,1222/** An Objective-C \@protocol declaration. */1223CXCursor_ObjCProtocolDecl = 13,1224/** An Objective-C \@property declaration. */1225CXCursor_ObjCPropertyDecl = 14,1226/** An Objective-C instance variable. */1227CXCursor_ObjCIvarDecl = 15,1228/** An Objective-C instance method. */1229CXCursor_ObjCInstanceMethodDecl = 16,1230/** An Objective-C class method. */1231CXCursor_ObjCClassMethodDecl = 17,1232/** An Objective-C \@implementation. */1233CXCursor_ObjCImplementationDecl = 18,1234/** An Objective-C \@implementation for a category. */1235CXCursor_ObjCCategoryImplDecl = 19,1236/** A typedef. */1237CXCursor_TypedefDecl = 20,1238/** A C++ class method. */1239CXCursor_CXXMethod = 21,1240/** A C++ namespace. */1241CXCursor_Namespace = 22,1242/** A linkage specification, e.g. 'extern "C"'. */1243CXCursor_LinkageSpec = 23,1244/** A C++ constructor. */1245CXCursor_Constructor = 24,1246/** A C++ destructor. */1247CXCursor_Destructor = 25,1248/** A C++ conversion function. */1249CXCursor_ConversionFunction = 26,1250/** A C++ template type parameter. */1251CXCursor_TemplateTypeParameter = 27,1252/** A C++ non-type template parameter. */1253CXCursor_NonTypeTemplateParameter = 28,1254/** A C++ template template parameter. */1255CXCursor_TemplateTemplateParameter = 29,1256/** A C++ function template. */1257CXCursor_FunctionTemplate = 30,1258/** A C++ class template. */1259CXCursor_ClassTemplate = 31,1260/** A C++ class template partial specialization. */1261CXCursor_ClassTemplatePartialSpecialization = 32,1262/** A C++ namespace alias declaration. */1263CXCursor_NamespaceAlias = 33,1264/** A C++ using directive. */1265CXCursor_UsingDirective = 34,1266/** A C++ using declaration. */1267CXCursor_UsingDeclaration = 35,1268/** A C++ alias declaration */1269CXCursor_TypeAliasDecl = 36,1270/** An Objective-C \@synthesize definition. */1271CXCursor_ObjCSynthesizeDecl = 37,1272/** An Objective-C \@dynamic definition. */1273CXCursor_ObjCDynamicDecl = 38,1274/** An access specifier. */1275CXCursor_CXXAccessSpecifier = 39,12761277CXCursor_FirstDecl = CXCursor_UnexposedDecl,1278CXCursor_LastDecl = CXCursor_CXXAccessSpecifier,12791280/* References */1281CXCursor_FirstRef = 40, /* Decl references */1282CXCursor_ObjCSuperClassRef = 40,1283CXCursor_ObjCProtocolRef = 41,1284CXCursor_ObjCClassRef = 42,1285/**1286* A reference to a type declaration.1287*1288* A type reference occurs anywhere where a type is named but not1289* declared. For example, given:1290*1291* \code1292* typedef unsigned size_type;1293* size_type size;1294* \endcode1295*1296* The typedef is a declaration of size_type (CXCursor_TypedefDecl),1297* while the type of the variable "size" is referenced. The cursor1298* referenced by the type of size is the typedef for size_type.1299*/1300CXCursor_TypeRef = 43,1301CXCursor_CXXBaseSpecifier = 44,1302/**1303* A reference to a class template, function template, template1304* template parameter, or class template partial specialization.1305*/1306CXCursor_TemplateRef = 45,1307/**1308* A reference to a namespace or namespace alias.1309*/1310CXCursor_NamespaceRef = 46,1311/**1312* A reference to a member of a struct, union, or class that occurs in1313* some non-expression context, e.g., a designated initializer.1314*/1315CXCursor_MemberRef = 47,1316/**1317* A reference to a labeled statement.1318*1319* This cursor kind is used to describe the jump to "start_over" in the1320* goto statement in the following example:1321*1322* \code1323* start_over:1324* ++counter;1325*1326* goto start_over;1327* \endcode1328*1329* A label reference cursor refers to a label statement.1330*/1331CXCursor_LabelRef = 48,13321333/**1334* A reference to a set of overloaded functions or function templates1335* that has not yet been resolved to a specific function or function template.1336*1337* An overloaded declaration reference cursor occurs in C++ templates where1338* a dependent name refers to a function. For example:1339*1340* \code1341* template<typename T> void swap(T&, T&);1342*1343* struct X { ... };1344* void swap(X&, X&);1345*1346* template<typename T>1347* void reverse(T* first, T* last) {1348* while (first < last - 1) {1349* swap(*first, *--last);1350* ++first;1351* }1352* }1353*1354* struct Y { };1355* void swap(Y&, Y&);1356* \endcode1357*1358* Here, the identifier "swap" is associated with an overloaded declaration1359* reference. In the template definition, "swap" refers to either of the two1360* "swap" functions declared above, so both results will be available. At1361* instantiation time, "swap" may also refer to other functions found via1362* argument-dependent lookup (e.g., the "swap" function at the end of the1363* example).1364*1365* The functions \c clang_getNumOverloadedDecls() and1366* \c clang_getOverloadedDecl() can be used to retrieve the definitions1367* referenced by this cursor.1368*/1369CXCursor_OverloadedDeclRef = 49,13701371/**1372* A reference to a variable that occurs in some non-expression1373* context, e.g., a C++ lambda capture list.1374*/1375CXCursor_VariableRef = 50,13761377CXCursor_LastRef = CXCursor_VariableRef,13781379/* Error conditions */1380CXCursor_FirstInvalid = 70,1381CXCursor_InvalidFile = 70,1382CXCursor_NoDeclFound = 71,1383CXCursor_NotImplemented = 72,1384CXCursor_InvalidCode = 73,1385CXCursor_LastInvalid = CXCursor_InvalidCode,13861387/* Expressions */1388CXCursor_FirstExpr = 100,13891390/**1391* An expression whose specific kind is not exposed via this1392* interface.1393*1394* Unexposed expressions have the same operations as any other kind1395* of expression; one can extract their location information,1396* spelling, children, etc. However, the specific kind of the1397* expression is not reported.1398*/1399CXCursor_UnexposedExpr = 100,14001401/**1402* An expression that refers to some value declaration, such1403* as a function, variable, or enumerator.1404*/1405CXCursor_DeclRefExpr = 101,14061407/**1408* An expression that refers to a member of a struct, union,1409* class, Objective-C class, etc.1410*/1411CXCursor_MemberRefExpr = 102,14121413/** An expression that calls a function. */1414CXCursor_CallExpr = 103,14151416/** An expression that sends a message to an Objective-C1417object or class. */1418CXCursor_ObjCMessageExpr = 104,14191420/** An expression that represents a block literal. */1421CXCursor_BlockExpr = 105,14221423/** An integer literal.1424*/1425CXCursor_IntegerLiteral = 106,14261427/** A floating point number literal.1428*/1429CXCursor_FloatingLiteral = 107,14301431/** An imaginary number literal.1432*/1433CXCursor_ImaginaryLiteral = 108,14341435/** A string literal.1436*/1437CXCursor_StringLiteral = 109,14381439/** A character literal.1440*/1441CXCursor_CharacterLiteral = 110,14421443/** A parenthesized expression, e.g. "(1)".1444*1445* This AST node is only formed if full location information is requested.1446*/1447CXCursor_ParenExpr = 111,14481449/** This represents the unary-expression's (except sizeof and1450* alignof).1451*/1452CXCursor_UnaryOperator = 112,14531454/** [C99 6.5.2.1] Array Subscripting.1455*/1456CXCursor_ArraySubscriptExpr = 113,14571458/** A builtin binary operation expression such as "x + y" or1459* "x <= y".1460*/1461CXCursor_BinaryOperator = 114,14621463/** Compound assignment such as "+=".1464*/1465CXCursor_CompoundAssignOperator = 115,14661467/** The ?: ternary operator.1468*/1469CXCursor_ConditionalOperator = 116,14701471/** An explicit cast in C (C99 6.5.4) or a C-style cast in C++1472* (C++ [expr.cast]), which uses the syntax (Type)expr.1473*1474* For example: (int)f.1475*/1476CXCursor_CStyleCastExpr = 117,14771478/** [C99 6.5.2.5]1479*/1480CXCursor_CompoundLiteralExpr = 118,14811482/** Describes an C or C++ initializer list.1483*/1484CXCursor_InitListExpr = 119,14851486/** The GNU address of label extension, representing &&label.1487*/1488CXCursor_AddrLabelExpr = 120,14891490/** This is the GNU Statement Expression extension: ({int X=4; X;})1491*/1492CXCursor_StmtExpr = 121,14931494/** Represents a C11 generic selection.1495*/1496CXCursor_GenericSelectionExpr = 122,14971498/** Implements the GNU __null extension, which is a name for a null1499* pointer constant that has integral type (e.g., int or long) and is the same1500* size and alignment as a pointer.1501*1502* The __null extension is typically only used by system headers, which define1503* NULL as __null in C++ rather than using 0 (which is an integer that may not1504* match the size of a pointer).1505*/1506CXCursor_GNUNullExpr = 123,15071508/** C++'s static_cast<> expression.1509*/1510CXCursor_CXXStaticCastExpr = 124,15111512/** C++'s dynamic_cast<> expression.1513*/1514CXCursor_CXXDynamicCastExpr = 125,15151516/** C++'s reinterpret_cast<> expression.1517*/1518CXCursor_CXXReinterpretCastExpr = 126,15191520/** C++'s const_cast<> expression.1521*/1522CXCursor_CXXConstCastExpr = 127,15231524/** Represents an explicit C++ type conversion that uses "functional"1525* notion (C++ [expr.type.conv]).1526*1527* Example:1528* \code1529* x = int(0.5);1530* \endcode1531*/1532CXCursor_CXXFunctionalCastExpr = 128,15331534/** A C++ typeid expression (C++ [expr.typeid]).1535*/1536CXCursor_CXXTypeidExpr = 129,15371538/** [C++ 2.13.5] C++ Boolean Literal.1539*/1540CXCursor_CXXBoolLiteralExpr = 130,15411542/** [C++0x 2.14.7] C++ Pointer Literal.1543*/1544CXCursor_CXXNullPtrLiteralExpr = 131,15451546/** Represents the "this" expression in C++1547*/1548CXCursor_CXXThisExpr = 132,15491550/** [C++ 15] C++ Throw Expression.1551*1552* This handles 'throw' and 'throw' assignment-expression. When1553* assignment-expression isn't present, Op will be null.1554*/1555CXCursor_CXXThrowExpr = 133,15561557/** A new expression for memory allocation and constructor calls, e.g:1558* "new CXXNewExpr(foo)".1559*/1560CXCursor_CXXNewExpr = 134,15611562/** A delete expression for memory deallocation and destructor calls,1563* e.g. "delete[] pArray".1564*/1565CXCursor_CXXDeleteExpr = 135,15661567/** A unary expression. (noexcept, sizeof, or other traits)1568*/1569CXCursor_UnaryExpr = 136,15701571/** An Objective-C string literal i.e. @"foo".1572*/1573CXCursor_ObjCStringLiteral = 137,15741575/** An Objective-C \@encode expression.1576*/1577CXCursor_ObjCEncodeExpr = 138,15781579/** An Objective-C \@selector expression.1580*/1581CXCursor_ObjCSelectorExpr = 139,15821583/** An Objective-C \@protocol expression.1584*/1585CXCursor_ObjCProtocolExpr = 140,15861587/** An Objective-C "bridged" cast expression, which casts between1588* Objective-C pointers and C pointers, transferring ownership in the process.1589*1590* \code1591* NSString *str = (__bridge_transfer NSString *)CFCreateString();1592* \endcode1593*/1594CXCursor_ObjCBridgedCastExpr = 141,15951596/** Represents a C++0x pack expansion that produces a sequence of1597* expressions.1598*1599* A pack expansion expression contains a pattern (which itself is an1600* expression) followed by an ellipsis. For example:1601*1602* \code1603* template<typename F, typename ...Types>1604* void forward(F f, Types &&...args) {1605* f(static_cast<Types&&>(args)...);1606* }1607* \endcode1608*/1609CXCursor_PackExpansionExpr = 142,16101611/** Represents an expression that computes the length of a parameter1612* pack.1613*1614* \code1615* template<typename ...Types>1616* struct count {1617* static const unsigned value = sizeof...(Types);1618* };1619* \endcode1620*/1621CXCursor_SizeOfPackExpr = 143,16221623/* Represents a C++ lambda expression that produces a local function1624* object.1625*1626* \code1627* void abssort(float *x, unsigned N) {1628* std::sort(x, x + N,1629* [](float a, float b) {1630* return std::abs(a) < std::abs(b);1631* });1632* }1633* \endcode1634*/1635CXCursor_LambdaExpr = 144,16361637/** Objective-c Boolean Literal.1638*/1639CXCursor_ObjCBoolLiteralExpr = 145,16401641/** Represents the "self" expression in an Objective-C method.1642*/1643CXCursor_ObjCSelfExpr = 146,16441645/** OpenMP 5.0 [2.1.5, Array Section].1646* OpenACC 3.3 [2.7.1, Data Specification for Data Clauses (Sub Arrays)]1647*/1648CXCursor_ArraySectionExpr = 147,16491650/** Represents an @available(...) check.1651*/1652CXCursor_ObjCAvailabilityCheckExpr = 148,16531654/**1655* Fixed point literal1656*/1657CXCursor_FixedPointLiteral = 149,16581659/** OpenMP 5.0 [2.1.4, Array Shaping].1660*/1661CXCursor_OMPArrayShapingExpr = 150,16621663/**1664* OpenMP 5.0 [2.1.6 Iterators]1665*/1666CXCursor_OMPIteratorExpr = 151,16671668/** OpenCL's addrspace_cast<> expression.1669*/1670CXCursor_CXXAddrspaceCastExpr = 152,16711672/**1673* Expression that references a C++20 concept.1674*/1675CXCursor_ConceptSpecializationExpr = 153,16761677/**1678* Expression that references a C++20 requires expression.1679*/1680CXCursor_RequiresExpr = 154,16811682/**1683* Expression that references a C++20 parenthesized list aggregate1684* initializer.1685*/1686CXCursor_CXXParenListInitExpr = 155,16871688/**1689* Represents a C++26 pack indexing expression.1690*/1691CXCursor_PackIndexingExpr = 156,16921693CXCursor_LastExpr = CXCursor_PackIndexingExpr,16941695/* Statements */1696CXCursor_FirstStmt = 200,1697/**1698* A statement whose specific kind is not exposed via this1699* interface.1700*1701* Unexposed statements have the same operations as any other kind of1702* statement; one can extract their location information, spelling,1703* children, etc. However, the specific kind of the statement is not1704* reported.1705*/1706CXCursor_UnexposedStmt = 200,17071708/** A labelled statement in a function.1709*1710* This cursor kind is used to describe the "start_over:" label statement in1711* the following example:1712*1713* \code1714* start_over:1715* ++counter;1716* \endcode1717*1718*/1719CXCursor_LabelStmt = 201,17201721/** A group of statements like { stmt stmt }.1722*1723* This cursor kind is used to describe compound statements, e.g. function1724* bodies.1725*/1726CXCursor_CompoundStmt = 202,17271728/** A case statement.1729*/1730CXCursor_CaseStmt = 203,17311732/** A default statement.1733*/1734CXCursor_DefaultStmt = 204,17351736/** An if statement1737*/1738CXCursor_IfStmt = 205,17391740/** A switch statement.1741*/1742CXCursor_SwitchStmt = 206,17431744/** A while statement.1745*/1746CXCursor_WhileStmt = 207,17471748/** A do statement.1749*/1750CXCursor_DoStmt = 208,17511752/** A for statement.1753*/1754CXCursor_ForStmt = 209,17551756/** A goto statement.1757*/1758CXCursor_GotoStmt = 210,17591760/** An indirect goto statement.1761*/1762CXCursor_IndirectGotoStmt = 211,17631764/** A continue statement.1765*/1766CXCursor_ContinueStmt = 212,17671768/** A break statement.1769*/1770CXCursor_BreakStmt = 213,17711772/** A return statement.1773*/1774CXCursor_ReturnStmt = 214,17751776/** A GCC inline assembly statement extension.1777*/1778CXCursor_GCCAsmStmt = 215,1779CXCursor_AsmStmt = CXCursor_GCCAsmStmt,17801781/** Objective-C's overall \@try-\@catch-\@finally statement.1782*/1783CXCursor_ObjCAtTryStmt = 216,17841785/** Objective-C's \@catch statement.1786*/1787CXCursor_ObjCAtCatchStmt = 217,17881789/** Objective-C's \@finally statement.1790*/1791CXCursor_ObjCAtFinallyStmt = 218,17921793/** Objective-C's \@throw statement.1794*/1795CXCursor_ObjCAtThrowStmt = 219,17961797/** Objective-C's \@synchronized statement.1798*/1799CXCursor_ObjCAtSynchronizedStmt = 220,18001801/** Objective-C's autorelease pool statement.1802*/1803CXCursor_ObjCAutoreleasePoolStmt = 221,18041805/** Objective-C's collection statement.1806*/1807CXCursor_ObjCForCollectionStmt = 222,18081809/** C++'s catch statement.1810*/1811CXCursor_CXXCatchStmt = 223,18121813/** C++'s try statement.1814*/1815CXCursor_CXXTryStmt = 224,18161817/** C++'s for (* : *) statement.1818*/1819CXCursor_CXXForRangeStmt = 225,18201821/** Windows Structured Exception Handling's try statement.1822*/1823CXCursor_SEHTryStmt = 226,18241825/** Windows Structured Exception Handling's except statement.1826*/1827CXCursor_SEHExceptStmt = 227,18281829/** Windows Structured Exception Handling's finally statement.1830*/1831CXCursor_SEHFinallyStmt = 228,18321833/** A MS inline assembly statement extension.1834*/1835CXCursor_MSAsmStmt = 229,18361837/** The null statement ";": C99 6.8.3p3.1838*1839* This cursor kind is used to describe the null statement.1840*/1841CXCursor_NullStmt = 230,18421843/** Adaptor class for mixing declarations with statements and1844* expressions.1845*/1846CXCursor_DeclStmt = 231,18471848/** OpenMP parallel directive.1849*/1850CXCursor_OMPParallelDirective = 232,18511852/** OpenMP SIMD directive.1853*/1854CXCursor_OMPSimdDirective = 233,18551856/** OpenMP for directive.1857*/1858CXCursor_OMPForDirective = 234,18591860/** OpenMP sections directive.1861*/1862CXCursor_OMPSectionsDirective = 235,18631864/** OpenMP section directive.1865*/1866CXCursor_OMPSectionDirective = 236,18671868/** OpenMP single directive.1869*/1870CXCursor_OMPSingleDirective = 237,18711872/** OpenMP parallel for directive.1873*/1874CXCursor_OMPParallelForDirective = 238,18751876/** OpenMP parallel sections directive.1877*/1878CXCursor_OMPParallelSectionsDirective = 239,18791880/** OpenMP task directive.1881*/1882CXCursor_OMPTaskDirective = 240,18831884/** OpenMP master directive.1885*/1886CXCursor_OMPMasterDirective = 241,18871888/** OpenMP critical directive.1889*/1890CXCursor_OMPCriticalDirective = 242,18911892/** OpenMP taskyield directive.1893*/1894CXCursor_OMPTaskyieldDirective = 243,18951896/** OpenMP barrier directive.1897*/1898CXCursor_OMPBarrierDirective = 244,18991900/** OpenMP taskwait directive.1901*/1902CXCursor_OMPTaskwaitDirective = 245,19031904/** OpenMP flush directive.1905*/1906CXCursor_OMPFlushDirective = 246,19071908/** Windows Structured Exception Handling's leave statement.1909*/1910CXCursor_SEHLeaveStmt = 247,19111912/** OpenMP ordered directive.1913*/1914CXCursor_OMPOrderedDirective = 248,19151916/** OpenMP atomic directive.1917*/1918CXCursor_OMPAtomicDirective = 249,19191920/** OpenMP for SIMD directive.1921*/1922CXCursor_OMPForSimdDirective = 250,19231924/** OpenMP parallel for SIMD directive.1925*/1926CXCursor_OMPParallelForSimdDirective = 251,19271928/** OpenMP target directive.1929*/1930CXCursor_OMPTargetDirective = 252,19311932/** OpenMP teams directive.1933*/1934CXCursor_OMPTeamsDirective = 253,19351936/** OpenMP taskgroup directive.1937*/1938CXCursor_OMPTaskgroupDirective = 254,19391940/** OpenMP cancellation point directive.1941*/1942CXCursor_OMPCancellationPointDirective = 255,19431944/** OpenMP cancel directive.1945*/1946CXCursor_OMPCancelDirective = 256,19471948/** OpenMP target data directive.1949*/1950CXCursor_OMPTargetDataDirective = 257,19511952/** OpenMP taskloop directive.1953*/1954CXCursor_OMPTaskLoopDirective = 258,19551956/** OpenMP taskloop simd directive.1957*/1958CXCursor_OMPTaskLoopSimdDirective = 259,19591960/** OpenMP distribute directive.1961*/1962CXCursor_OMPDistributeDirective = 260,19631964/** OpenMP target enter data directive.1965*/1966CXCursor_OMPTargetEnterDataDirective = 261,19671968/** OpenMP target exit data directive.1969*/1970CXCursor_OMPTargetExitDataDirective = 262,19711972/** OpenMP target parallel directive.1973*/1974CXCursor_OMPTargetParallelDirective = 263,19751976/** OpenMP target parallel for directive.1977*/1978CXCursor_OMPTargetParallelForDirective = 264,19791980/** OpenMP target update directive.1981*/1982CXCursor_OMPTargetUpdateDirective = 265,19831984/** OpenMP distribute parallel for directive.1985*/1986CXCursor_OMPDistributeParallelForDirective = 266,19871988/** OpenMP distribute parallel for simd directive.1989*/1990CXCursor_OMPDistributeParallelForSimdDirective = 267,19911992/** OpenMP distribute simd directive.1993*/1994CXCursor_OMPDistributeSimdDirective = 268,19951996/** OpenMP target parallel for simd directive.1997*/1998CXCursor_OMPTargetParallelForSimdDirective = 269,19992000/** OpenMP target simd directive.2001*/2002CXCursor_OMPTargetSimdDirective = 270,20032004/** OpenMP teams distribute directive.2005*/2006CXCursor_OMPTeamsDistributeDirective = 271,20072008/** OpenMP teams distribute simd directive.2009*/2010CXCursor_OMPTeamsDistributeSimdDirective = 272,20112012/** OpenMP teams distribute parallel for simd directive.2013*/2014CXCursor_OMPTeamsDistributeParallelForSimdDirective = 273,20152016/** OpenMP teams distribute parallel for directive.2017*/2018CXCursor_OMPTeamsDistributeParallelForDirective = 274,20192020/** OpenMP target teams directive.2021*/2022CXCursor_OMPTargetTeamsDirective = 275,20232024/** OpenMP target teams distribute directive.2025*/2026CXCursor_OMPTargetTeamsDistributeDirective = 276,20272028/** OpenMP target teams distribute parallel for directive.2029*/2030CXCursor_OMPTargetTeamsDistributeParallelForDirective = 277,20312032/** OpenMP target teams distribute parallel for simd directive.2033*/2034CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective = 278,20352036/** OpenMP target teams distribute simd directive.2037*/2038CXCursor_OMPTargetTeamsDistributeSimdDirective = 279,20392040/** C++2a std::bit_cast expression.2041*/2042CXCursor_BuiltinBitCastExpr = 280,20432044/** OpenMP master taskloop directive.2045*/2046CXCursor_OMPMasterTaskLoopDirective = 281,20472048/** OpenMP parallel master taskloop directive.2049*/2050CXCursor_OMPParallelMasterTaskLoopDirective = 282,20512052/** OpenMP master taskloop simd directive.2053*/2054CXCursor_OMPMasterTaskLoopSimdDirective = 283,20552056/** OpenMP parallel master taskloop simd directive.2057*/2058CXCursor_OMPParallelMasterTaskLoopSimdDirective = 284,20592060/** OpenMP parallel master directive.2061*/2062CXCursor_OMPParallelMasterDirective = 285,20632064/** OpenMP depobj directive.2065*/2066CXCursor_OMPDepobjDirective = 286,20672068/** OpenMP scan directive.2069*/2070CXCursor_OMPScanDirective = 287,20712072/** OpenMP tile directive.2073*/2074CXCursor_OMPTileDirective = 288,20752076/** OpenMP canonical loop.2077*/2078CXCursor_OMPCanonicalLoop = 289,20792080/** OpenMP interop directive.2081*/2082CXCursor_OMPInteropDirective = 290,20832084/** OpenMP dispatch directive.2085*/2086CXCursor_OMPDispatchDirective = 291,20872088/** OpenMP masked directive.2089*/2090CXCursor_OMPMaskedDirective = 292,20912092/** OpenMP unroll directive.2093*/2094CXCursor_OMPUnrollDirective = 293,20952096/** OpenMP metadirective directive.2097*/2098CXCursor_OMPMetaDirective = 294,20992100/** OpenMP loop directive.2101*/2102CXCursor_OMPGenericLoopDirective = 295,21032104/** OpenMP teams loop directive.2105*/2106CXCursor_OMPTeamsGenericLoopDirective = 296,21072108/** OpenMP target teams loop directive.2109*/2110CXCursor_OMPTargetTeamsGenericLoopDirective = 297,21112112/** OpenMP parallel loop directive.2113*/2114CXCursor_OMPParallelGenericLoopDirective = 298,21152116/** OpenMP target parallel loop directive.2117*/2118CXCursor_OMPTargetParallelGenericLoopDirective = 299,21192120/** OpenMP parallel masked directive.2121*/2122CXCursor_OMPParallelMaskedDirective = 300,21232124/** OpenMP masked taskloop directive.2125*/2126CXCursor_OMPMaskedTaskLoopDirective = 301,21272128/** OpenMP masked taskloop simd directive.2129*/2130CXCursor_OMPMaskedTaskLoopSimdDirective = 302,21312132/** OpenMP parallel masked taskloop directive.2133*/2134CXCursor_OMPParallelMaskedTaskLoopDirective = 303,21352136/** OpenMP parallel masked taskloop simd directive.2137*/2138CXCursor_OMPParallelMaskedTaskLoopSimdDirective = 304,21392140/** OpenMP error directive.2141*/2142CXCursor_OMPErrorDirective = 305,21432144/** OpenMP scope directive.2145*/2146CXCursor_OMPScopeDirective = 306,21472148/** OpenMP reverse directive.2149*/2150CXCursor_OMPReverseDirective = 307,21512152/** OpenMP interchange directive.2153*/2154CXCursor_OMPInterchangeDirective = 308,21552156/** OpenACC Compute Construct.2157*/2158CXCursor_OpenACCComputeConstruct = 320,21592160/** OpenACC Loop Construct.2161*/2162CXCursor_OpenACCLoopConstruct = 321,21632164CXCursor_LastStmt = CXCursor_OpenACCLoopConstruct,21652166/**2167* Cursor that represents the translation unit itself.2168*2169* The translation unit cursor exists primarily to act as the root2170* cursor for traversing the contents of a translation unit.2171*/2172CXCursor_TranslationUnit = 350,21732174/* Attributes */2175CXCursor_FirstAttr = 400,2176/**2177* An attribute whose specific kind is not exposed via this2178* interface.2179*/2180CXCursor_UnexposedAttr = 400,21812182CXCursor_IBActionAttr = 401,2183CXCursor_IBOutletAttr = 402,2184CXCursor_IBOutletCollectionAttr = 403,2185CXCursor_CXXFinalAttr = 404,2186CXCursor_CXXOverrideAttr = 405,2187CXCursor_AnnotateAttr = 406,2188CXCursor_AsmLabelAttr = 407,2189CXCursor_PackedAttr = 408,2190CXCursor_PureAttr = 409,2191CXCursor_ConstAttr = 410,2192CXCursor_NoDuplicateAttr = 411,2193CXCursor_CUDAConstantAttr = 412,2194CXCursor_CUDADeviceAttr = 413,2195CXCursor_CUDAGlobalAttr = 414,2196CXCursor_CUDAHostAttr = 415,2197CXCursor_CUDASharedAttr = 416,2198CXCursor_VisibilityAttr = 417,2199CXCursor_DLLExport = 418,2200CXCursor_DLLImport = 419,2201CXCursor_NSReturnsRetained = 420,2202CXCursor_NSReturnsNotRetained = 421,2203CXCursor_NSReturnsAutoreleased = 422,2204CXCursor_NSConsumesSelf = 423,2205CXCursor_NSConsumed = 424,2206CXCursor_ObjCException = 425,2207CXCursor_ObjCNSObject = 426,2208CXCursor_ObjCIndependentClass = 427,2209CXCursor_ObjCPreciseLifetime = 428,2210CXCursor_ObjCReturnsInnerPointer = 429,2211CXCursor_ObjCRequiresSuper = 430,2212CXCursor_ObjCRootClass = 431,2213CXCursor_ObjCSubclassingRestricted = 432,2214CXCursor_ObjCExplicitProtocolImpl = 433,2215CXCursor_ObjCDesignatedInitializer = 434,2216CXCursor_ObjCRuntimeVisible = 435,2217CXCursor_ObjCBoxable = 436,2218CXCursor_FlagEnum = 437,2219CXCursor_ConvergentAttr = 438,2220CXCursor_WarnUnusedAttr = 439,2221CXCursor_WarnUnusedResultAttr = 440,2222CXCursor_AlignedAttr = 441,2223CXCursor_LastAttr = CXCursor_AlignedAttr,22242225/* Preprocessing */2226CXCursor_PreprocessingDirective = 500,2227CXCursor_MacroDefinition = 501,2228CXCursor_MacroExpansion = 502,2229CXCursor_MacroInstantiation = CXCursor_MacroExpansion,2230CXCursor_InclusionDirective = 503,2231CXCursor_FirstPreprocessing = CXCursor_PreprocessingDirective,2232CXCursor_LastPreprocessing = CXCursor_InclusionDirective,22332234/* Extra Declarations */2235/**2236* A module import declaration.2237*/2238CXCursor_ModuleImportDecl = 600,2239CXCursor_TypeAliasTemplateDecl = 601,2240/**2241* A static_assert or _Static_assert node2242*/2243CXCursor_StaticAssert = 602,2244/**2245* a friend declaration.2246*/2247CXCursor_FriendDecl = 603,2248/**2249* a concept declaration.2250*/2251CXCursor_ConceptDecl = 604,22522253CXCursor_FirstExtraDecl = CXCursor_ModuleImportDecl,2254CXCursor_LastExtraDecl = CXCursor_ConceptDecl,22552256/**2257* A code completion overload candidate.2258*/2259CXCursor_OverloadCandidate = 7002260};22612262/**2263* A cursor representing some element in the abstract syntax tree for2264* a translation unit.2265*2266* The cursor abstraction unifies the different kinds of entities in a2267* program--declaration, statements, expressions, references to declarations,2268* etc.--under a single "cursor" abstraction with a common set of operations.2269* Common operation for a cursor include: getting the physical location in2270* a source file where the cursor points, getting the name associated with a2271* cursor, and retrieving cursors for any child nodes of a particular cursor.2272*2273* Cursors can be produced in two specific ways.2274* clang_getTranslationUnitCursor() produces a cursor for a translation unit,2275* from which one can use clang_visitChildren() to explore the rest of the2276* translation unit. clang_getCursor() maps from a physical source location2277* to the entity that resides at that location, allowing one to map from the2278* source code into the AST.2279*/2280typedef struct {2281enum CXCursorKind kind;2282int xdata;2283const void *data[3];2284} CXCursor;22852286/**2287* \defgroup CINDEX_CURSOR_MANIP Cursor manipulations2288*2289* @{2290*/22912292/**2293* Retrieve the NULL cursor, which represents no entity.2294*/2295CINDEX_LINKAGE CXCursor clang_getNullCursor(void);22962297/**2298* Retrieve the cursor that represents the given translation unit.2299*2300* The translation unit cursor can be used to start traversing the2301* various declarations within the given translation unit.2302*/2303CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);23042305/**2306* Determine whether two cursors are equivalent.2307*/2308CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);23092310/**2311* Returns non-zero if \p cursor is null.2312*/2313CINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor);23142315/**2316* Compute a hash value for the given cursor.2317*/2318CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor);23192320/**2321* Retrieve the kind of the given cursor.2322*/2323CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);23242325/**2326* Determine whether the given cursor kind represents a declaration.2327*/2328CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);23292330/**2331* Determine whether the given declaration is invalid.2332*2333* A declaration is invalid if it could not be parsed successfully.2334*2335* \returns non-zero if the cursor represents a declaration and it is2336* invalid, otherwise NULL.2337*/2338CINDEX_LINKAGE unsigned clang_isInvalidDeclaration(CXCursor);23392340/**2341* Determine whether the given cursor kind represents a simple2342* reference.2343*2344* Note that other kinds of cursors (such as expressions) can also refer to2345* other cursors. Use clang_getCursorReferenced() to determine whether a2346* particular cursor refers to another entity.2347*/2348CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind);23492350/**2351* Determine whether the given cursor kind represents an expression.2352*/2353CINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind);23542355/**2356* Determine whether the given cursor kind represents a statement.2357*/2358CINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind);23592360/**2361* Determine whether the given cursor kind represents an attribute.2362*/2363CINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind);23642365/**2366* Determine whether the given cursor has any attributes.2367*/2368CINDEX_LINKAGE unsigned clang_Cursor_hasAttrs(CXCursor C);23692370/**2371* Determine whether the given cursor kind represents an invalid2372* cursor.2373*/2374CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind);23752376/**2377* Determine whether the given cursor kind represents a translation2378* unit.2379*/2380CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind);23812382/***2383* Determine whether the given cursor represents a preprocessing2384* element, such as a preprocessor directive or macro instantiation.2385*/2386CINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind);23872388/***2389* Determine whether the given cursor represents a currently2390* unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).2391*/2392CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind);23932394/**2395* Describe the linkage of the entity referred to by a cursor.2396*/2397enum CXLinkageKind {2398/** This value indicates that no linkage information is available2399* for a provided CXCursor. */2400CXLinkage_Invalid,2401/**2402* This is the linkage for variables, parameters, and so on that2403* have automatic storage. This covers normal (non-extern) local variables.2404*/2405CXLinkage_NoLinkage,2406/** This is the linkage for static variables and static functions. */2407CXLinkage_Internal,2408/** This is the linkage for entities with external linkage that live2409* in C++ anonymous namespaces.*/2410CXLinkage_UniqueExternal,2411/** This is the linkage for entities with true, external linkage. */2412CXLinkage_External2413};24142415/**2416* Determine the linkage of the entity referred to by a given cursor.2417*/2418CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);24192420enum CXVisibilityKind {2421/** This value indicates that no visibility information is available2422* for a provided CXCursor. */2423CXVisibility_Invalid,24242425/** Symbol not seen by the linker. */2426CXVisibility_Hidden,2427/** Symbol seen by the linker but resolves to a symbol inside this object. */2428CXVisibility_Protected,2429/** Symbol seen by the linker and acts like a normal symbol. */2430CXVisibility_Default2431};24322433/**2434* Describe the visibility of the entity referred to by a cursor.2435*2436* This returns the default visibility if not explicitly specified by2437* a visibility attribute. The default visibility may be changed by2438* commandline arguments.2439*2440* \param cursor The cursor to query.2441*2442* \returns The visibility of the cursor.2443*/2444CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor cursor);24452446/**2447* Determine the availability of the entity that this cursor refers to,2448* taking the current target platform into account.2449*2450* \param cursor The cursor to query.2451*2452* \returns The availability of the cursor.2453*/2454CINDEX_LINKAGE enum CXAvailabilityKind2455clang_getCursorAvailability(CXCursor cursor);24562457/**2458* Describes the availability of a given entity on a particular platform, e.g.,2459* a particular class might only be available on Mac OS 10.7 or newer.2460*/2461typedef struct CXPlatformAvailability {2462/**2463* A string that describes the platform for which this structure2464* provides availability information.2465*2466* Possible values are "ios" or "macos".2467*/2468CXString Platform;2469/**2470* The version number in which this entity was introduced.2471*/2472CXVersion Introduced;2473/**2474* The version number in which this entity was deprecated (but is2475* still available).2476*/2477CXVersion Deprecated;2478/**2479* The version number in which this entity was obsoleted, and therefore2480* is no longer available.2481*/2482CXVersion Obsoleted;2483/**2484* Whether the entity is unconditionally unavailable on this platform.2485*/2486int Unavailable;2487/**2488* An optional message to provide to a user of this API, e.g., to2489* suggest replacement APIs.2490*/2491CXString Message;2492} CXPlatformAvailability;24932494/**2495* Determine the availability of the entity that this cursor refers to2496* on any platforms for which availability information is known.2497*2498* \param cursor The cursor to query.2499*2500* \param always_deprecated If non-NULL, will be set to indicate whether the2501* entity is deprecated on all platforms.2502*2503* \param deprecated_message If non-NULL, will be set to the message text2504* provided along with the unconditional deprecation of this entity. The client2505* is responsible for deallocating this string.2506*2507* \param always_unavailable If non-NULL, will be set to indicate whether the2508* entity is unavailable on all platforms.2509*2510* \param unavailable_message If non-NULL, will be set to the message text2511* provided along with the unconditional unavailability of this entity. The2512* client is responsible for deallocating this string.2513*2514* \param availability If non-NULL, an array of CXPlatformAvailability instances2515* that will be populated with platform availability information, up to either2516* the number of platforms for which availability information is available (as2517* returned by this function) or \c availability_size, whichever is smaller.2518*2519* \param availability_size The number of elements available in the2520* \c availability array.2521*2522* \returns The number of platforms (N) for which availability information is2523* available (which is unrelated to \c availability_size).2524*2525* Note that the client is responsible for calling2526* \c clang_disposeCXPlatformAvailability to free each of the2527* platform-availability structures returned. There are2528* \c min(N, availability_size) such structures.2529*/2530CINDEX_LINKAGE int clang_getCursorPlatformAvailability(2531CXCursor cursor, int *always_deprecated, CXString *deprecated_message,2532int *always_unavailable, CXString *unavailable_message,2533CXPlatformAvailability *availability, int availability_size);25342535/**2536* Free the memory associated with a \c CXPlatformAvailability structure.2537*/2538CINDEX_LINKAGE void2539clang_disposeCXPlatformAvailability(CXPlatformAvailability *availability);25402541/**2542* If cursor refers to a variable declaration and it has initializer returns2543* cursor referring to the initializer otherwise return null cursor.2544*/2545CINDEX_LINKAGE CXCursor clang_Cursor_getVarDeclInitializer(CXCursor cursor);25462547/**2548* If cursor refers to a variable declaration that has global storage returns 1.2549* If cursor refers to a variable declaration that doesn't have global storage2550* returns 0. Otherwise returns -1.2551*/2552CINDEX_LINKAGE int clang_Cursor_hasVarDeclGlobalStorage(CXCursor cursor);25532554/**2555* If cursor refers to a variable declaration that has external storage2556* returns 1. If cursor refers to a variable declaration that doesn't have2557* external storage returns 0. Otherwise returns -1.2558*/2559CINDEX_LINKAGE int clang_Cursor_hasVarDeclExternalStorage(CXCursor cursor);25602561/**2562* Describe the "language" of the entity referred to by a cursor.2563*/2564enum CXLanguageKind {2565CXLanguage_Invalid = 0,2566CXLanguage_C,2567CXLanguage_ObjC,2568CXLanguage_CPlusPlus2569};25702571/**2572* Determine the "language" of the entity referred to by a given cursor.2573*/2574CINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor);25752576/**2577* Describe the "thread-local storage (TLS) kind" of the declaration2578* referred to by a cursor.2579*/2580enum CXTLSKind { CXTLS_None = 0, CXTLS_Dynamic, CXTLS_Static };25812582/**2583* Determine the "thread-local storage (TLS) kind" of the declaration2584* referred to by a cursor.2585*/2586CINDEX_LINKAGE enum CXTLSKind clang_getCursorTLSKind(CXCursor cursor);25872588/**2589* Returns the translation unit that a cursor originated from.2590*/2591CINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor);25922593/**2594* A fast container representing a set of CXCursors.2595*/2596typedef struct CXCursorSetImpl *CXCursorSet;25972598/**2599* Creates an empty CXCursorSet.2600*/2601CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void);26022603/**2604* Disposes a CXCursorSet and releases its associated memory.2605*/2606CINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset);26072608/**2609* Queries a CXCursorSet to see if it contains a specific CXCursor.2610*2611* \returns non-zero if the set contains the specified cursor.2612*/2613CINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset,2614CXCursor cursor);26152616/**2617* Inserts a CXCursor into a CXCursorSet.2618*2619* \returns zero if the CXCursor was already in the set, and non-zero otherwise.2620*/2621CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset,2622CXCursor cursor);26232624/**2625* Determine the semantic parent of the given cursor.2626*2627* The semantic parent of a cursor is the cursor that semantically contains2628* the given \p cursor. For many declarations, the lexical and semantic parents2629* are equivalent (the lexical parent is returned by2630* \c clang_getCursorLexicalParent()). They diverge when declarations or2631* definitions are provided out-of-line. For example:2632*2633* \code2634* class C {2635* void f();2636* };2637*2638* void C::f() { }2639* \endcode2640*2641* In the out-of-line definition of \c C::f, the semantic parent is2642* the class \c C, of which this function is a member. The lexical parent is2643* the place where the declaration actually occurs in the source code; in this2644* case, the definition occurs in the translation unit. In general, the2645* lexical parent for a given entity can change without affecting the semantics2646* of the program, and the lexical parent of different declarations of the2647* same entity may be different. Changing the semantic parent of a declaration,2648* on the other hand, can have a major impact on semantics, and redeclarations2649* of a particular entity should all have the same semantic context.2650*2651* In the example above, both declarations of \c C::f have \c C as their2652* semantic context, while the lexical context of the first \c C::f is \c C2653* and the lexical context of the second \c C::f is the translation unit.2654*2655* For global declarations, the semantic parent is the translation unit.2656*/2657CINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor);26582659/**2660* Determine the lexical parent of the given cursor.2661*2662* The lexical parent of a cursor is the cursor in which the given \p cursor2663* was actually written. For many declarations, the lexical and semantic parents2664* are equivalent (the semantic parent is returned by2665* \c clang_getCursorSemanticParent()). They diverge when declarations or2666* definitions are provided out-of-line. For example:2667*2668* \code2669* class C {2670* void f();2671* };2672*2673* void C::f() { }2674* \endcode2675*2676* In the out-of-line definition of \c C::f, the semantic parent is2677* the class \c C, of which this function is a member. The lexical parent is2678* the place where the declaration actually occurs in the source code; in this2679* case, the definition occurs in the translation unit. In general, the2680* lexical parent for a given entity can change without affecting the semantics2681* of the program, and the lexical parent of different declarations of the2682* same entity may be different. Changing the semantic parent of a declaration,2683* on the other hand, can have a major impact on semantics, and redeclarations2684* of a particular entity should all have the same semantic context.2685*2686* In the example above, both declarations of \c C::f have \c C as their2687* semantic context, while the lexical context of the first \c C::f is \c C2688* and the lexical context of the second \c C::f is the translation unit.2689*2690* For declarations written in the global scope, the lexical parent is2691* the translation unit.2692*/2693CINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor);26942695/**2696* Determine the set of methods that are overridden by the given2697* method.2698*2699* In both Objective-C and C++, a method (aka virtual member function,2700* in C++) can override a virtual method in a base class. For2701* Objective-C, a method is said to override any method in the class's2702* base class, its protocols, or its categories' protocols, that has the same2703* selector and is of the same kind (class or instance).2704* If no such method exists, the search continues to the class's superclass,2705* its protocols, and its categories, and so on. A method from an Objective-C2706* implementation is considered to override the same methods as its2707* corresponding method in the interface.2708*2709* For C++, a virtual member function overrides any virtual member2710* function with the same signature that occurs in its base2711* classes. With multiple inheritance, a virtual member function can2712* override several virtual member functions coming from different2713* base classes.2714*2715* In all cases, this function determines the immediate overridden2716* method, rather than all of the overridden methods. For example, if2717* a method is originally declared in a class A, then overridden in B2718* (which in inherits from A) and also in C (which inherited from B),2719* then the only overridden method returned from this function when2720* invoked on C's method will be B's method. The client may then2721* invoke this function again, given the previously-found overridden2722* methods, to map out the complete method-override set.2723*2724* \param cursor A cursor representing an Objective-C or C++2725* method. This routine will compute the set of methods that this2726* method overrides.2727*2728* \param overridden A pointer whose pointee will be replaced with a2729* pointer to an array of cursors, representing the set of overridden2730* methods. If there are no overridden methods, the pointee will be2731* set to NULL. The pointee must be freed via a call to2732* \c clang_disposeOverriddenCursors().2733*2734* \param num_overridden A pointer to the number of overridden2735* functions, will be set to the number of overridden functions in the2736* array pointed to by \p overridden.2737*/2738CINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor,2739CXCursor **overridden,2740unsigned *num_overridden);27412742/**2743* Free the set of overridden cursors returned by \c2744* clang_getOverriddenCursors().2745*/2746CINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden);27472748/**2749* Retrieve the file that is included by the given inclusion directive2750* cursor.2751*/2752CINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor);27532754/**2755* @}2756*/27572758/**2759* \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code2760*2761* Cursors represent a location within the Abstract Syntax Tree (AST). These2762* routines help map between cursors and the physical locations where the2763* described entities occur in the source code. The mapping is provided in2764* both directions, so one can map from source code to the AST and back.2765*2766* @{2767*/27682769/**2770* Map a source location to the cursor that describes the entity at that2771* location in the source code.2772*2773* clang_getCursor() maps an arbitrary source location within a translation2774* unit down to the most specific cursor that describes the entity at that2775* location. For example, given an expression \c x + y, invoking2776* clang_getCursor() with a source location pointing to "x" will return the2777* cursor for "x"; similarly for "y". If the cursor points anywhere between2778* "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()2779* will return a cursor referring to the "+" expression.2780*2781* \returns a cursor representing the entity at the given source location, or2782* a NULL cursor if no such entity can be found.2783*/2784CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation);27852786/**2787* Retrieve the physical location of the source constructor referenced2788* by the given cursor.2789*2790* The location of a declaration is typically the location of the name of that2791* declaration, where the name of that declaration would occur if it is2792* unnamed, or some keyword that introduces that particular declaration.2793* The location of a reference is where that reference occurs within the2794* source code.2795*/2796CINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor);27972798/**2799* Retrieve the physical extent of the source construct referenced by2800* the given cursor.2801*2802* The extent of a cursor starts with the file/line/column pointing at the2803* first character within the source construct that the cursor refers to and2804* ends with the last character within that source construct. For a2805* declaration, the extent covers the declaration itself. For a reference,2806* the extent covers the location of the reference (e.g., where the referenced2807* entity was actually used).2808*/2809CINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor);28102811/**2812* @}2813*/28142815/**2816* \defgroup CINDEX_TYPES Type information for CXCursors2817*2818* @{2819*/28202821/**2822* Describes the kind of type2823*/2824enum CXTypeKind {2825/**2826* Represents an invalid type (e.g., where no type is available).2827*/2828CXType_Invalid = 0,28292830/**2831* A type whose specific kind is not exposed via this2832* interface.2833*/2834CXType_Unexposed = 1,28352836/* Builtin types */2837CXType_Void = 2,2838CXType_Bool = 3,2839CXType_Char_U = 4,2840CXType_UChar = 5,2841CXType_Char16 = 6,2842CXType_Char32 = 7,2843CXType_UShort = 8,2844CXType_UInt = 9,2845CXType_ULong = 10,2846CXType_ULongLong = 11,2847CXType_UInt128 = 12,2848CXType_Char_S = 13,2849CXType_SChar = 14,2850CXType_WChar = 15,2851CXType_Short = 16,2852CXType_Int = 17,2853CXType_Long = 18,2854CXType_LongLong = 19,2855CXType_Int128 = 20,2856CXType_Float = 21,2857CXType_Double = 22,2858CXType_LongDouble = 23,2859CXType_NullPtr = 24,2860CXType_Overload = 25,2861CXType_Dependent = 26,2862CXType_ObjCId = 27,2863CXType_ObjCClass = 28,2864CXType_ObjCSel = 29,2865CXType_Float128 = 30,2866CXType_Half = 31,2867CXType_Float16 = 32,2868CXType_ShortAccum = 33,2869CXType_Accum = 34,2870CXType_LongAccum = 35,2871CXType_UShortAccum = 36,2872CXType_UAccum = 37,2873CXType_ULongAccum = 38,2874CXType_BFloat16 = 39,2875CXType_Ibm128 = 40,2876CXType_FirstBuiltin = CXType_Void,2877CXType_LastBuiltin = CXType_Ibm128,28782879CXType_Complex = 100,2880CXType_Pointer = 101,2881CXType_BlockPointer = 102,2882CXType_LValueReference = 103,2883CXType_RValueReference = 104,2884CXType_Record = 105,2885CXType_Enum = 106,2886CXType_Typedef = 107,2887CXType_ObjCInterface = 108,2888CXType_ObjCObjectPointer = 109,2889CXType_FunctionNoProto = 110,2890CXType_FunctionProto = 111,2891CXType_ConstantArray = 112,2892CXType_Vector = 113,2893CXType_IncompleteArray = 114,2894CXType_VariableArray = 115,2895CXType_DependentSizedArray = 116,2896CXType_MemberPointer = 117,2897CXType_Auto = 118,28982899/**2900* Represents a type that was referred to using an elaborated type keyword.2901*2902* E.g., struct S, or via a qualified name, e.g., N::M::type, or both.2903*/2904CXType_Elaborated = 119,29052906/* OpenCL PipeType. */2907CXType_Pipe = 120,29082909/* OpenCL builtin types. */2910CXType_OCLImage1dRO = 121,2911CXType_OCLImage1dArrayRO = 122,2912CXType_OCLImage1dBufferRO = 123,2913CXType_OCLImage2dRO = 124,2914CXType_OCLImage2dArrayRO = 125,2915CXType_OCLImage2dDepthRO = 126,2916CXType_OCLImage2dArrayDepthRO = 127,2917CXType_OCLImage2dMSAARO = 128,2918CXType_OCLImage2dArrayMSAARO = 129,2919CXType_OCLImage2dMSAADepthRO = 130,2920CXType_OCLImage2dArrayMSAADepthRO = 131,2921CXType_OCLImage3dRO = 132,2922CXType_OCLImage1dWO = 133,2923CXType_OCLImage1dArrayWO = 134,2924CXType_OCLImage1dBufferWO = 135,2925CXType_OCLImage2dWO = 136,2926CXType_OCLImage2dArrayWO = 137,2927CXType_OCLImage2dDepthWO = 138,2928CXType_OCLImage2dArrayDepthWO = 139,2929CXType_OCLImage2dMSAAWO = 140,2930CXType_OCLImage2dArrayMSAAWO = 141,2931CXType_OCLImage2dMSAADepthWO = 142,2932CXType_OCLImage2dArrayMSAADepthWO = 143,2933CXType_OCLImage3dWO = 144,2934CXType_OCLImage1dRW = 145,2935CXType_OCLImage1dArrayRW = 146,2936CXType_OCLImage1dBufferRW = 147,2937CXType_OCLImage2dRW = 148,2938CXType_OCLImage2dArrayRW = 149,2939CXType_OCLImage2dDepthRW = 150,2940CXType_OCLImage2dArrayDepthRW = 151,2941CXType_OCLImage2dMSAARW = 152,2942CXType_OCLImage2dArrayMSAARW = 153,2943CXType_OCLImage2dMSAADepthRW = 154,2944CXType_OCLImage2dArrayMSAADepthRW = 155,2945CXType_OCLImage3dRW = 156,2946CXType_OCLSampler = 157,2947CXType_OCLEvent = 158,2948CXType_OCLQueue = 159,2949CXType_OCLReserveID = 160,29502951CXType_ObjCObject = 161,2952CXType_ObjCTypeParam = 162,2953CXType_Attributed = 163,29542955CXType_OCLIntelSubgroupAVCMcePayload = 164,2956CXType_OCLIntelSubgroupAVCImePayload = 165,2957CXType_OCLIntelSubgroupAVCRefPayload = 166,2958CXType_OCLIntelSubgroupAVCSicPayload = 167,2959CXType_OCLIntelSubgroupAVCMceResult = 168,2960CXType_OCLIntelSubgroupAVCImeResult = 169,2961CXType_OCLIntelSubgroupAVCRefResult = 170,2962CXType_OCLIntelSubgroupAVCSicResult = 171,2963CXType_OCLIntelSubgroupAVCImeResultSingleReferenceStreamout = 172,2964CXType_OCLIntelSubgroupAVCImeResultDualReferenceStreamout = 173,2965CXType_OCLIntelSubgroupAVCImeSingleReferenceStreamin = 174,2966CXType_OCLIntelSubgroupAVCImeDualReferenceStreamin = 175,29672968/* Old aliases for AVC OpenCL extension types. */2969CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout = 172,2970CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout = 173,2971CXType_OCLIntelSubgroupAVCImeSingleRefStreamin = 174,2972CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175,29732974CXType_ExtVector = 176,2975CXType_Atomic = 177,2976CXType_BTFTagAttributed = 1782977};29782979/**2980* Describes the calling convention of a function type2981*/2982enum CXCallingConv {2983CXCallingConv_Default = 0,2984CXCallingConv_C = 1,2985CXCallingConv_X86StdCall = 2,2986CXCallingConv_X86FastCall = 3,2987CXCallingConv_X86ThisCall = 4,2988CXCallingConv_X86Pascal = 5,2989CXCallingConv_AAPCS = 6,2990CXCallingConv_AAPCS_VFP = 7,2991CXCallingConv_X86RegCall = 8,2992CXCallingConv_IntelOclBicc = 9,2993CXCallingConv_Win64 = 10,2994/* Alias for compatibility with older versions of API. */2995CXCallingConv_X86_64Win64 = CXCallingConv_Win64,2996CXCallingConv_X86_64SysV = 11,2997CXCallingConv_X86VectorCall = 12,2998CXCallingConv_Swift = 13,2999CXCallingConv_PreserveMost = 14,3000CXCallingConv_PreserveAll = 15,3001CXCallingConv_AArch64VectorCall = 16,3002CXCallingConv_SwiftAsync = 17,3003CXCallingConv_AArch64SVEPCS = 18,3004CXCallingConv_M68kRTD = 19,3005CXCallingConv_PreserveNone = 20,3006CXCallingConv_RISCVVectorCall = 21,30073008CXCallingConv_Invalid = 100,3009CXCallingConv_Unexposed = 2003010};30113012/**3013* The type of an element in the abstract syntax tree.3014*3015*/3016typedef struct {3017enum CXTypeKind kind;3018void *data[2];3019} CXType;30203021/**3022* Retrieve the type of a CXCursor (if any).3023*/3024CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C);30253026/**3027* Pretty-print the underlying type using the rules of the3028* language of the translation unit from which it came.3029*3030* If the type is invalid, an empty string is returned.3031*/3032CINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT);30333034/**3035* Retrieve the underlying type of a typedef declaration.3036*3037* If the cursor does not reference a typedef declaration, an invalid type is3038* returned.3039*/3040CINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C);30413042/**3043* Retrieve the integer type of an enum declaration.3044*3045* If the cursor does not reference an enum declaration, an invalid type is3046* returned.3047*/3048CINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C);30493050/**3051* Retrieve the integer value of an enum constant declaration as a signed3052* long long.3053*3054* If the cursor does not reference an enum constant declaration, LLONG_MIN is3055* returned. Since this is also potentially a valid constant value, the kind of3056* the cursor must be verified before calling this function.3057*/3058CINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C);30593060/**3061* Retrieve the integer value of an enum constant declaration as an unsigned3062* long long.3063*3064* If the cursor does not reference an enum constant declaration, ULLONG_MAX is3065* returned. Since this is also potentially a valid constant value, the kind of3066* the cursor must be verified before calling this function.3067*/3068CINDEX_LINKAGE unsigned long long3069clang_getEnumConstantDeclUnsignedValue(CXCursor C);30703071/**3072* Returns non-zero if the cursor specifies a Record member that is a bit-field.3073*/3074CINDEX_LINKAGE unsigned clang_Cursor_isBitField(CXCursor C);30753076/**3077* Retrieve the bit width of a bit-field declaration as an integer.3078*3079* If the cursor does not reference a bit-field, or if the bit-field's width3080* expression cannot be evaluated, -1 is returned.3081*3082* For example:3083* \code3084* if (clang_Cursor_isBitField(Cursor)) {3085* int Width = clang_getFieldDeclBitWidth(Cursor);3086* if (Width != -1) {3087* // The bit-field width is not value-dependent.3088* }3089* }3090* \endcode3091*/3092CINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C);30933094/**3095* Retrieve the number of non-variadic arguments associated with a given3096* cursor.3097*3098* The number of arguments can be determined for calls as well as for3099* declarations of functions or methods. For other cursors -1 is returned.3100*/3101CINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C);31023103/**3104* Retrieve the argument cursor of a function or method.3105*3106* The argument cursor can be determined for calls as well as for declarations3107* of functions or methods. For other cursors and for invalid indices, an3108* invalid cursor is returned.3109*/3110CINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i);31113112/**3113* Describes the kind of a template argument.3114*3115* See the definition of llvm::clang::TemplateArgument::ArgKind for full3116* element descriptions.3117*/3118enum CXTemplateArgumentKind {3119CXTemplateArgumentKind_Null,3120CXTemplateArgumentKind_Type,3121CXTemplateArgumentKind_Declaration,3122CXTemplateArgumentKind_NullPtr,3123CXTemplateArgumentKind_Integral,3124CXTemplateArgumentKind_Template,3125CXTemplateArgumentKind_TemplateExpansion,3126CXTemplateArgumentKind_Expression,3127CXTemplateArgumentKind_Pack,3128/* Indicates an error case, preventing the kind from being deduced. */3129CXTemplateArgumentKind_Invalid3130};31313132/**3133* Returns the number of template args of a function, struct, or class decl3134* representing a template specialization.3135*3136* If the argument cursor cannot be converted into a template function3137* declaration, -1 is returned.3138*3139* For example, for the following declaration and specialization:3140* template <typename T, int kInt, bool kBool>3141* void foo() { ... }3142*3143* template <>3144* void foo<float, -7, true>();3145*3146* The value 3 would be returned from this call.3147*/3148CINDEX_LINKAGE int clang_Cursor_getNumTemplateArguments(CXCursor C);31493150/**3151* Retrieve the kind of the I'th template argument of the CXCursor C.3152*3153* If the argument CXCursor does not represent a FunctionDecl, StructDecl, or3154* ClassTemplatePartialSpecialization, an invalid template argument kind is3155* returned.3156*3157* For example, for the following declaration and specialization:3158* template <typename T, int kInt, bool kBool>3159* void foo() { ... }3160*3161* template <>3162* void foo<float, -7, true>();3163*3164* For I = 0, 1, and 2, Type, Integral, and Integral will be returned,3165* respectively.3166*/3167CINDEX_LINKAGE enum CXTemplateArgumentKind3168clang_Cursor_getTemplateArgumentKind(CXCursor C, unsigned I);31693170/**3171* Retrieve a CXType representing the type of a TemplateArgument of a3172* function decl representing a template specialization.3173*3174* If the argument CXCursor does not represent a FunctionDecl, StructDecl,3175* ClassDecl or ClassTemplatePartialSpecialization whose I'th template argument3176* has a kind of CXTemplateArgKind_Integral, an invalid type is returned.3177*3178* For example, for the following declaration and specialization:3179* template <typename T, int kInt, bool kBool>3180* void foo() { ... }3181*3182* template <>3183* void foo<float, -7, true>();3184*3185* If called with I = 0, "float", will be returned.3186* Invalid types will be returned for I == 1 or 2.3187*/3188CINDEX_LINKAGE CXType clang_Cursor_getTemplateArgumentType(CXCursor C,3189unsigned I);31903191/**3192* Retrieve the value of an Integral TemplateArgument (of a function3193* decl representing a template specialization) as a signed long long.3194*3195* It is undefined to call this function on a CXCursor that does not represent a3196* FunctionDecl, StructDecl, ClassDecl or ClassTemplatePartialSpecialization3197* whose I'th template argument is not an integral value.3198*3199* For example, for the following declaration and specialization:3200* template <typename T, int kInt, bool kBool>3201* void foo() { ... }3202*3203* template <>3204* void foo<float, -7, true>();3205*3206* If called with I = 1 or 2, -7 or true will be returned, respectively.3207* For I == 0, this function's behavior is undefined.3208*/3209CINDEX_LINKAGE long long clang_Cursor_getTemplateArgumentValue(CXCursor C,3210unsigned I);32113212/**3213* Retrieve the value of an Integral TemplateArgument (of a function3214* decl representing a template specialization) as an unsigned long long.3215*3216* It is undefined to call this function on a CXCursor that does not represent a3217* FunctionDecl, StructDecl, ClassDecl or ClassTemplatePartialSpecialization or3218* whose I'th template argument is not an integral value.3219*3220* For example, for the following declaration and specialization:3221* template <typename T, int kInt, bool kBool>3222* void foo() { ... }3223*3224* template <>3225* void foo<float, 2147483649, true>();3226*3227* If called with I = 1 or 2, 2147483649 or true will be returned, respectively.3228* For I == 0, this function's behavior is undefined.3229*/3230CINDEX_LINKAGE unsigned long long3231clang_Cursor_getTemplateArgumentUnsignedValue(CXCursor C, unsigned I);32323233/**3234* Determine whether two CXTypes represent the same type.3235*3236* \returns non-zero if the CXTypes represent the same type and3237* zero otherwise.3238*/3239CINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B);32403241/**3242* Return the canonical type for a CXType.3243*3244* Clang's type system explicitly models typedefs and all the ways3245* a specific type can be represented. The canonical type is the underlying3246* type with all the "sugar" removed. For example, if 'T' is a typedef3247* for 'int', the canonical type for 'T' would be 'int'.3248*/3249CINDEX_LINKAGE CXType clang_getCanonicalType(CXType T);32503251/**3252* Determine whether a CXType has the "const" qualifier set,3253* without looking through typedefs that may have added "const" at a3254* different level.3255*/3256CINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T);32573258/**3259* Determine whether a CXCursor that is a macro, is3260* function like.3261*/3262CINDEX_LINKAGE unsigned clang_Cursor_isMacroFunctionLike(CXCursor C);32633264/**3265* Determine whether a CXCursor that is a macro, is a3266* builtin one.3267*/3268CINDEX_LINKAGE unsigned clang_Cursor_isMacroBuiltin(CXCursor C);32693270/**3271* Determine whether a CXCursor that is a function declaration, is an3272* inline declaration.3273*/3274CINDEX_LINKAGE unsigned clang_Cursor_isFunctionInlined(CXCursor C);32753276/**3277* Determine whether a CXType has the "volatile" qualifier set,3278* without looking through typedefs that may have added "volatile" at3279* a different level.3280*/3281CINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T);32823283/**3284* Determine whether a CXType has the "restrict" qualifier set,3285* without looking through typedefs that may have added "restrict" at a3286* different level.3287*/3288CINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T);32893290/**3291* Returns the address space of the given type.3292*/3293CINDEX_LINKAGE unsigned clang_getAddressSpace(CXType T);32943295/**3296* Returns the typedef name of the given type.3297*/3298CINDEX_LINKAGE CXString clang_getTypedefName(CXType CT);32993300/**3301* For pointer types, returns the type of the pointee.3302*/3303CINDEX_LINKAGE CXType clang_getPointeeType(CXType T);33043305/**3306* Retrieve the unqualified variant of the given type, removing as3307* little sugar as possible.3308*3309* For example, given the following series of typedefs:3310*3311* \code3312* typedef int Integer;3313* typedef const Integer CInteger;3314* typedef CInteger DifferenceType;3315* \endcode3316*3317* Executing \c clang_getUnqualifiedType() on a \c CXType that3318* represents \c DifferenceType, will desugar to a type representing3319* \c Integer, that has no qualifiers.3320*3321* And, executing \c clang_getUnqualifiedType() on the type of the3322* first argument of the following function declaration:3323*3324* \code3325* void foo(const int);3326* \endcode3327*3328* Will return a type representing \c int, removing the \c const3329* qualifier.3330*3331* Sugar over array types is not desugared.3332*3333* A type can be checked for qualifiers with \c3334* clang_isConstQualifiedType(), \c clang_isVolatileQualifiedType()3335* and \c clang_isRestrictQualifiedType().3336*3337* A type that resulted from a call to \c clang_getUnqualifiedType3338* will return \c false for all of the above calls.3339*/3340CINDEX_LINKAGE CXType clang_getUnqualifiedType(CXType CT);33413342/**3343* For reference types (e.g., "const int&"), returns the type that the3344* reference refers to (e.g "const int").3345*3346* Otherwise, returns the type itself.3347*3348* A type that has kind \c CXType_LValueReference or3349* \c CXType_RValueReference is a reference type.3350*/3351CINDEX_LINKAGE CXType clang_getNonReferenceType(CXType CT);33523353/**3354* Return the cursor for the declaration of the given type.3355*/3356CINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T);33573358/**3359* Returns the Objective-C type encoding for the specified declaration.3360*/3361CINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C);33623363/**3364* Returns the Objective-C type encoding for the specified CXType.3365*/3366CINDEX_LINKAGE CXString clang_Type_getObjCEncoding(CXType type);33673368/**3369* Retrieve the spelling of a given CXTypeKind.3370*/3371CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K);33723373/**3374* Retrieve the calling convention associated with a function type.3375*3376* If a non-function type is passed in, CXCallingConv_Invalid is returned.3377*/3378CINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T);33793380/**3381* Retrieve the return type associated with a function type.3382*3383* If a non-function type is passed in, an invalid type is returned.3384*/3385CINDEX_LINKAGE CXType clang_getResultType(CXType T);33863387/**3388* Retrieve the exception specification type associated with a function type.3389* This is a value of type CXCursor_ExceptionSpecificationKind.3390*3391* If a non-function type is passed in, an error code of -1 is returned.3392*/3393CINDEX_LINKAGE int clang_getExceptionSpecificationType(CXType T);33943395/**3396* Retrieve the number of non-variadic parameters associated with a3397* function type.3398*3399* If a non-function type is passed in, -1 is returned.3400*/3401CINDEX_LINKAGE int clang_getNumArgTypes(CXType T);34023403/**3404* Retrieve the type of a parameter of a function type.3405*3406* If a non-function type is passed in or the function does not have enough3407* parameters, an invalid type is returned.3408*/3409CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i);34103411/**3412* Retrieves the base type of the ObjCObjectType.3413*3414* If the type is not an ObjC object, an invalid type is returned.3415*/3416CINDEX_LINKAGE CXType clang_Type_getObjCObjectBaseType(CXType T);34173418/**3419* Retrieve the number of protocol references associated with an ObjC object/id.3420*3421* If the type is not an ObjC object, 0 is returned.3422*/3423CINDEX_LINKAGE unsigned clang_Type_getNumObjCProtocolRefs(CXType T);34243425/**3426* Retrieve the decl for a protocol reference for an ObjC object/id.3427*3428* If the type is not an ObjC object or there are not enough protocol3429* references, an invalid cursor is returned.3430*/3431CINDEX_LINKAGE CXCursor clang_Type_getObjCProtocolDecl(CXType T, unsigned i);34323433/**3434* Retrieve the number of type arguments associated with an ObjC object.3435*3436* If the type is not an ObjC object, 0 is returned.3437*/3438CINDEX_LINKAGE unsigned clang_Type_getNumObjCTypeArgs(CXType T);34393440/**3441* Retrieve a type argument associated with an ObjC object.3442*3443* If the type is not an ObjC or the index is not valid,3444* an invalid type is returned.3445*/3446CINDEX_LINKAGE CXType clang_Type_getObjCTypeArg(CXType T, unsigned i);34473448/**3449* Return 1 if the CXType is a variadic function type, and 0 otherwise.3450*/3451CINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T);34523453/**3454* Retrieve the return type associated with a given cursor.3455*3456* This only returns a valid type if the cursor refers to a function or method.3457*/3458CINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C);34593460/**3461* Retrieve the exception specification type associated with a given cursor.3462* This is a value of type CXCursor_ExceptionSpecificationKind.3463*3464* This only returns a valid result if the cursor refers to a function or3465* method.3466*/3467CINDEX_LINKAGE int clang_getCursorExceptionSpecificationType(CXCursor C);34683469/**3470* Return 1 if the CXType is a POD (plain old data) type, and 03471* otherwise.3472*/3473CINDEX_LINKAGE unsigned clang_isPODType(CXType T);34743475/**3476* Return the element type of an array, complex, or vector type.3477*3478* If a type is passed in that is not an array, complex, or vector type,3479* an invalid type is returned.3480*/3481CINDEX_LINKAGE CXType clang_getElementType(CXType T);34823483/**3484* Return the number of elements of an array or vector type.3485*3486* If a type is passed in that is not an array or vector type,3487* -1 is returned.3488*/3489CINDEX_LINKAGE long long clang_getNumElements(CXType T);34903491/**3492* Return the element type of an array type.3493*3494* If a non-array type is passed in, an invalid type is returned.3495*/3496CINDEX_LINKAGE CXType clang_getArrayElementType(CXType T);34973498/**3499* Return the array size of a constant array.3500*3501* If a non-array type is passed in, -1 is returned.3502*/3503CINDEX_LINKAGE long long clang_getArraySize(CXType T);35043505/**3506* Retrieve the type named by the qualified-id.3507*3508* If a non-elaborated type is passed in, an invalid type is returned.3509*/3510CINDEX_LINKAGE CXType clang_Type_getNamedType(CXType T);35113512/**3513* Determine if a typedef is 'transparent' tag.3514*3515* A typedef is considered 'transparent' if it shares a name and spelling3516* location with its underlying tag type, as is the case with the NS_ENUM macro.3517*3518* \returns non-zero if transparent and zero otherwise.3519*/3520CINDEX_LINKAGE unsigned clang_Type_isTransparentTagTypedef(CXType T);35213522enum CXTypeNullabilityKind {3523/**3524* Values of this type can never be null.3525*/3526CXTypeNullability_NonNull = 0,3527/**3528* Values of this type can be null.3529*/3530CXTypeNullability_Nullable = 1,3531/**3532* Whether values of this type can be null is (explicitly)3533* unspecified. This captures a (fairly rare) case where we3534* can't conclude anything about the nullability of the type even3535* though it has been considered.3536*/3537CXTypeNullability_Unspecified = 2,3538/**3539* Nullability is not applicable to this type.3540*/3541CXTypeNullability_Invalid = 3,35423543/**3544* Generally behaves like Nullable, except when used in a block parameter that3545* was imported into a swift async method. There, swift will assume that the3546* parameter can get null even if no error occurred. _Nullable parameters are3547* assumed to only get null on error.3548*/3549CXTypeNullability_NullableResult = 43550};35513552/**3553* Retrieve the nullability kind of a pointer type.3554*/3555CINDEX_LINKAGE enum CXTypeNullabilityKind clang_Type_getNullability(CXType T);35563557/**3558* List the possible error codes for \c clang_Type_getSizeOf,3559* \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and3560* \c clang_Cursor_getOffsetOf.3561*3562* A value of this enumeration type can be returned if the target type is not3563* a valid argument to sizeof, alignof or offsetof.3564*/3565enum CXTypeLayoutError {3566/**3567* Type is of kind CXType_Invalid.3568*/3569CXTypeLayoutError_Invalid = -1,3570/**3571* The type is an incomplete Type.3572*/3573CXTypeLayoutError_Incomplete = -2,3574/**3575* The type is a dependent Type.3576*/3577CXTypeLayoutError_Dependent = -3,3578/**3579* The type is not a constant size type.3580*/3581CXTypeLayoutError_NotConstantSize = -4,3582/**3583* The Field name is not valid for this record.3584*/3585CXTypeLayoutError_InvalidFieldName = -5,3586/**3587* The type is undeduced.3588*/3589CXTypeLayoutError_Undeduced = -63590};35913592/**3593* Return the alignment of a type in bytes as per C++[expr.alignof]3594* standard.3595*3596* If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.3597* If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete3598* is returned.3599* If the type declaration is a dependent type, CXTypeLayoutError_Dependent is3600* returned.3601* If the type declaration is not a constant size type,3602* CXTypeLayoutError_NotConstantSize is returned.3603*/3604CINDEX_LINKAGE long long clang_Type_getAlignOf(CXType T);36053606/**3607* Return the class type of an member pointer type.3608*3609* If a non-member-pointer type is passed in, an invalid type is returned.3610*/3611CINDEX_LINKAGE CXType clang_Type_getClassType(CXType T);36123613/**3614* Return the size of a type in bytes as per C++[expr.sizeof] standard.3615*3616* If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.3617* If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete3618* is returned.3619* If the type declaration is a dependent type, CXTypeLayoutError_Dependent is3620* returned.3621*/3622CINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T);36233624/**3625* Return the offset of a field named S in a record of type T in bits3626* as it would be returned by __offsetof__ as per C++11[18.2p4]3627*3628* If the cursor is not a record field declaration, CXTypeLayoutError_Invalid3629* is returned.3630* If the field's type declaration is an incomplete type,3631* CXTypeLayoutError_Incomplete is returned.3632* If the field's type declaration is a dependent type,3633* CXTypeLayoutError_Dependent is returned.3634* If the field's name S is not found,3635* CXTypeLayoutError_InvalidFieldName is returned.3636*/3637CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S);36383639/**3640* Return the type that was modified by this attributed type.3641*3642* If the type is not an attributed type, an invalid type is returned.3643*/3644CINDEX_LINKAGE CXType clang_Type_getModifiedType(CXType T);36453646/**3647* Gets the type contained by this atomic type.3648*3649* If a non-atomic type is passed in, an invalid type is returned.3650*/3651CINDEX_LINKAGE CXType clang_Type_getValueType(CXType CT);36523653/**3654* Return the offset of the field represented by the Cursor.3655*3656* If the cursor is not a field declaration, -1 is returned.3657* If the cursor semantic parent is not a record field declaration,3658* CXTypeLayoutError_Invalid is returned.3659* If the field's type declaration is an incomplete type,3660* CXTypeLayoutError_Incomplete is returned.3661* If the field's type declaration is a dependent type,3662* CXTypeLayoutError_Dependent is returned.3663* If the field's name S is not found,3664* CXTypeLayoutError_InvalidFieldName is returned.3665*/3666CINDEX_LINKAGE long long clang_Cursor_getOffsetOfField(CXCursor C);36673668/**3669* Determine whether the given cursor represents an anonymous3670* tag or namespace3671*/3672CINDEX_LINKAGE unsigned clang_Cursor_isAnonymous(CXCursor C);36733674/**3675* Determine whether the given cursor represents an anonymous record3676* declaration.3677*/3678CINDEX_LINKAGE unsigned clang_Cursor_isAnonymousRecordDecl(CXCursor C);36793680/**3681* Determine whether the given cursor represents an inline namespace3682* declaration.3683*/3684CINDEX_LINKAGE unsigned clang_Cursor_isInlineNamespace(CXCursor C);36853686enum CXRefQualifierKind {3687/** No ref-qualifier was provided. */3688CXRefQualifier_None = 0,3689/** An lvalue ref-qualifier was provided (\c &). */3690CXRefQualifier_LValue,3691/** An rvalue ref-qualifier was provided (\c &&). */3692CXRefQualifier_RValue3693};36943695/**3696* Returns the number of template arguments for given template3697* specialization, or -1 if type \c T is not a template specialization.3698*/3699CINDEX_LINKAGE int clang_Type_getNumTemplateArguments(CXType T);37003701/**3702* Returns the type template argument of a template class specialization3703* at given index.3704*3705* This function only returns template type arguments and does not handle3706* template template arguments or variadic packs.3707*/3708CINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T,3709unsigned i);37103711/**3712* Retrieve the ref-qualifier kind of a function or method.3713*3714* The ref-qualifier is returned for C++ functions or methods. For other types3715* or non-C++ declarations, CXRefQualifier_None is returned.3716*/3717CINDEX_LINKAGE enum CXRefQualifierKind clang_Type_getCXXRefQualifier(CXType T);37183719/**3720* Returns 1 if the base class specified by the cursor with kind3721* CX_CXXBaseSpecifier is virtual.3722*/3723CINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor);37243725/**3726* Represents the C++ access control level to a base class for a3727* cursor with kind CX_CXXBaseSpecifier.3728*/3729enum CX_CXXAccessSpecifier {3730CX_CXXInvalidAccessSpecifier,3731CX_CXXPublic,3732CX_CXXProtected,3733CX_CXXPrivate3734};37353736/**3737* Returns the access control level for the referenced object.3738*3739* If the cursor refers to a C++ declaration, its access control level within3740* its parent scope is returned. Otherwise, if the cursor refers to a base3741* specifier or access specifier, the specifier itself is returned.3742*/3743CINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor);37443745/**3746* Represents the storage classes as declared in the source. CX_SC_Invalid3747* was added for the case that the passed cursor in not a declaration.3748*/3749enum CX_StorageClass {3750CX_SC_Invalid,3751CX_SC_None,3752CX_SC_Extern,3753CX_SC_Static,3754CX_SC_PrivateExtern,3755CX_SC_OpenCLWorkGroupLocal,3756CX_SC_Auto,3757CX_SC_Register3758};37593760/**3761* Represents a specific kind of binary operator which can appear at a cursor.3762*/3763enum CX_BinaryOperatorKind {3764CX_BO_Invalid = 0,3765CX_BO_PtrMemD = 1,3766CX_BO_PtrMemI = 2,3767CX_BO_Mul = 3,3768CX_BO_Div = 4,3769CX_BO_Rem = 5,3770CX_BO_Add = 6,3771CX_BO_Sub = 7,3772CX_BO_Shl = 8,3773CX_BO_Shr = 9,3774CX_BO_Cmp = 10,3775CX_BO_LT = 11,3776CX_BO_GT = 12,3777CX_BO_LE = 13,3778CX_BO_GE = 14,3779CX_BO_EQ = 15,3780CX_BO_NE = 16,3781CX_BO_And = 17,3782CX_BO_Xor = 18,3783CX_BO_Or = 19,3784CX_BO_LAnd = 20,3785CX_BO_LOr = 21,3786CX_BO_Assign = 22,3787CX_BO_MulAssign = 23,3788CX_BO_DivAssign = 24,3789CX_BO_RemAssign = 25,3790CX_BO_AddAssign = 26,3791CX_BO_SubAssign = 27,3792CX_BO_ShlAssign = 28,3793CX_BO_ShrAssign = 29,3794CX_BO_AndAssign = 30,3795CX_BO_XorAssign = 31,3796CX_BO_OrAssign = 32,3797CX_BO_Comma = 33,3798CX_BO_LAST = CX_BO_Comma3799};38003801/**3802* \brief Returns the operator code for the binary operator.3803*/3804CINDEX_LINKAGE enum CX_BinaryOperatorKind3805clang_Cursor_getBinaryOpcode(CXCursor C);38063807/**3808* \brief Returns a string containing the spelling of the binary operator.3809*/3810CINDEX_LINKAGE CXString3811clang_Cursor_getBinaryOpcodeStr(enum CX_BinaryOperatorKind Op);38123813/**3814* Returns the storage class for a function or variable declaration.3815*3816* If the passed in Cursor is not a function or variable declaration,3817* CX_SC_Invalid is returned else the storage class.3818*/3819CINDEX_LINKAGE enum CX_StorageClass clang_Cursor_getStorageClass(CXCursor);38203821/**3822* Determine the number of overloaded declarations referenced by a3823* \c CXCursor_OverloadedDeclRef cursor.3824*3825* \param cursor The cursor whose overloaded declarations are being queried.3826*3827* \returns The number of overloaded declarations referenced by \c cursor. If it3828* is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.3829*/3830CINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor);38313832/**3833* Retrieve a cursor for one of the overloaded declarations referenced3834* by a \c CXCursor_OverloadedDeclRef cursor.3835*3836* \param cursor The cursor whose overloaded declarations are being queried.3837*3838* \param index The zero-based index into the set of overloaded declarations in3839* the cursor.3840*3841* \returns A cursor representing the declaration referenced by the given3842* \c cursor at the specified \c index. If the cursor does not have an3843* associated set of overloaded declarations, or if the index is out of bounds,3844* returns \c clang_getNullCursor();3845*/3846CINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor,3847unsigned index);38483849/**3850* @}3851*/38523853/**3854* \defgroup CINDEX_ATTRIBUTES Information for attributes3855*3856* @{3857*/38583859/**3860* For cursors representing an iboutletcollection attribute,3861* this function returns the collection element type.3862*3863*/3864CINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor);38653866/**3867* @}3868*/38693870/**3871* \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors3872*3873* These routines provide the ability to traverse the abstract syntax tree3874* using cursors.3875*3876* @{3877*/38783879/**3880* Describes how the traversal of the children of a particular3881* cursor should proceed after visiting a particular child cursor.3882*3883* A value of this enumeration type should be returned by each3884* \c CXCursorVisitor to indicate how clang_visitChildren() proceed.3885*/3886enum CXChildVisitResult {3887/**3888* Terminates the cursor traversal.3889*/3890CXChildVisit_Break,3891/**3892* Continues the cursor traversal with the next sibling of3893* the cursor just visited, without visiting its children.3894*/3895CXChildVisit_Continue,3896/**3897* Recursively traverse the children of this cursor, using3898* the same visitor and client data.3899*/3900CXChildVisit_Recurse3901};39023903/**3904* Visitor invoked for each cursor found by a traversal.3905*3906* This visitor function will be invoked for each cursor found by3907* clang_visitCursorChildren(). Its first argument is the cursor being3908* visited, its second argument is the parent visitor for that cursor,3909* and its third argument is the client data provided to3910* clang_visitCursorChildren().3911*3912* The visitor should return one of the \c CXChildVisitResult values3913* to direct clang_visitCursorChildren().3914*/3915typedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor,3916CXCursor parent,3917CXClientData client_data);39183919/**3920* Visit the children of a particular cursor.3921*3922* This function visits all the direct children of the given cursor,3923* invoking the given \p visitor function with the cursors of each3924* visited child. The traversal may be recursive, if the visitor returns3925* \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if3926* the visitor returns \c CXChildVisit_Break.3927*3928* \param parent the cursor whose child may be visited. All kinds of3929* cursors can be visited, including invalid cursors (which, by3930* definition, have no children).3931*3932* \param visitor the visitor function that will be invoked for each3933* child of \p parent.3934*3935* \param client_data pointer data supplied by the client, which will3936* be passed to the visitor each time it is invoked.3937*3938* \returns a non-zero value if the traversal was terminated3939* prematurely by the visitor returning \c CXChildVisit_Break.3940*/3941CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent,3942CXCursorVisitor visitor,3943CXClientData client_data);3944/**3945* Visitor invoked for each cursor found by a traversal.3946*3947* This visitor block will be invoked for each cursor found by3948* clang_visitChildrenWithBlock(). Its first argument is the cursor being3949* visited, its second argument is the parent visitor for that cursor.3950*3951* The visitor should return one of the \c CXChildVisitResult values3952* to direct clang_visitChildrenWithBlock().3953*/3954#if __has_feature(blocks)3955typedef enum CXChildVisitResult (^CXCursorVisitorBlock)(CXCursor cursor,3956CXCursor parent);3957#else3958typedef struct _CXChildVisitResult *CXCursorVisitorBlock;3959#endif39603961/**3962* Visits the children of a cursor using the specified block. Behaves3963* identically to clang_visitChildren() in all other respects.3964*/3965CINDEX_LINKAGE unsigned3966clang_visitChildrenWithBlock(CXCursor parent, CXCursorVisitorBlock block);39673968/**3969* @}3970*/39713972/**3973* \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST3974*3975* These routines provide the ability to determine references within and3976* across translation units, by providing the names of the entities referenced3977* by cursors, follow reference cursors to the declarations they reference,3978* and associate declarations with their definitions.3979*3980* @{3981*/39823983/**3984* Retrieve a Unified Symbol Resolution (USR) for the entity referenced3985* by the given cursor.3986*3987* A Unified Symbol Resolution (USR) is a string that identifies a particular3988* entity (function, class, variable, etc.) within a program. USRs can be3989* compared across translation units to determine, e.g., when references in3990* one translation refer to an entity defined in another translation unit.3991*/3992CINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor);39933994/**3995* Construct a USR for a specified Objective-C class.3996*/3997CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name);39983999/**4000* Construct a USR for a specified Objective-C category.4001*/4002CINDEX_LINKAGE CXString clang_constructUSR_ObjCCategory(4003const char *class_name, const char *category_name);40044005/**4006* Construct a USR for a specified Objective-C protocol.4007*/4008CINDEX_LINKAGE CXString4009clang_constructUSR_ObjCProtocol(const char *protocol_name);40104011/**4012* Construct a USR for a specified Objective-C instance variable and4013* the USR for its containing class.4014*/4015CINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name,4016CXString classUSR);40174018/**4019* Construct a USR for a specified Objective-C method and4020* the USR for its containing class.4021*/4022CINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name,4023unsigned isInstanceMethod,4024CXString classUSR);40254026/**4027* Construct a USR for a specified Objective-C property and the USR4028* for its containing class.4029*/4030CINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property,4031CXString classUSR);40324033/**4034* Retrieve a name for the entity referenced by this cursor.4035*/4036CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);40374038/**4039* Retrieve a range for a piece that forms the cursors spelling name.4040* Most of the times there is only one range for the complete spelling but for4041* Objective-C methods and Objective-C message expressions, there are multiple4042* pieces for each selector identifier.4043*4044* \param pieceIndex the index of the spelling name piece. If this is greater4045* than the actual number of pieces, it will return a NULL (invalid) range.4046*4047* \param options Reserved.4048*/4049CINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(4050CXCursor, unsigned pieceIndex, unsigned options);40514052/**4053* Opaque pointer representing a policy that controls pretty printing4054* for \c clang_getCursorPrettyPrinted.4055*/4056typedef void *CXPrintingPolicy;40574058/**4059* Properties for the printing policy.4060*4061* See \c clang::PrintingPolicy for more information.4062*/4063enum CXPrintingPolicyProperty {4064CXPrintingPolicy_Indentation,4065CXPrintingPolicy_SuppressSpecifiers,4066CXPrintingPolicy_SuppressTagKeyword,4067CXPrintingPolicy_IncludeTagDefinition,4068CXPrintingPolicy_SuppressScope,4069CXPrintingPolicy_SuppressUnwrittenScope,4070CXPrintingPolicy_SuppressInitializers,4071CXPrintingPolicy_ConstantArraySizeAsWritten,4072CXPrintingPolicy_AnonymousTagLocations,4073CXPrintingPolicy_SuppressStrongLifetime,4074CXPrintingPolicy_SuppressLifetimeQualifiers,4075CXPrintingPolicy_SuppressTemplateArgsInCXXConstructors,4076CXPrintingPolicy_Bool,4077CXPrintingPolicy_Restrict,4078CXPrintingPolicy_Alignof,4079CXPrintingPolicy_UnderscoreAlignof,4080CXPrintingPolicy_UseVoidForZeroParams,4081CXPrintingPolicy_TerseOutput,4082CXPrintingPolicy_PolishForDeclaration,4083CXPrintingPolicy_Half,4084CXPrintingPolicy_MSWChar,4085CXPrintingPolicy_IncludeNewlines,4086CXPrintingPolicy_MSVCFormatting,4087CXPrintingPolicy_ConstantsAsWritten,4088CXPrintingPolicy_SuppressImplicitBase,4089CXPrintingPolicy_FullyQualifiedName,40904091CXPrintingPolicy_LastProperty = CXPrintingPolicy_FullyQualifiedName4092};40934094/**4095* Get a property value for the given printing policy.4096*/4097CINDEX_LINKAGE unsigned4098clang_PrintingPolicy_getProperty(CXPrintingPolicy Policy,4099enum CXPrintingPolicyProperty Property);41004101/**4102* Set a property value for the given printing policy.4103*/4104CINDEX_LINKAGE void4105clang_PrintingPolicy_setProperty(CXPrintingPolicy Policy,4106enum CXPrintingPolicyProperty Property,4107unsigned Value);41084109/**4110* Retrieve the default policy for the cursor.4111*4112* The policy should be released after use with \c4113* clang_PrintingPolicy_dispose.4114*/4115CINDEX_LINKAGE CXPrintingPolicy clang_getCursorPrintingPolicy(CXCursor);41164117/**4118* Release a printing policy.4119*/4120CINDEX_LINKAGE void clang_PrintingPolicy_dispose(CXPrintingPolicy Policy);41214122/**4123* Pretty print declarations.4124*4125* \param Cursor The cursor representing a declaration.4126*4127* \param Policy The policy to control the entities being printed. If4128* NULL, a default policy is used.4129*4130* \returns The pretty printed declaration or the empty string for4131* other cursors.4132*/4133CINDEX_LINKAGE CXString clang_getCursorPrettyPrinted(CXCursor Cursor,4134CXPrintingPolicy Policy);41354136/**4137* Retrieve the display name for the entity referenced by this cursor.4138*4139* The display name contains extra information that helps identify the cursor,4140* such as the parameters of a function or template or the arguments of a4141* class template specialization.4142*/4143CINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor);41444145/** For a cursor that is a reference, retrieve a cursor representing the4146* entity that it references.4147*4148* Reference cursors refer to other entities in the AST. For example, an4149* Objective-C superclass reference cursor refers to an Objective-C class.4150* This function produces the cursor for the Objective-C class from the4151* cursor for the superclass reference. If the input cursor is a declaration or4152* definition, it returns that declaration or definition unchanged.4153* Otherwise, returns the NULL cursor.4154*/4155CINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor);41564157/**4158* For a cursor that is either a reference to or a declaration4159* of some entity, retrieve a cursor that describes the definition of4160* that entity.4161*4162* Some entities can be declared multiple times within a translation4163* unit, but only one of those declarations can also be a4164* definition. For example, given:4165*4166* \code4167* int f(int, int);4168* int g(int x, int y) { return f(x, y); }4169* int f(int a, int b) { return a + b; }4170* int f(int, int);4171* \endcode4172*4173* there are three declarations of the function "f", but only the4174* second one is a definition. The clang_getCursorDefinition()4175* function will take any cursor pointing to a declaration of "f"4176* (the first or fourth lines of the example) or a cursor referenced4177* that uses "f" (the call to "f' inside "g") and will return a4178* declaration cursor pointing to the definition (the second "f"4179* declaration).4180*4181* If given a cursor for which there is no corresponding definition,4182* e.g., because there is no definition of that entity within this4183* translation unit, returns a NULL cursor.4184*/4185CINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor);41864187/**4188* Determine whether the declaration pointed to by this cursor4189* is also a definition of that entity.4190*/4191CINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor);41924193/**4194* Retrieve the canonical cursor corresponding to the given cursor.4195*4196* In the C family of languages, many kinds of entities can be declared several4197* times within a single translation unit. For example, a structure type can4198* be forward-declared (possibly multiple times) and later defined:4199*4200* \code4201* struct X;4202* struct X;4203* struct X {4204* int member;4205* };4206* \endcode4207*4208* The declarations and the definition of \c X are represented by three4209* different cursors, all of which are declarations of the same underlying4210* entity. One of these cursor is considered the "canonical" cursor, which4211* is effectively the representative for the underlying entity. One can4212* determine if two cursors are declarations of the same underlying entity by4213* comparing their canonical cursors.4214*4215* \returns The canonical cursor for the entity referred to by the given cursor.4216*/4217CINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor);42184219/**4220* If the cursor points to a selector identifier in an Objective-C4221* method or message expression, this returns the selector index.4222*4223* After getting a cursor with #clang_getCursor, this can be called to4224* determine if the location points to a selector identifier.4225*4226* \returns The selector index if the cursor is an Objective-C method or message4227* expression and the cursor is pointing to a selector identifier, or -14228* otherwise.4229*/4230CINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor);42314232/**4233* Given a cursor pointing to a C++ method call or an Objective-C4234* message, returns non-zero if the method/message is "dynamic", meaning:4235*4236* For a C++ method: the call is virtual.4237* For an Objective-C message: the receiver is an object instance, not 'super'4238* or a specific class.4239*4240* If the method/message is "static" or the cursor does not point to a4241* method/message, it will return zero.4242*/4243CINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C);42444245/**4246* Given a cursor pointing to an Objective-C message or property4247* reference, or C++ method call, returns the CXType of the receiver.4248*/4249CINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C);42504251/**4252* Property attributes for a \c CXCursor_ObjCPropertyDecl.4253*/4254typedef enum {4255CXObjCPropertyAttr_noattr = 0x00,4256CXObjCPropertyAttr_readonly = 0x01,4257CXObjCPropertyAttr_getter = 0x02,4258CXObjCPropertyAttr_assign = 0x04,4259CXObjCPropertyAttr_readwrite = 0x08,4260CXObjCPropertyAttr_retain = 0x10,4261CXObjCPropertyAttr_copy = 0x20,4262CXObjCPropertyAttr_nonatomic = 0x40,4263CXObjCPropertyAttr_setter = 0x80,4264CXObjCPropertyAttr_atomic = 0x100,4265CXObjCPropertyAttr_weak = 0x200,4266CXObjCPropertyAttr_strong = 0x400,4267CXObjCPropertyAttr_unsafe_unretained = 0x800,4268CXObjCPropertyAttr_class = 0x10004269} CXObjCPropertyAttrKind;42704271/**4272* Given a cursor that represents a property declaration, return the4273* associated property attributes. The bits are formed from4274* \c CXObjCPropertyAttrKind.4275*4276* \param reserved Reserved for future use, pass 0.4277*/4278CINDEX_LINKAGE unsigned4279clang_Cursor_getObjCPropertyAttributes(CXCursor C, unsigned reserved);42804281/**4282* Given a cursor that represents a property declaration, return the4283* name of the method that implements the getter.4284*/4285CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertyGetterName(CXCursor C);42864287/**4288* Given a cursor that represents a property declaration, return the4289* name of the method that implements the setter, if any.4290*/4291CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertySetterName(CXCursor C);42924293/**4294* 'Qualifiers' written next to the return and parameter types in4295* Objective-C method declarations.4296*/4297typedef enum {4298CXObjCDeclQualifier_None = 0x0,4299CXObjCDeclQualifier_In = 0x1,4300CXObjCDeclQualifier_Inout = 0x2,4301CXObjCDeclQualifier_Out = 0x4,4302CXObjCDeclQualifier_Bycopy = 0x8,4303CXObjCDeclQualifier_Byref = 0x10,4304CXObjCDeclQualifier_Oneway = 0x204305} CXObjCDeclQualifierKind;43064307/**4308* Given a cursor that represents an Objective-C method or parameter4309* declaration, return the associated Objective-C qualifiers for the return4310* type or the parameter respectively. The bits are formed from4311* CXObjCDeclQualifierKind.4312*/4313CINDEX_LINKAGE unsigned clang_Cursor_getObjCDeclQualifiers(CXCursor C);43144315/**4316* Given a cursor that represents an Objective-C method or property4317* declaration, return non-zero if the declaration was affected by "\@optional".4318* Returns zero if the cursor is not such a declaration or it is "\@required".4319*/4320CINDEX_LINKAGE unsigned clang_Cursor_isObjCOptional(CXCursor C);43214322/**4323* Returns non-zero if the given cursor is a variadic function or method.4324*/4325CINDEX_LINKAGE unsigned clang_Cursor_isVariadic(CXCursor C);43264327/**4328* Returns non-zero if the given cursor points to a symbol marked with4329* external_source_symbol attribute.4330*4331* \param language If non-NULL, and the attribute is present, will be set to4332* the 'language' string from the attribute.4333*4334* \param definedIn If non-NULL, and the attribute is present, will be set to4335* the 'definedIn' string from the attribute.4336*4337* \param isGenerated If non-NULL, and the attribute is present, will be set to4338* non-zero if the 'generated_declaration' is set in the attribute.4339*/4340CINDEX_LINKAGE unsigned clang_Cursor_isExternalSymbol(CXCursor C,4341CXString *language,4342CXString *definedIn,4343unsigned *isGenerated);43444345/**4346* Given a cursor that represents a declaration, return the associated4347* comment's source range. The range may include multiple consecutive comments4348* with whitespace in between.4349*/4350CINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange(CXCursor C);43514352/**4353* Given a cursor that represents a declaration, return the associated4354* comment text, including comment markers.4355*/4356CINDEX_LINKAGE CXString clang_Cursor_getRawCommentText(CXCursor C);43574358/**4359* Given a cursor that represents a documentable entity (e.g.,4360* declaration), return the associated \paragraph; otherwise return the4361* first paragraph.4362*/4363CINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText(CXCursor C);43644365/**4366* @}4367*/43684369/** \defgroup CINDEX_MANGLE Name Mangling API Functions4370*4371* @{4372*/43734374/**4375* Retrieve the CXString representing the mangled name of the cursor.4376*/4377CINDEX_LINKAGE CXString clang_Cursor_getMangling(CXCursor);43784379/**4380* Retrieve the CXStrings representing the mangled symbols of the C++4381* constructor or destructor at the cursor.4382*/4383CINDEX_LINKAGE CXStringSet *clang_Cursor_getCXXManglings(CXCursor);43844385/**4386* Retrieve the CXStrings representing the mangled symbols of the ObjC4387* class interface or implementation at the cursor.4388*/4389CINDEX_LINKAGE CXStringSet *clang_Cursor_getObjCManglings(CXCursor);43904391/**4392* @}4393*/43944395/**4396* \defgroup CINDEX_MODULE Module introspection4397*4398* The functions in this group provide access to information about modules.4399*4400* @{4401*/44024403typedef void *CXModule;44044405/**4406* Given a CXCursor_ModuleImportDecl cursor, return the associated module.4407*/4408CINDEX_LINKAGE CXModule clang_Cursor_getModule(CXCursor C);44094410/**4411* Given a CXFile header file, return the module that contains it, if one4412* exists.4413*/4414CINDEX_LINKAGE CXModule clang_getModuleForFile(CXTranslationUnit, CXFile);44154416/**4417* \param Module a module object.4418*4419* \returns the module file where the provided module object came from.4420*/4421CINDEX_LINKAGE CXFile clang_Module_getASTFile(CXModule Module);44224423/**4424* \param Module a module object.4425*4426* \returns the parent of a sub-module or NULL if the given module is top-level,4427* e.g. for 'std.vector' it will return the 'std' module.4428*/4429CINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module);44304431/**4432* \param Module a module object.4433*4434* \returns the name of the module, e.g. for the 'std.vector' sub-module it4435* will return "vector".4436*/4437CINDEX_LINKAGE CXString clang_Module_getName(CXModule Module);44384439/**4440* \param Module a module object.4441*4442* \returns the full name of the module, e.g. "std.vector".4443*/4444CINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module);44454446/**4447* \param Module a module object.4448*4449* \returns non-zero if the module is a system one.4450*/4451CINDEX_LINKAGE int clang_Module_isSystem(CXModule Module);44524453/**4454* \param Module a module object.4455*4456* \returns the number of top level headers associated with this module.4457*/4458CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit,4459CXModule Module);44604461/**4462* \param Module a module object.4463*4464* \param Index top level header index (zero-based).4465*4466* \returns the specified top level header associated with the module.4467*/4468CINDEX_LINKAGE4469CXFile clang_Module_getTopLevelHeader(CXTranslationUnit, CXModule Module,4470unsigned Index);44714472/**4473* @}4474*/44754476/**4477* \defgroup CINDEX_CPP C++ AST introspection4478*4479* The routines in this group provide access information in the ASTs specific4480* to C++ language features.4481*4482* @{4483*/44844485/**4486* Determine if a C++ constructor is a converting constructor.4487*/4488CINDEX_LINKAGE unsigned4489clang_CXXConstructor_isConvertingConstructor(CXCursor C);44904491/**4492* Determine if a C++ constructor is a copy constructor.4493*/4494CINDEX_LINKAGE unsigned clang_CXXConstructor_isCopyConstructor(CXCursor C);44954496/**4497* Determine if a C++ constructor is the default constructor.4498*/4499CINDEX_LINKAGE unsigned clang_CXXConstructor_isDefaultConstructor(CXCursor C);45004501/**4502* Determine if a C++ constructor is a move constructor.4503*/4504CINDEX_LINKAGE unsigned clang_CXXConstructor_isMoveConstructor(CXCursor C);45054506/**4507* Determine if a C++ field is declared 'mutable'.4508*/4509CINDEX_LINKAGE unsigned clang_CXXField_isMutable(CXCursor C);45104511/**4512* Determine if a C++ method is declared '= default'.4513*/4514CINDEX_LINKAGE unsigned clang_CXXMethod_isDefaulted(CXCursor C);45154516/**4517* Determine if a C++ method is declared '= delete'.4518*/4519CINDEX_LINKAGE unsigned clang_CXXMethod_isDeleted(CXCursor C);45204521/**4522* Determine if a C++ member function or member function template is4523* pure virtual.4524*/4525CINDEX_LINKAGE unsigned clang_CXXMethod_isPureVirtual(CXCursor C);45264527/**4528* Determine if a C++ member function or member function template is4529* declared 'static'.4530*/4531CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C);45324533/**4534* Determine if a C++ member function or member function template is4535* explicitly declared 'virtual' or if it overrides a virtual method from4536* one of the base classes.4537*/4538CINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C);45394540/**4541* Determine if a C++ member function is a copy-assignment operator,4542* returning 1 if such is the case and 0 otherwise.4543*4544* > A copy-assignment operator `X::operator=` is a non-static,4545* > non-template member function of _class_ `X` with exactly one4546* > parameter of type `X`, `X&`, `const X&`, `volatile X&` or `const4547* > volatile X&`.4548*4549* That is, for example, the `operator=` in:4550*4551* class Foo {4552* bool operator=(const volatile Foo&);4553* };4554*4555* Is a copy-assignment operator, while the `operator=` in:4556*4557* class Bar {4558* bool operator=(const int&);4559* };4560*4561* Is not.4562*/4563CINDEX_LINKAGE unsigned clang_CXXMethod_isCopyAssignmentOperator(CXCursor C);45644565/**4566* Determine if a C++ member function is a move-assignment operator,4567* returning 1 if such is the case and 0 otherwise.4568*4569* > A move-assignment operator `X::operator=` is a non-static,4570* > non-template member function of _class_ `X` with exactly one4571* > parameter of type `X&&`, `const X&&`, `volatile X&&` or `const4572* > volatile X&&`.4573*4574* That is, for example, the `operator=` in:4575*4576* class Foo {4577* bool operator=(const volatile Foo&&);4578* };4579*4580* Is a move-assignment operator, while the `operator=` in:4581*4582* class Bar {4583* bool operator=(const int&&);4584* };4585*4586* Is not.4587*/4588CINDEX_LINKAGE unsigned clang_CXXMethod_isMoveAssignmentOperator(CXCursor C);45894590/**4591* Determines if a C++ constructor or conversion function was declared4592* explicit, returning 1 if such is the case and 0 otherwise.4593*4594* Constructors or conversion functions are declared explicit through4595* the use of the explicit specifier.4596*4597* For example, the following constructor and conversion function are4598* not explicit as they lack the explicit specifier:4599*4600* class Foo {4601* Foo();4602* operator int();4603* };4604*4605* While the following constructor and conversion function are4606* explicit as they are declared with the explicit specifier.4607*4608* class Foo {4609* explicit Foo();4610* explicit operator int();4611* };4612*4613* This function will return 0 when given a cursor pointing to one of4614* the former declarations and it will return 1 for a cursor pointing4615* to the latter declarations.4616*4617* The explicit specifier allows the user to specify a4618* conditional compile-time expression whose value decides4619* whether the marked element is explicit or not.4620*4621* For example:4622*4623* constexpr bool foo(int i) { return i % 2 == 0; }4624*4625* class Foo {4626* explicit(foo(1)) Foo();4627* explicit(foo(2)) operator int();4628* }4629*4630* This function will return 0 for the constructor and 1 for4631* the conversion function.4632*/4633CINDEX_LINKAGE unsigned clang_CXXMethod_isExplicit(CXCursor C);46344635/**4636* Determine if a C++ record is abstract, i.e. whether a class or struct4637* has a pure virtual member function.4638*/4639CINDEX_LINKAGE unsigned clang_CXXRecord_isAbstract(CXCursor C);46404641/**4642* Determine if an enum declaration refers to a scoped enum.4643*/4644CINDEX_LINKAGE unsigned clang_EnumDecl_isScoped(CXCursor C);46454646/**4647* Determine if a C++ member function or member function template is4648* declared 'const'.4649*/4650CINDEX_LINKAGE unsigned clang_CXXMethod_isConst(CXCursor C);46514652/**4653* Given a cursor that represents a template, determine4654* the cursor kind of the specializations would be generated by instantiating4655* the template.4656*4657* This routine can be used to determine what flavor of function template,4658* class template, or class template partial specialization is stored in the4659* cursor. For example, it can describe whether a class template cursor is4660* declared with "struct", "class" or "union".4661*4662* \param C The cursor to query. This cursor should represent a template4663* declaration.4664*4665* \returns The cursor kind of the specializations that would be generated4666* by instantiating the template \p C. If \p C is not a template, returns4667* \c CXCursor_NoDeclFound.4668*/4669CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C);46704671/**4672* Given a cursor that may represent a specialization or instantiation4673* of a template, retrieve the cursor that represents the template that it4674* specializes or from which it was instantiated.4675*4676* This routine determines the template involved both for explicit4677* specializations of templates and for implicit instantiations of the template,4678* both of which are referred to as "specializations". For a class template4679* specialization (e.g., \c std::vector<bool>), this routine will return4680* either the primary template (\c std::vector) or, if the specialization was4681* instantiated from a class template partial specialization, the class template4682* partial specialization. For a class template partial specialization and a4683* function template specialization (including instantiations), this4684* this routine will return the specialized template.4685*4686* For members of a class template (e.g., member functions, member classes, or4687* static data members), returns the specialized or instantiated member.4688* Although not strictly "templates" in the C++ language, members of class4689* templates have the same notions of specializations and instantiations that4690* templates do, so this routine treats them similarly.4691*4692* \param C A cursor that may be a specialization of a template or a member4693* of a template.4694*4695* \returns If the given cursor is a specialization or instantiation of a4696* template or a member thereof, the template or member that it specializes or4697* from which it was instantiated. Otherwise, returns a NULL cursor.4698*/4699CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C);47004701/**4702* Given a cursor that references something else, return the source range4703* covering that reference.4704*4705* \param C A cursor pointing to a member reference, a declaration reference, or4706* an operator call.4707* \param NameFlags A bitset with three independent flags:4708* CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and4709* CXNameRange_WantSinglePiece.4710* \param PieceIndex For contiguous names or when passing the flag4711* CXNameRange_WantSinglePiece, only one piece with index 0 is4712* available. When the CXNameRange_WantSinglePiece flag is not passed for a4713* non-contiguous names, this index can be used to retrieve the individual4714* pieces of the name. See also CXNameRange_WantSinglePiece.4715*4716* \returns The piece of the name pointed to by the given cursor. If there is no4717* name, or if the PieceIndex is out-of-range, a null-cursor will be returned.4718*/4719CINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(4720CXCursor C, unsigned NameFlags, unsigned PieceIndex);47214722enum CXNameRefFlags {4723/**4724* Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the4725* range.4726*/4727CXNameRange_WantQualifier = 0x1,47284729/**4730* Include the explicit template arguments, e.g. \<int> in x.f<int>,4731* in the range.4732*/4733CXNameRange_WantTemplateArgs = 0x2,47344735/**4736* If the name is non-contiguous, return the full spanning range.4737*4738* Non-contiguous names occur in Objective-C when a selector with two or more4739* parameters is used, or in C++ when using an operator:4740* \code4741* [object doSomething:here withValue:there]; // Objective-C4742* return some_vector[1]; // C++4743* \endcode4744*/4745CXNameRange_WantSinglePiece = 0x44746};47474748/**4749* @}4750*/47514752/**4753* \defgroup CINDEX_LEX Token extraction and manipulation4754*4755* The routines in this group provide access to the tokens within a4756* translation unit, along with a semantic mapping of those tokens to4757* their corresponding cursors.4758*4759* @{4760*/47614762/**4763* Describes a kind of token.4764*/4765typedef enum CXTokenKind {4766/**4767* A token that contains some kind of punctuation.4768*/4769CXToken_Punctuation,47704771/**4772* A language keyword.4773*/4774CXToken_Keyword,47754776/**4777* An identifier (that is not a keyword).4778*/4779CXToken_Identifier,47804781/**4782* A numeric, string, or character literal.4783*/4784CXToken_Literal,47854786/**4787* A comment.4788*/4789CXToken_Comment4790} CXTokenKind;47914792/**4793* Describes a single preprocessing token.4794*/4795typedef struct {4796unsigned int_data[4];4797void *ptr_data;4798} CXToken;47994800/**4801* Get the raw lexical token starting with the given location.4802*4803* \param TU the translation unit whose text is being tokenized.4804*4805* \param Location the source location with which the token starts.4806*4807* \returns The token starting with the given location or NULL if no such token4808* exist. The returned pointer must be freed with clang_disposeTokens before the4809* translation unit is destroyed.4810*/4811CINDEX_LINKAGE CXToken *clang_getToken(CXTranslationUnit TU,4812CXSourceLocation Location);48134814/**4815* Determine the kind of the given token.4816*/4817CINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken);48184819/**4820* Determine the spelling of the given token.4821*4822* The spelling of a token is the textual representation of that token, e.g.,4823* the text of an identifier or keyword.4824*/4825CINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken);48264827/**4828* Retrieve the source location of the given token.4829*/4830CINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit,4831CXToken);48324833/**4834* Retrieve a source range that covers the given token.4835*/4836CINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken);48374838/**4839* Tokenize the source code described by the given range into raw4840* lexical tokens.4841*4842* \param TU the translation unit whose text is being tokenized.4843*4844* \param Range the source range in which text should be tokenized. All of the4845* tokens produced by tokenization will fall within this source range,4846*4847* \param Tokens this pointer will be set to point to the array of tokens4848* that occur within the given source range. The returned pointer must be4849* freed with clang_disposeTokens() before the translation unit is destroyed.4850*4851* \param NumTokens will be set to the number of tokens in the \c *Tokens4852* array.4853*4854*/4855CINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,4856CXToken **Tokens, unsigned *NumTokens);48574858/**4859* Annotate the given set of tokens by providing cursors for each token4860* that can be mapped to a specific entity within the abstract syntax tree.4861*4862* This token-annotation routine is equivalent to invoking4863* clang_getCursor() for the source locations of each of the4864* tokens. The cursors provided are filtered, so that only those4865* cursors that have a direct correspondence to the token are4866* accepted. For example, given a function call \c f(x),4867* clang_getCursor() would provide the following cursors:4868*4869* * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.4870* * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.4871* * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.4872*4873* Only the first and last of these cursors will occur within the4874* annotate, since the tokens "f" and "x' directly refer to a function4875* and a variable, respectively, but the parentheses are just a small4876* part of the full syntax of the function call expression, which is4877* not provided as an annotation.4878*4879* \param TU the translation unit that owns the given tokens.4880*4881* \param Tokens the set of tokens to annotate.4882*4883* \param NumTokens the number of tokens in \p Tokens.4884*4885* \param Cursors an array of \p NumTokens cursors, whose contents will be4886* replaced with the cursors corresponding to each token.4887*/4888CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU, CXToken *Tokens,4889unsigned NumTokens, CXCursor *Cursors);48904891/**4892* Free the given set of tokens.4893*/4894CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU, CXToken *Tokens,4895unsigned NumTokens);48964897/**4898* @}4899*/49004901/**4902* \defgroup CINDEX_DEBUG Debugging facilities4903*4904* These routines are used for testing and debugging, only, and should not4905* be relied upon.4906*4907* @{4908*/49094910/* for debug/testing */4911CINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind);4912CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(4913CXCursor, const char **startBuf, const char **endBuf, unsigned *startLine,4914unsigned *startColumn, unsigned *endLine, unsigned *endColumn);4915CINDEX_LINKAGE void clang_enableStackTraces(void);4916CINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void *), void *user_data,4917unsigned stack_size);49184919/**4920* @}4921*/49224923/**4924* \defgroup CINDEX_CODE_COMPLET Code completion4925*4926* Code completion involves taking an (incomplete) source file, along with4927* knowledge of where the user is actively editing that file, and suggesting4928* syntactically- and semantically-valid constructs that the user might want to4929* use at that particular point in the source code. These data structures and4930* routines provide support for code completion.4931*4932* @{4933*/49344935/**4936* A semantic string that describes a code-completion result.4937*4938* A semantic string that describes the formatting of a code-completion4939* result as a single "template" of text that should be inserted into the4940* source buffer when a particular code-completion result is selected.4941* Each semantic string is made up of some number of "chunks", each of which4942* contains some text along with a description of what that text means, e.g.,4943* the name of the entity being referenced, whether the text chunk is part of4944* the template, or whether it is a "placeholder" that the user should replace4945* with actual code,of a specific kind. See \c CXCompletionChunkKind for a4946* description of the different kinds of chunks.4947*/4948typedef void *CXCompletionString;49494950/**4951* A single result of code completion.4952*/4953typedef struct {4954/**4955* The kind of entity that this completion refers to.4956*4957* The cursor kind will be a macro, keyword, or a declaration (one of the4958* *Decl cursor kinds), describing the entity that the completion is4959* referring to.4960*4961* \todo In the future, we would like to provide a full cursor, to allow4962* the client to extract additional information from declaration.4963*/4964enum CXCursorKind CursorKind;49654966/**4967* The code-completion string that describes how to insert this4968* code-completion result into the editing buffer.4969*/4970CXCompletionString CompletionString;4971} CXCompletionResult;49724973/**4974* Describes a single piece of text within a code-completion string.4975*4976* Each "chunk" within a code-completion string (\c CXCompletionString) is4977* either a piece of text with a specific "kind" that describes how that text4978* should be interpreted by the client or is another completion string.4979*/4980enum CXCompletionChunkKind {4981/**4982* A code-completion string that describes "optional" text that4983* could be a part of the template (but is not required).4984*4985* The Optional chunk is the only kind of chunk that has a code-completion4986* string for its representation, which is accessible via4987* \c clang_getCompletionChunkCompletionString(). The code-completion string4988* describes an additional part of the template that is completely optional.4989* For example, optional chunks can be used to describe the placeholders for4990* arguments that match up with defaulted function parameters, e.g. given:4991*4992* \code4993* void f(int x, float y = 3.14, double z = 2.71828);4994* \endcode4995*4996* The code-completion string for this function would contain:4997* - a TypedText chunk for "f".4998* - a LeftParen chunk for "(".4999* - a Placeholder chunk for "int x"5000* - an Optional chunk containing the remaining defaulted arguments, e.g.,5001* - a Comma chunk for ","5002* - a Placeholder chunk for "float y"5003* - an Optional chunk containing the last defaulted argument:5004* - a Comma chunk for ","5005* - a Placeholder chunk for "double z"5006* - a RightParen chunk for ")"5007*5008* There are many ways to handle Optional chunks. Two simple approaches are:5009* - Completely ignore optional chunks, in which case the template for the5010* function "f" would only include the first parameter ("int x").5011* - Fully expand all optional chunks, in which case the template for the5012* function "f" would have all of the parameters.5013*/5014CXCompletionChunk_Optional,5015/**5016* Text that a user would be expected to type to get this5017* code-completion result.5018*5019* There will be exactly one "typed text" chunk in a semantic string, which5020* will typically provide the spelling of a keyword or the name of a5021* declaration that could be used at the current code point. Clients are5022* expected to filter the code-completion results based on the text in this5023* chunk.5024*/5025CXCompletionChunk_TypedText,5026/**5027* Text that should be inserted as part of a code-completion result.5028*5029* A "text" chunk represents text that is part of the template to be5030* inserted into user code should this particular code-completion result5031* be selected.5032*/5033CXCompletionChunk_Text,5034/**5035* Placeholder text that should be replaced by the user.5036*5037* A "placeholder" chunk marks a place where the user should insert text5038* into the code-completion template. For example, placeholders might mark5039* the function parameters for a function declaration, to indicate that the5040* user should provide arguments for each of those parameters. The actual5041* text in a placeholder is a suggestion for the text to display before5042* the user replaces the placeholder with real code.5043*/5044CXCompletionChunk_Placeholder,5045/**5046* Informative text that should be displayed but never inserted as5047* part of the template.5048*5049* An "informative" chunk contains annotations that can be displayed to5050* help the user decide whether a particular code-completion result is the5051* right option, but which is not part of the actual template to be inserted5052* by code completion.5053*/5054CXCompletionChunk_Informative,5055/**5056* Text that describes the current parameter when code-completion is5057* referring to function call, message send, or template specialization.5058*5059* A "current parameter" chunk occurs when code-completion is providing5060* information about a parameter corresponding to the argument at the5061* code-completion point. For example, given a function5062*5063* \code5064* int add(int x, int y);5065* \endcode5066*5067* and the source code \c add(, where the code-completion point is after the5068* "(", the code-completion string will contain a "current parameter" chunk5069* for "int x", indicating that the current argument will initialize that5070* parameter. After typing further, to \c add(17, (where the code-completion5071* point is after the ","), the code-completion string will contain a5072* "current parameter" chunk to "int y".5073*/5074CXCompletionChunk_CurrentParameter,5075/**5076* A left parenthesis ('('), used to initiate a function call or5077* signal the beginning of a function parameter list.5078*/5079CXCompletionChunk_LeftParen,5080/**5081* A right parenthesis (')'), used to finish a function call or5082* signal the end of a function parameter list.5083*/5084CXCompletionChunk_RightParen,5085/**5086* A left bracket ('[').5087*/5088CXCompletionChunk_LeftBracket,5089/**5090* A right bracket (']').5091*/5092CXCompletionChunk_RightBracket,5093/**5094* A left brace ('{').5095*/5096CXCompletionChunk_LeftBrace,5097/**5098* A right brace ('}').5099*/5100CXCompletionChunk_RightBrace,5101/**5102* A left angle bracket ('<').5103*/5104CXCompletionChunk_LeftAngle,5105/**5106* A right angle bracket ('>').5107*/5108CXCompletionChunk_RightAngle,5109/**5110* A comma separator (',').5111*/5112CXCompletionChunk_Comma,5113/**5114* Text that specifies the result type of a given result.5115*5116* This special kind of informative chunk is not meant to be inserted into5117* the text buffer. Rather, it is meant to illustrate the type that an5118* expression using the given completion string would have.5119*/5120CXCompletionChunk_ResultType,5121/**5122* A colon (':').5123*/5124CXCompletionChunk_Colon,5125/**5126* A semicolon (';').5127*/5128CXCompletionChunk_SemiColon,5129/**5130* An '=' sign.5131*/5132CXCompletionChunk_Equal,5133/**5134* Horizontal space (' ').5135*/5136CXCompletionChunk_HorizontalSpace,5137/**5138* Vertical space ('\\n'), after which it is generally a good idea to5139* perform indentation.5140*/5141CXCompletionChunk_VerticalSpace5142};51435144/**5145* Determine the kind of a particular chunk within a completion string.5146*5147* \param completion_string the completion string to query.5148*5149* \param chunk_number the 0-based index of the chunk in the completion string.5150*5151* \returns the kind of the chunk at the index \c chunk_number.5152*/5153CINDEX_LINKAGE enum CXCompletionChunkKind5154clang_getCompletionChunkKind(CXCompletionString completion_string,5155unsigned chunk_number);51565157/**5158* Retrieve the text associated with a particular chunk within a5159* completion string.5160*5161* \param completion_string the completion string to query.5162*5163* \param chunk_number the 0-based index of the chunk in the completion string.5164*5165* \returns the text associated with the chunk at index \c chunk_number.5166*/5167CINDEX_LINKAGE CXString clang_getCompletionChunkText(5168CXCompletionString completion_string, unsigned chunk_number);51695170/**5171* Retrieve the completion string associated with a particular chunk5172* within a completion string.5173*5174* \param completion_string the completion string to query.5175*5176* \param chunk_number the 0-based index of the chunk in the completion string.5177*5178* \returns the completion string associated with the chunk at index5179* \c chunk_number.5180*/5181CINDEX_LINKAGE CXCompletionString clang_getCompletionChunkCompletionString(5182CXCompletionString completion_string, unsigned chunk_number);51835184/**5185* Retrieve the number of chunks in the given code-completion string.5186*/5187CINDEX_LINKAGE unsigned5188clang_getNumCompletionChunks(CXCompletionString completion_string);51895190/**5191* Determine the priority of this code completion.5192*5193* The priority of a code completion indicates how likely it is that this5194* particular completion is the completion that the user will select. The5195* priority is selected by various internal heuristics.5196*5197* \param completion_string The completion string to query.5198*5199* \returns The priority of this completion string. Smaller values indicate5200* higher-priority (more likely) completions.5201*/5202CINDEX_LINKAGE unsigned5203clang_getCompletionPriority(CXCompletionString completion_string);52045205/**5206* Determine the availability of the entity that this code-completion5207* string refers to.5208*5209* \param completion_string The completion string to query.5210*5211* \returns The availability of the completion string.5212*/5213CINDEX_LINKAGE enum CXAvailabilityKind5214clang_getCompletionAvailability(CXCompletionString completion_string);52155216/**5217* Retrieve the number of annotations associated with the given5218* completion string.5219*5220* \param completion_string the completion string to query.5221*5222* \returns the number of annotations associated with the given completion5223* string.5224*/5225CINDEX_LINKAGE unsigned5226clang_getCompletionNumAnnotations(CXCompletionString completion_string);52275228/**5229* Retrieve the annotation associated with the given completion string.5230*5231* \param completion_string the completion string to query.5232*5233* \param annotation_number the 0-based index of the annotation of the5234* completion string.5235*5236* \returns annotation string associated with the completion at index5237* \c annotation_number, or a NULL string if that annotation is not available.5238*/5239CINDEX_LINKAGE CXString clang_getCompletionAnnotation(5240CXCompletionString completion_string, unsigned annotation_number);52415242/**5243* Retrieve the parent context of the given completion string.5244*5245* The parent context of a completion string is the semantic parent of5246* the declaration (if any) that the code completion represents. For example,5247* a code completion for an Objective-C method would have the method's class5248* or protocol as its context.5249*5250* \param completion_string The code completion string whose parent is5251* being queried.5252*5253* \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL.5254*5255* \returns The name of the completion parent, e.g., "NSObject" if5256* the completion string represents a method in the NSObject class.5257*/5258CINDEX_LINKAGE CXString clang_getCompletionParent(5259CXCompletionString completion_string, enum CXCursorKind *kind);52605261/**5262* Retrieve the brief documentation comment attached to the declaration5263* that corresponds to the given completion string.5264*/5265CINDEX_LINKAGE CXString5266clang_getCompletionBriefComment(CXCompletionString completion_string);52675268/**5269* Retrieve a completion string for an arbitrary declaration or macro5270* definition cursor.5271*5272* \param cursor The cursor to query.5273*5274* \returns A non-context-sensitive completion string for declaration and macro5275* definition cursors, or NULL for other kinds of cursors.5276*/5277CINDEX_LINKAGE CXCompletionString5278clang_getCursorCompletionString(CXCursor cursor);52795280/**5281* Contains the results of code-completion.5282*5283* This data structure contains the results of code completion, as5284* produced by \c clang_codeCompleteAt(). Its contents must be freed by5285* \c clang_disposeCodeCompleteResults.5286*/5287typedef struct {5288/**5289* The code-completion results.5290*/5291CXCompletionResult *Results;52925293/**5294* The number of code-completion results stored in the5295* \c Results array.5296*/5297unsigned NumResults;5298} CXCodeCompleteResults;52995300/**5301* Retrieve the number of fix-its for the given completion index.5302*5303* Calling this makes sense only if CXCodeComplete_IncludeCompletionsWithFixIts5304* option was set.5305*5306* \param results The structure keeping all completion results5307*5308* \param completion_index The index of the completion5309*5310* \return The number of fix-its which must be applied before the completion at5311* completion_index can be applied5312*/5313CINDEX_LINKAGE unsigned5314clang_getCompletionNumFixIts(CXCodeCompleteResults *results,5315unsigned completion_index);53165317/**5318* Fix-its that *must* be applied before inserting the text for the5319* corresponding completion.5320*5321* By default, clang_codeCompleteAt() only returns completions with empty5322* fix-its. Extra completions with non-empty fix-its should be explicitly5323* requested by setting CXCodeComplete_IncludeCompletionsWithFixIts.5324*5325* For the clients to be able to compute position of the cursor after applying5326* fix-its, the following conditions are guaranteed to hold for5327* replacement_range of the stored fix-its:5328* - Ranges in the fix-its are guaranteed to never contain the completion5329* point (or identifier under completion point, if any) inside them, except5330* at the start or at the end of the range.5331* - If a fix-it range starts or ends with completion point (or starts or5332* ends after the identifier under completion point), it will contain at5333* least one character. It allows to unambiguously recompute completion5334* point after applying the fix-it.5335*5336* The intuition is that provided fix-its change code around the identifier we5337* complete, but are not allowed to touch the identifier itself or the5338* completion point. One example of completions with corrections are the ones5339* replacing '.' with '->' and vice versa:5340*5341* std::unique_ptr<std::vector<int>> vec_ptr;5342* In 'vec_ptr.^', one of the completions is 'push_back', it requires5343* replacing '.' with '->'.5344* In 'vec_ptr->^', one of the completions is 'release', it requires5345* replacing '->' with '.'.5346*5347* \param results The structure keeping all completion results5348*5349* \param completion_index The index of the completion5350*5351* \param fixit_index The index of the fix-it for the completion at5352* completion_index5353*5354* \param replacement_range The fix-it range that must be replaced before the5355* completion at completion_index can be applied5356*5357* \returns The fix-it string that must replace the code at replacement_range5358* before the completion at completion_index can be applied5359*/5360CINDEX_LINKAGE CXString clang_getCompletionFixIt(5361CXCodeCompleteResults *results, unsigned completion_index,5362unsigned fixit_index, CXSourceRange *replacement_range);53635364/**5365* Flags that can be passed to \c clang_codeCompleteAt() to5366* modify its behavior.5367*5368* The enumerators in this enumeration can be bitwise-OR'd together to5369* provide multiple options to \c clang_codeCompleteAt().5370*/5371enum CXCodeComplete_Flags {5372/**5373* Whether to include macros within the set of code5374* completions returned.5375*/5376CXCodeComplete_IncludeMacros = 0x01,53775378/**5379* Whether to include code patterns for language constructs5380* within the set of code completions, e.g., for loops.5381*/5382CXCodeComplete_IncludeCodePatterns = 0x02,53835384/**5385* Whether to include brief documentation within the set of code5386* completions returned.5387*/5388CXCodeComplete_IncludeBriefComments = 0x04,53895390/**5391* Whether to speed up completion by omitting top- or namespace-level entities5392* defined in the preamble. There's no guarantee any particular entity is5393* omitted. This may be useful if the headers are indexed externally.5394*/5395CXCodeComplete_SkipPreamble = 0x08,53965397/**5398* Whether to include completions with small5399* fix-its, e.g. change '.' to '->' on member access, etc.5400*/5401CXCodeComplete_IncludeCompletionsWithFixIts = 0x105402};54035404/**5405* Bits that represent the context under which completion is occurring.5406*5407* The enumerators in this enumeration may be bitwise-OR'd together if multiple5408* contexts are occurring simultaneously.5409*/5410enum CXCompletionContext {5411/**5412* The context for completions is unexposed, as only Clang results5413* should be included. (This is equivalent to having no context bits set.)5414*/5415CXCompletionContext_Unexposed = 0,54165417/**5418* Completions for any possible type should be included in the results.5419*/5420CXCompletionContext_AnyType = 1 << 0,54215422/**5423* Completions for any possible value (variables, function calls, etc.)5424* should be included in the results.5425*/5426CXCompletionContext_AnyValue = 1 << 1,5427/**5428* Completions for values that resolve to an Objective-C object should5429* be included in the results.5430*/5431CXCompletionContext_ObjCObjectValue = 1 << 2,5432/**5433* Completions for values that resolve to an Objective-C selector5434* should be included in the results.5435*/5436CXCompletionContext_ObjCSelectorValue = 1 << 3,5437/**5438* Completions for values that resolve to a C++ class type should be5439* included in the results.5440*/5441CXCompletionContext_CXXClassTypeValue = 1 << 4,54425443/**5444* Completions for fields of the member being accessed using the dot5445* operator should be included in the results.5446*/5447CXCompletionContext_DotMemberAccess = 1 << 5,5448/**5449* Completions for fields of the member being accessed using the arrow5450* operator should be included in the results.5451*/5452CXCompletionContext_ArrowMemberAccess = 1 << 6,5453/**5454* Completions for properties of the Objective-C object being accessed5455* using the dot operator should be included in the results.5456*/5457CXCompletionContext_ObjCPropertyAccess = 1 << 7,54585459/**5460* Completions for enum tags should be included in the results.5461*/5462CXCompletionContext_EnumTag = 1 << 8,5463/**5464* Completions for union tags should be included in the results.5465*/5466CXCompletionContext_UnionTag = 1 << 9,5467/**5468* Completions for struct tags should be included in the results.5469*/5470CXCompletionContext_StructTag = 1 << 10,54715472/**5473* Completions for C++ class names should be included in the results.5474*/5475CXCompletionContext_ClassTag = 1 << 11,5476/**5477* Completions for C++ namespaces and namespace aliases should be5478* included in the results.5479*/5480CXCompletionContext_Namespace = 1 << 12,5481/**5482* Completions for C++ nested name specifiers should be included in5483* the results.5484*/5485CXCompletionContext_NestedNameSpecifier = 1 << 13,54865487/**5488* Completions for Objective-C interfaces (classes) should be included5489* in the results.5490*/5491CXCompletionContext_ObjCInterface = 1 << 14,5492/**5493* Completions for Objective-C protocols should be included in5494* the results.5495*/5496CXCompletionContext_ObjCProtocol = 1 << 15,5497/**5498* Completions for Objective-C categories should be included in5499* the results.5500*/5501CXCompletionContext_ObjCCategory = 1 << 16,5502/**5503* Completions for Objective-C instance messages should be included5504* in the results.5505*/5506CXCompletionContext_ObjCInstanceMessage = 1 << 17,5507/**5508* Completions for Objective-C class messages should be included in5509* the results.5510*/5511CXCompletionContext_ObjCClassMessage = 1 << 18,5512/**5513* Completions for Objective-C selector names should be included in5514* the results.5515*/5516CXCompletionContext_ObjCSelectorName = 1 << 19,55175518/**5519* Completions for preprocessor macro names should be included in5520* the results.5521*/5522CXCompletionContext_MacroName = 1 << 20,55235524/**5525* Natural language completions should be included in the results.5526*/5527CXCompletionContext_NaturalLanguage = 1 << 21,55285529/**5530* #include file completions should be included in the results.5531*/5532CXCompletionContext_IncludedFile = 1 << 22,55335534/**5535* The current context is unknown, so set all contexts.5536*/5537CXCompletionContext_Unknown = ((1 << 23) - 1)5538};55395540/**5541* Returns a default set of code-completion options that can be5542* passed to\c clang_codeCompleteAt().5543*/5544CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);55455546/**5547* Perform code completion at a given location in a translation unit.5548*5549* This function performs code completion at a particular file, line, and5550* column within source code, providing results that suggest potential5551* code snippets based on the context of the completion. The basic model5552* for code completion is that Clang will parse a complete source file,5553* performing syntax checking up to the location where code-completion has5554* been requested. At that point, a special code-completion token is passed5555* to the parser, which recognizes this token and determines, based on the5556* current location in the C/Objective-C/C++ grammar and the state of5557* semantic analysis, what completions to provide. These completions are5558* returned via a new \c CXCodeCompleteResults structure.5559*5560* Code completion itself is meant to be triggered by the client when the5561* user types punctuation characters or whitespace, at which point the5562* code-completion location will coincide with the cursor. For example, if \c p5563* is a pointer, code-completion might be triggered after the "-" and then5564* after the ">" in \c p->. When the code-completion location is after the ">",5565* the completion results will provide, e.g., the members of the struct that5566* "p" points to. The client is responsible for placing the cursor at the5567* beginning of the token currently being typed, then filtering the results5568* based on the contents of the token. For example, when code-completing for5569* the expression \c p->get, the client should provide the location just after5570* the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the5571* client can filter the results based on the current token text ("get"), only5572* showing those results that start with "get". The intent of this interface5573* is to separate the relatively high-latency acquisition of code-completion5574* results from the filtering of results on a per-character basis, which must5575* have a lower latency.5576*5577* \param TU The translation unit in which code-completion should5578* occur. The source files for this translation unit need not be5579* completely up-to-date (and the contents of those source files may5580* be overridden via \p unsaved_files). Cursors referring into the5581* translation unit may be invalidated by this invocation.5582*5583* \param complete_filename The name of the source file where code5584* completion should be performed. This filename may be any file5585* included in the translation unit.5586*5587* \param complete_line The line at which code-completion should occur.5588*5589* \param complete_column The column at which code-completion should occur.5590* Note that the column should point just after the syntactic construct that5591* initiated code completion, and not in the middle of a lexical token.5592*5593* \param unsaved_files the Files that have not yet been saved to disk5594* but may be required for parsing or code completion, including the5595* contents of those files. The contents and name of these files (as5596* specified by CXUnsavedFile) are copied when necessary, so the5597* client only needs to guarantee their validity until the call to5598* this function returns.5599*5600* \param num_unsaved_files The number of unsaved file entries in \p5601* unsaved_files.5602*5603* \param options Extra options that control the behavior of code5604* completion, expressed as a bitwise OR of the enumerators of the5605* CXCodeComplete_Flags enumeration. The5606* \c clang_defaultCodeCompleteOptions() function returns a default set5607* of code-completion options.5608*5609* \returns If successful, a new \c CXCodeCompleteResults structure5610* containing code-completion results, which should eventually be5611* freed with \c clang_disposeCodeCompleteResults(). If code5612* completion fails, returns NULL.5613*/5614CINDEX_LINKAGE5615CXCodeCompleteResults *5616clang_codeCompleteAt(CXTranslationUnit TU, const char *complete_filename,5617unsigned complete_line, unsigned complete_column,5618struct CXUnsavedFile *unsaved_files,5619unsigned num_unsaved_files, unsigned options);56205621/**5622* Sort the code-completion results in case-insensitive alphabetical5623* order.5624*5625* \param Results The set of results to sort.5626* \param NumResults The number of results in \p Results.5627*/5628CINDEX_LINKAGE5629void clang_sortCodeCompletionResults(CXCompletionResult *Results,5630unsigned NumResults);56315632/**5633* Free the given set of code-completion results.5634*/5635CINDEX_LINKAGE5636void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);56375638/**5639* Determine the number of diagnostics produced prior to the5640* location where code completion was performed.5641*/5642CINDEX_LINKAGE5643unsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results);56445645/**5646* Retrieve a diagnostic associated with the given code completion.5647*5648* \param Results the code completion results to query.5649* \param Index the zero-based diagnostic number to retrieve.5650*5651* \returns the requested diagnostic. This diagnostic must be freed5652* via a call to \c clang_disposeDiagnostic().5653*/5654CINDEX_LINKAGE5655CXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,5656unsigned Index);56575658/**5659* Determines what completions are appropriate for the context5660* the given code completion.5661*5662* \param Results the code completion results to query5663*5664* \returns the kinds of completions that are appropriate for use5665* along with the given code completion results.5666*/5667CINDEX_LINKAGE5668unsigned long long5669clang_codeCompleteGetContexts(CXCodeCompleteResults *Results);56705671/**5672* Returns the cursor kind for the container for the current code5673* completion context. The container is only guaranteed to be set for5674* contexts where a container exists (i.e. member accesses or Objective-C5675* message sends); if there is not a container, this function will return5676* CXCursor_InvalidCode.5677*5678* \param Results the code completion results to query5679*5680* \param IsIncomplete on return, this value will be false if Clang has complete5681* information about the container. If Clang does not have complete5682* information, this value will be true.5683*5684* \returns the container kind, or CXCursor_InvalidCode if there is not a5685* container5686*/5687CINDEX_LINKAGE5688enum CXCursorKind5689clang_codeCompleteGetContainerKind(CXCodeCompleteResults *Results,5690unsigned *IsIncomplete);56915692/**5693* Returns the USR for the container for the current code completion5694* context. If there is not a container for the current context, this5695* function will return the empty string.5696*5697* \param Results the code completion results to query5698*5699* \returns the USR for the container5700*/5701CINDEX_LINKAGE5702CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results);57035704/**5705* Returns the currently-entered selector for an Objective-C message5706* send, formatted like "initWithFoo:bar:". Only guaranteed to return a5707* non-empty string for CXCompletionContext_ObjCInstanceMessage and5708* CXCompletionContext_ObjCClassMessage.5709*5710* \param Results the code completion results to query5711*5712* \returns the selector (or partial selector) that has been entered thus far5713* for an Objective-C message send.5714*/5715CINDEX_LINKAGE5716CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results);57175718/**5719* @}5720*/57215722/**5723* \defgroup CINDEX_MISC Miscellaneous utility functions5724*5725* @{5726*/57275728/**5729* Return a version string, suitable for showing to a user, but not5730* intended to be parsed (the format is not guaranteed to be stable).5731*/5732CINDEX_LINKAGE CXString clang_getClangVersion(void);57335734/**5735* Enable/disable crash recovery.5736*5737* \param isEnabled Flag to indicate if crash recovery is enabled. A non-zero5738* value enables crash recovery, while 0 disables it.5739*/5740CINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled);57415742/**5743* Visitor invoked for each file in a translation unit5744* (used with clang_getInclusions()).5745*5746* This visitor function will be invoked by clang_getInclusions() for each5747* file included (either at the top-level or by \#include directives) within5748* a translation unit. The first argument is the file being included, and5749* the second and third arguments provide the inclusion stack. The5750* array is sorted in order of immediate inclusion. For example,5751* the first element refers to the location that included 'included_file'.5752*/5753typedef void (*CXInclusionVisitor)(CXFile included_file,5754CXSourceLocation *inclusion_stack,5755unsigned include_len,5756CXClientData client_data);57575758/**5759* Visit the set of preprocessor inclusions in a translation unit.5760* The visitor function is called with the provided data for every included5761* file. This does not include headers included by the PCH file (unless one5762* is inspecting the inclusions in the PCH file itself).5763*/5764CINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu,5765CXInclusionVisitor visitor,5766CXClientData client_data);57675768typedef enum {5769CXEval_Int = 1,5770CXEval_Float = 2,5771CXEval_ObjCStrLiteral = 3,5772CXEval_StrLiteral = 4,5773CXEval_CFStr = 5,5774CXEval_Other = 6,57755776CXEval_UnExposed = 057775778} CXEvalResultKind;57795780/**5781* Evaluation result of a cursor5782*/5783typedef void *CXEvalResult;57845785/**5786* If cursor is a statement declaration tries to evaluate the5787* statement and if its variable, tries to evaluate its initializer,5788* into its corresponding type.5789* If it's an expression, tries to evaluate the expression.5790*/5791CINDEX_LINKAGE CXEvalResult clang_Cursor_Evaluate(CXCursor C);57925793/**5794* Returns the kind of the evaluated result.5795*/5796CINDEX_LINKAGE CXEvalResultKind clang_EvalResult_getKind(CXEvalResult E);57975798/**5799* Returns the evaluation result as integer if the5800* kind is Int.5801*/5802CINDEX_LINKAGE int clang_EvalResult_getAsInt(CXEvalResult E);58035804/**5805* Returns the evaluation result as a long long integer if the5806* kind is Int. This prevents overflows that may happen if the result is5807* returned with clang_EvalResult_getAsInt.5808*/5809CINDEX_LINKAGE long long clang_EvalResult_getAsLongLong(CXEvalResult E);58105811/**5812* Returns a non-zero value if the kind is Int and the evaluation5813* result resulted in an unsigned integer.5814*/5815CINDEX_LINKAGE unsigned clang_EvalResult_isUnsignedInt(CXEvalResult E);58165817/**5818* Returns the evaluation result as an unsigned integer if5819* the kind is Int and clang_EvalResult_isUnsignedInt is non-zero.5820*/5821CINDEX_LINKAGE unsigned long long5822clang_EvalResult_getAsUnsigned(CXEvalResult E);58235824/**5825* Returns the evaluation result as double if the5826* kind is double.5827*/5828CINDEX_LINKAGE double clang_EvalResult_getAsDouble(CXEvalResult E);58295830/**5831* Returns the evaluation result as a constant string if the5832* kind is other than Int or float. User must not free this pointer,5833* instead call clang_EvalResult_dispose on the CXEvalResult returned5834* by clang_Cursor_Evaluate.5835*/5836CINDEX_LINKAGE const char *clang_EvalResult_getAsStr(CXEvalResult E);58375838/**5839* Disposes the created Eval memory.5840*/5841CINDEX_LINKAGE void clang_EvalResult_dispose(CXEvalResult E);5842/**5843* @}5844*/58455846/** \defgroup CINDEX_REMAPPING Remapping functions5847*5848* @{5849*/58505851/**5852* A remapping of original source files and their translated files.5853*/5854typedef void *CXRemapping;58555856/**5857* Retrieve a remapping.5858*5859* \param path the path that contains metadata about remappings.5860*5861* \returns the requested remapping. This remapping must be freed5862* via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.5863*/5864CINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path);58655866/**5867* Retrieve a remapping.5868*5869* \param filePaths pointer to an array of file paths containing remapping info.5870*5871* \param numFiles number of file paths.5872*5873* \returns the requested remapping. This remapping must be freed5874* via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.5875*/5876CINDEX_LINKAGE5877CXRemapping clang_getRemappingsFromFileList(const char **filePaths,5878unsigned numFiles);58795880/**5881* Determine the number of remappings.5882*/5883CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);58845885/**5886* Get the original and the associated filename from the remapping.5887*5888* \param original If non-NULL, will be set to the original filename.5889*5890* \param transformed If non-NULL, will be set to the filename that the original5891* is associated with.5892*/5893CINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index,5894CXString *original,5895CXString *transformed);58965897/**5898* Dispose the remapping.5899*/5900CINDEX_LINKAGE void clang_remap_dispose(CXRemapping);59015902/**5903* @}5904*/59055906/** \defgroup CINDEX_HIGH Higher level API functions5907*5908* @{5909*/59105911enum CXVisitorResult { CXVisit_Break, CXVisit_Continue };59125913typedef struct CXCursorAndRangeVisitor {5914void *context;5915enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange);5916} CXCursorAndRangeVisitor;59175918typedef enum {5919/**5920* Function returned successfully.5921*/5922CXResult_Success = 0,5923/**5924* One of the parameters was invalid for the function.5925*/5926CXResult_Invalid = 1,5927/**5928* The function was terminated by a callback (e.g. it returned5929* CXVisit_Break)5930*/5931CXResult_VisitBreak = 259325933} CXResult;59345935/**5936* Find references of a declaration in a specific file.5937*5938* \param cursor pointing to a declaration or a reference of one.5939*5940* \param file to search for references.5941*5942* \param visitor callback that will receive pairs of CXCursor/CXSourceRange for5943* each reference found.5944* The CXSourceRange will point inside the file; if the reference is inside5945* a macro (and not a macro argument) the CXSourceRange will be invalid.5946*5947* \returns one of the CXResult enumerators.5948*/5949CINDEX_LINKAGE CXResult clang_findReferencesInFile(5950CXCursor cursor, CXFile file, CXCursorAndRangeVisitor visitor);59515952/**5953* Find #import/#include directives in a specific file.5954*5955* \param TU translation unit containing the file to query.5956*5957* \param file to search for #import/#include directives.5958*5959* \param visitor callback that will receive pairs of CXCursor/CXSourceRange for5960* each directive found.5961*5962* \returns one of the CXResult enumerators.5963*/5964CINDEX_LINKAGE CXResult clang_findIncludesInFile(5965CXTranslationUnit TU, CXFile file, CXCursorAndRangeVisitor visitor);59665967#if __has_feature(blocks)5968typedef enum CXVisitorResult (^CXCursorAndRangeVisitorBlock)(CXCursor,5969CXSourceRange);5970#else5971typedef struct _CXCursorAndRangeVisitorBlock *CXCursorAndRangeVisitorBlock;5972#endif59735974CINDEX_LINKAGE5975CXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile,5976CXCursorAndRangeVisitorBlock);59775978CINDEX_LINKAGE5979CXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile,5980CXCursorAndRangeVisitorBlock);59815982/**5983* The client's data object that is associated with a CXFile.5984*/5985typedef void *CXIdxClientFile;59865987/**5988* The client's data object that is associated with a semantic entity.5989*/5990typedef void *CXIdxClientEntity;59915992/**5993* The client's data object that is associated with a semantic container5994* of entities.5995*/5996typedef void *CXIdxClientContainer;59975998/**5999* The client's data object that is associated with an AST file (PCH6000* or module).6001*/6002typedef void *CXIdxClientASTFile;60036004/**6005* Source location passed to index callbacks.6006*/6007typedef struct {6008void *ptr_data[2];6009unsigned int_data;6010} CXIdxLoc;60116012/**6013* Data for ppIncludedFile callback.6014*/6015typedef struct {6016/**6017* Location of '#' in the \#include/\#import directive.6018*/6019CXIdxLoc hashLoc;6020/**6021* Filename as written in the \#include/\#import directive.6022*/6023const char *filename;6024/**6025* The actual file that the \#include/\#import directive resolved to.6026*/6027CXFile file;6028int isImport;6029int isAngled;6030/**6031* Non-zero if the directive was automatically turned into a module6032* import.6033*/6034int isModuleImport;6035} CXIdxIncludedFileInfo;60366037/**6038* Data for IndexerCallbacks#importedASTFile.6039*/6040typedef struct {6041/**6042* Top level AST file containing the imported PCH, module or submodule.6043*/6044CXFile file;6045/**6046* The imported module or NULL if the AST file is a PCH.6047*/6048CXModule module;6049/**6050* Location where the file is imported. Applicable only for modules.6051*/6052CXIdxLoc loc;6053/**6054* Non-zero if an inclusion directive was automatically turned into6055* a module import. Applicable only for modules.6056*/6057int isImplicit;60586059} CXIdxImportedASTFileInfo;60606061typedef enum {6062CXIdxEntity_Unexposed = 0,6063CXIdxEntity_Typedef = 1,6064CXIdxEntity_Function = 2,6065CXIdxEntity_Variable = 3,6066CXIdxEntity_Field = 4,6067CXIdxEntity_EnumConstant = 5,60686069CXIdxEntity_ObjCClass = 6,6070CXIdxEntity_ObjCProtocol = 7,6071CXIdxEntity_ObjCCategory = 8,60726073CXIdxEntity_ObjCInstanceMethod = 9,6074CXIdxEntity_ObjCClassMethod = 10,6075CXIdxEntity_ObjCProperty = 11,6076CXIdxEntity_ObjCIvar = 12,60776078CXIdxEntity_Enum = 13,6079CXIdxEntity_Struct = 14,6080CXIdxEntity_Union = 15,60816082CXIdxEntity_CXXClass = 16,6083CXIdxEntity_CXXNamespace = 17,6084CXIdxEntity_CXXNamespaceAlias = 18,6085CXIdxEntity_CXXStaticVariable = 19,6086CXIdxEntity_CXXStaticMethod = 20,6087CXIdxEntity_CXXInstanceMethod = 21,6088CXIdxEntity_CXXConstructor = 22,6089CXIdxEntity_CXXDestructor = 23,6090CXIdxEntity_CXXConversionFunction = 24,6091CXIdxEntity_CXXTypeAlias = 25,6092CXIdxEntity_CXXInterface = 26,6093CXIdxEntity_CXXConcept = 2760946095} CXIdxEntityKind;60966097typedef enum {6098CXIdxEntityLang_None = 0,6099CXIdxEntityLang_C = 1,6100CXIdxEntityLang_ObjC = 2,6101CXIdxEntityLang_CXX = 3,6102CXIdxEntityLang_Swift = 46103} CXIdxEntityLanguage;61046105/**6106* Extra C++ template information for an entity. This can apply to:6107* CXIdxEntity_Function6108* CXIdxEntity_CXXClass6109* CXIdxEntity_CXXStaticMethod6110* CXIdxEntity_CXXInstanceMethod6111* CXIdxEntity_CXXConstructor6112* CXIdxEntity_CXXConversionFunction6113* CXIdxEntity_CXXTypeAlias6114*/6115typedef enum {6116CXIdxEntity_NonTemplate = 0,6117CXIdxEntity_Template = 1,6118CXIdxEntity_TemplatePartialSpecialization = 2,6119CXIdxEntity_TemplateSpecialization = 36120} CXIdxEntityCXXTemplateKind;61216122typedef enum {6123CXIdxAttr_Unexposed = 0,6124CXIdxAttr_IBAction = 1,6125CXIdxAttr_IBOutlet = 2,6126CXIdxAttr_IBOutletCollection = 36127} CXIdxAttrKind;61286129typedef struct {6130CXIdxAttrKind kind;6131CXCursor cursor;6132CXIdxLoc loc;6133} CXIdxAttrInfo;61346135typedef struct {6136CXIdxEntityKind kind;6137CXIdxEntityCXXTemplateKind templateKind;6138CXIdxEntityLanguage lang;6139const char *name;6140const char *USR;6141CXCursor cursor;6142const CXIdxAttrInfo *const *attributes;6143unsigned numAttributes;6144} CXIdxEntityInfo;61456146typedef struct {6147CXCursor cursor;6148} CXIdxContainerInfo;61496150typedef struct {6151const CXIdxAttrInfo *attrInfo;6152const CXIdxEntityInfo *objcClass;6153CXCursor classCursor;6154CXIdxLoc classLoc;6155} CXIdxIBOutletCollectionAttrInfo;61566157typedef enum { CXIdxDeclFlag_Skipped = 0x1 } CXIdxDeclInfoFlags;61586159typedef struct {6160const CXIdxEntityInfo *entityInfo;6161CXCursor cursor;6162CXIdxLoc loc;6163const CXIdxContainerInfo *semanticContainer;6164/**6165* Generally same as #semanticContainer but can be different in6166* cases like out-of-line C++ member functions.6167*/6168const CXIdxContainerInfo *lexicalContainer;6169int isRedeclaration;6170int isDefinition;6171int isContainer;6172const CXIdxContainerInfo *declAsContainer;6173/**6174* Whether the declaration exists in code or was created implicitly6175* by the compiler, e.g. implicit Objective-C methods for properties.6176*/6177int isImplicit;6178const CXIdxAttrInfo *const *attributes;6179unsigned numAttributes;61806181unsigned flags;61826183} CXIdxDeclInfo;61846185typedef enum {6186CXIdxObjCContainer_ForwardRef = 0,6187CXIdxObjCContainer_Interface = 1,6188CXIdxObjCContainer_Implementation = 26189} CXIdxObjCContainerKind;61906191typedef struct {6192const CXIdxDeclInfo *declInfo;6193CXIdxObjCContainerKind kind;6194} CXIdxObjCContainerDeclInfo;61956196typedef struct {6197const CXIdxEntityInfo *base;6198CXCursor cursor;6199CXIdxLoc loc;6200} CXIdxBaseClassInfo;62016202typedef struct {6203const CXIdxEntityInfo *protocol;6204CXCursor cursor;6205CXIdxLoc loc;6206} CXIdxObjCProtocolRefInfo;62076208typedef struct {6209const CXIdxObjCProtocolRefInfo *const *protocols;6210unsigned numProtocols;6211} CXIdxObjCProtocolRefListInfo;62126213typedef struct {6214const CXIdxObjCContainerDeclInfo *containerInfo;6215const CXIdxBaseClassInfo *superInfo;6216const CXIdxObjCProtocolRefListInfo *protocols;6217} CXIdxObjCInterfaceDeclInfo;62186219typedef struct {6220const CXIdxObjCContainerDeclInfo *containerInfo;6221const CXIdxEntityInfo *objcClass;6222CXCursor classCursor;6223CXIdxLoc classLoc;6224const CXIdxObjCProtocolRefListInfo *protocols;6225} CXIdxObjCCategoryDeclInfo;62266227typedef struct {6228const CXIdxDeclInfo *declInfo;6229const CXIdxEntityInfo *getter;6230const CXIdxEntityInfo *setter;6231} CXIdxObjCPropertyDeclInfo;62326233typedef struct {6234const CXIdxDeclInfo *declInfo;6235const CXIdxBaseClassInfo *const *bases;6236unsigned numBases;6237} CXIdxCXXClassDeclInfo;62386239/**6240* Data for IndexerCallbacks#indexEntityReference.6241*6242* This may be deprecated in a future version as this duplicates6243* the \c CXSymbolRole_Implicit bit in \c CXSymbolRole.6244*/6245typedef enum {6246/**6247* The entity is referenced directly in user's code.6248*/6249CXIdxEntityRef_Direct = 1,6250/**6251* An implicit reference, e.g. a reference of an Objective-C method6252* via the dot syntax.6253*/6254CXIdxEntityRef_Implicit = 26255} CXIdxEntityRefKind;62566257/**6258* Roles that are attributed to symbol occurrences.6259*6260* Internal: this currently mirrors low 9 bits of clang::index::SymbolRole with6261* higher bits zeroed. These high bits may be exposed in the future.6262*/6263typedef enum {6264CXSymbolRole_None = 0,6265CXSymbolRole_Declaration = 1 << 0,6266CXSymbolRole_Definition = 1 << 1,6267CXSymbolRole_Reference = 1 << 2,6268CXSymbolRole_Read = 1 << 3,6269CXSymbolRole_Write = 1 << 4,6270CXSymbolRole_Call = 1 << 5,6271CXSymbolRole_Dynamic = 1 << 6,6272CXSymbolRole_AddressOf = 1 << 7,6273CXSymbolRole_Implicit = 1 << 86274} CXSymbolRole;62756276/**6277* Data for IndexerCallbacks#indexEntityReference.6278*/6279typedef struct {6280CXIdxEntityRefKind kind;6281/**6282* Reference cursor.6283*/6284CXCursor cursor;6285CXIdxLoc loc;6286/**6287* The entity that gets referenced.6288*/6289const CXIdxEntityInfo *referencedEntity;6290/**6291* Immediate "parent" of the reference. For example:6292*6293* \code6294* Foo *var;6295* \endcode6296*6297* The parent of reference of type 'Foo' is the variable 'var'.6298* For references inside statement bodies of functions/methods,6299* the parentEntity will be the function/method.6300*/6301const CXIdxEntityInfo *parentEntity;6302/**6303* Lexical container context of the reference.6304*/6305const CXIdxContainerInfo *container;6306/**6307* Sets of symbol roles of the reference.6308*/6309CXSymbolRole role;6310} CXIdxEntityRefInfo;63116312/**6313* A group of callbacks used by #clang_indexSourceFile and6314* #clang_indexTranslationUnit.6315*/6316typedef struct {6317/**6318* Called periodically to check whether indexing should be aborted.6319* Should return 0 to continue, and non-zero to abort.6320*/6321int (*abortQuery)(CXClientData client_data, void *reserved);63226323/**6324* Called at the end of indexing; passes the complete diagnostic set.6325*/6326void (*diagnostic)(CXClientData client_data, CXDiagnosticSet, void *reserved);63276328CXIdxClientFile (*enteredMainFile)(CXClientData client_data, CXFile mainFile,6329void *reserved);63306331/**6332* Called when a file gets \#included/\#imported.6333*/6334CXIdxClientFile (*ppIncludedFile)(CXClientData client_data,6335const CXIdxIncludedFileInfo *);63366337/**6338* Called when a AST file (PCH or module) gets imported.6339*6340* AST files will not get indexed (there will not be callbacks to index all6341* the entities in an AST file). The recommended action is that, if the AST6342* file is not already indexed, to initiate a new indexing job specific to6343* the AST file.6344*/6345CXIdxClientASTFile (*importedASTFile)(CXClientData client_data,6346const CXIdxImportedASTFileInfo *);63476348/**6349* Called at the beginning of indexing a translation unit.6350*/6351CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data,6352void *reserved);63536354void (*indexDeclaration)(CXClientData client_data, const CXIdxDeclInfo *);63556356/**6357* Called to index a reference of an entity.6358*/6359void (*indexEntityReference)(CXClientData client_data,6360const CXIdxEntityRefInfo *);63616362} IndexerCallbacks;63636364CINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind);6365CINDEX_LINKAGE const CXIdxObjCContainerDeclInfo *6366clang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *);63676368CINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo *6369clang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *);63706371CINDEX_LINKAGE6372const CXIdxObjCCategoryDeclInfo *6373clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *);63746375CINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo *6376clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *);63776378CINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo *6379clang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *);63806381CINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo *6382clang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *);63836384CINDEX_LINKAGE const CXIdxCXXClassDeclInfo *6385clang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *);63866387/**6388* For retrieving a custom CXIdxClientContainer attached to a6389* container.6390*/6391CINDEX_LINKAGE CXIdxClientContainer6392clang_index_getClientContainer(const CXIdxContainerInfo *);63936394/**6395* For setting a custom CXIdxClientContainer attached to a6396* container.6397*/6398CINDEX_LINKAGE void clang_index_setClientContainer(const CXIdxContainerInfo *,6399CXIdxClientContainer);64006401/**6402* For retrieving a custom CXIdxClientEntity attached to an entity.6403*/6404CINDEX_LINKAGE CXIdxClientEntity6405clang_index_getClientEntity(const CXIdxEntityInfo *);64066407/**6408* For setting a custom CXIdxClientEntity attached to an entity.6409*/6410CINDEX_LINKAGE void clang_index_setClientEntity(const CXIdxEntityInfo *,6411CXIdxClientEntity);64126413/**6414* An indexing action/session, to be applied to one or multiple6415* translation units.6416*/6417typedef void *CXIndexAction;64186419/**6420* An indexing action/session, to be applied to one or multiple6421* translation units.6422*6423* \param CIdx The index object with which the index action will be associated.6424*/6425CINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx);64266427/**6428* Destroy the given index action.6429*6430* The index action must not be destroyed until all of the translation units6431* created within that index action have been destroyed.6432*/6433CINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction);64346435typedef enum {6436/**6437* Used to indicate that no special indexing options are needed.6438*/6439CXIndexOpt_None = 0x0,64406441/**6442* Used to indicate that IndexerCallbacks#indexEntityReference should6443* be invoked for only one reference of an entity per source file that does6444* not also include a declaration/definition of the entity.6445*/6446CXIndexOpt_SuppressRedundantRefs = 0x1,64476448/**6449* Function-local symbols should be indexed. If this is not set6450* function-local symbols will be ignored.6451*/6452CXIndexOpt_IndexFunctionLocalSymbols = 0x2,64536454/**6455* Implicit function/class template instantiations should be indexed.6456* If this is not set, implicit instantiations will be ignored.6457*/6458CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4,64596460/**6461* Suppress all compiler warnings when parsing for indexing.6462*/6463CXIndexOpt_SuppressWarnings = 0x8,64646465/**6466* Skip a function/method body that was already parsed during an6467* indexing session associated with a \c CXIndexAction object.6468* Bodies in system headers are always skipped.6469*/6470CXIndexOpt_SkipParsedBodiesInSession = 0x1064716472} CXIndexOptFlags;64736474/**6475* Index the given source file and the translation unit corresponding6476* to that file via callbacks implemented through #IndexerCallbacks.6477*6478* \param client_data pointer data supplied by the client, which will6479* be passed to the invoked callbacks.6480*6481* \param index_callbacks Pointer to indexing callbacks that the client6482* implements.6483*6484* \param index_callbacks_size Size of #IndexerCallbacks structure that gets6485* passed in index_callbacks.6486*6487* \param index_options A bitmask of options that affects how indexing is6488* performed. This should be a bitwise OR of the CXIndexOpt_XXX flags.6489*6490* \param[out] out_TU pointer to store a \c CXTranslationUnit that can be6491* reused after indexing is finished. Set to \c NULL if you do not require it.6492*6493* \returns 0 on success or if there were errors from which the compiler could6494* recover. If there is a failure from which there is no recovery, returns6495* a non-zero \c CXErrorCode.6496*6497* The rest of the parameters are the same as #clang_parseTranslationUnit.6498*/6499CINDEX_LINKAGE int clang_indexSourceFile(6500CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks,6501unsigned index_callbacks_size, unsigned index_options,6502const char *source_filename, const char *const *command_line_args,6503int num_command_line_args, struct CXUnsavedFile *unsaved_files,6504unsigned num_unsaved_files, CXTranslationUnit *out_TU, unsigned TU_options);65056506/**6507* Same as clang_indexSourceFile but requires a full command line6508* for \c command_line_args including argv[0]. This is useful if the standard6509* library paths are relative to the binary.6510*/6511CINDEX_LINKAGE int clang_indexSourceFileFullArgv(6512CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks,6513unsigned index_callbacks_size, unsigned index_options,6514const char *source_filename, const char *const *command_line_args,6515int num_command_line_args, struct CXUnsavedFile *unsaved_files,6516unsigned num_unsaved_files, CXTranslationUnit *out_TU, unsigned TU_options);65176518/**6519* Index the given translation unit via callbacks implemented through6520* #IndexerCallbacks.6521*6522* The order of callback invocations is not guaranteed to be the same as6523* when indexing a source file. The high level order will be:6524*6525* -Preprocessor callbacks invocations6526* -Declaration/reference callbacks invocations6527* -Diagnostic callback invocations6528*6529* The parameters are the same as #clang_indexSourceFile.6530*6531* \returns If there is a failure from which there is no recovery, returns6532* non-zero, otherwise returns 0.6533*/6534CINDEX_LINKAGE int clang_indexTranslationUnit(6535CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks,6536unsigned index_callbacks_size, unsigned index_options, CXTranslationUnit);65376538/**6539* Retrieve the CXIdxFile, file, line, column, and offset represented by6540* the given CXIdxLoc.6541*6542* If the location refers into a macro expansion, retrieves the6543* location of the macro expansion and if it refers into a macro argument6544* retrieves the location of the argument.6545*/6546CINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc,6547CXIdxClientFile *indexFile,6548CXFile *file, unsigned *line,6549unsigned *column,6550unsigned *offset);65516552/**6553* Retrieve the CXSourceLocation represented by the given CXIdxLoc.6554*/6555CINDEX_LINKAGE6556CXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc);65576558/**6559* Visitor invoked for each field found by a traversal.6560*6561* This visitor function will be invoked for each field found by6562* \c clang_Type_visitFields. Its first argument is the cursor being6563* visited, its second argument is the client data provided to6564* \c clang_Type_visitFields.6565*6566* The visitor should return one of the \c CXVisitorResult values6567* to direct \c clang_Type_visitFields.6568*/6569typedef enum CXVisitorResult (*CXFieldVisitor)(CXCursor C,6570CXClientData client_data);65716572/**6573* Visit the fields of a particular type.6574*6575* This function visits all the direct fields of the given cursor,6576* invoking the given \p visitor function with the cursors of each6577* visited field. The traversal may be ended prematurely, if6578* the visitor returns \c CXFieldVisit_Break.6579*6580* \param T the record type whose field may be visited.6581*6582* \param visitor the visitor function that will be invoked for each6583* field of \p T.6584*6585* \param client_data pointer data supplied by the client, which will6586* be passed to the visitor each time it is invoked.6587*6588* \returns a non-zero value if the traversal was terminated6589* prematurely by the visitor returning \c CXFieldVisit_Break.6590*/6591CINDEX_LINKAGE unsigned clang_Type_visitFields(CXType T, CXFieldVisitor visitor,6592CXClientData client_data);65936594/**6595* Describes the kind of binary operators.6596*/6597enum CXBinaryOperatorKind {6598/** This value describes cursors which are not binary operators. */6599CXBinaryOperator_Invalid,6600/** C++ Pointer - to - member operator. */6601CXBinaryOperator_PtrMemD,6602/** C++ Pointer - to - member operator. */6603CXBinaryOperator_PtrMemI,6604/** Multiplication operator. */6605CXBinaryOperator_Mul,6606/** Division operator. */6607CXBinaryOperator_Div,6608/** Remainder operator. */6609CXBinaryOperator_Rem,6610/** Addition operator. */6611CXBinaryOperator_Add,6612/** Subtraction operator. */6613CXBinaryOperator_Sub,6614/** Bitwise shift left operator. */6615CXBinaryOperator_Shl,6616/** Bitwise shift right operator. */6617CXBinaryOperator_Shr,6618/** C++ three-way comparison (spaceship) operator. */6619CXBinaryOperator_Cmp,6620/** Less than operator. */6621CXBinaryOperator_LT,6622/** Greater than operator. */6623CXBinaryOperator_GT,6624/** Less or equal operator. */6625CXBinaryOperator_LE,6626/** Greater or equal operator. */6627CXBinaryOperator_GE,6628/** Equal operator. */6629CXBinaryOperator_EQ,6630/** Not equal operator. */6631CXBinaryOperator_NE,6632/** Bitwise AND operator. */6633CXBinaryOperator_And,6634/** Bitwise XOR operator. */6635CXBinaryOperator_Xor,6636/** Bitwise OR operator. */6637CXBinaryOperator_Or,6638/** Logical AND operator. */6639CXBinaryOperator_LAnd,6640/** Logical OR operator. */6641CXBinaryOperator_LOr,6642/** Assignment operator. */6643CXBinaryOperator_Assign,6644/** Multiplication assignment operator. */6645CXBinaryOperator_MulAssign,6646/** Division assignment operator. */6647CXBinaryOperator_DivAssign,6648/** Remainder assignment operator. */6649CXBinaryOperator_RemAssign,6650/** Addition assignment operator. */6651CXBinaryOperator_AddAssign,6652/** Subtraction assignment operator. */6653CXBinaryOperator_SubAssign,6654/** Bitwise shift left assignment operator. */6655CXBinaryOperator_ShlAssign,6656/** Bitwise shift right assignment operator. */6657CXBinaryOperator_ShrAssign,6658/** Bitwise AND assignment operator. */6659CXBinaryOperator_AndAssign,6660/** Bitwise XOR assignment operator. */6661CXBinaryOperator_XorAssign,6662/** Bitwise OR assignment operator. */6663CXBinaryOperator_OrAssign,6664/** Comma operator. */6665CXBinaryOperator_Comma6666};66676668/**6669* Retrieve the spelling of a given CXBinaryOperatorKind.6670*/6671CINDEX_LINKAGE CXString6672clang_getBinaryOperatorKindSpelling(enum CXBinaryOperatorKind kind);66736674/**6675* Retrieve the binary operator kind of this cursor.6676*6677* If this cursor is not a binary operator then returns Invalid.6678*/6679CINDEX_LINKAGE enum CXBinaryOperatorKind6680clang_getCursorBinaryOperatorKind(CXCursor cursor);66816682/**6683* Describes the kind of unary operators.6684*/6685enum CXUnaryOperatorKind {6686/** This value describes cursors which are not unary operators. */6687CXUnaryOperator_Invalid,6688/** Postfix increment operator. */6689CXUnaryOperator_PostInc,6690/** Postfix decrement operator. */6691CXUnaryOperator_PostDec,6692/** Prefix increment operator. */6693CXUnaryOperator_PreInc,6694/** Prefix decrement operator. */6695CXUnaryOperator_PreDec,6696/** Address of operator. */6697CXUnaryOperator_AddrOf,6698/** Dereference operator. */6699CXUnaryOperator_Deref,6700/** Plus operator. */6701CXUnaryOperator_Plus,6702/** Minus operator. */6703CXUnaryOperator_Minus,6704/** Not operator. */6705CXUnaryOperator_Not,6706/** LNot operator. */6707CXUnaryOperator_LNot,6708/** "__real expr" operator. */6709CXUnaryOperator_Real,6710/** "__imag expr" operator. */6711CXUnaryOperator_Imag,6712/** __extension__ marker operator. */6713CXUnaryOperator_Extension,6714/** C++ co_await operator. */6715CXUnaryOperator_Coawait6716};67176718/**6719* Retrieve the spelling of a given CXUnaryOperatorKind.6720*/6721CINDEX_LINKAGE CXString6722clang_getUnaryOperatorKindSpelling(enum CXUnaryOperatorKind kind);67236724/**6725* Retrieve the unary operator kind of this cursor.6726*6727* If this cursor is not a unary operator then returns Invalid.6728*/6729CINDEX_LINKAGE enum CXUnaryOperatorKind6730clang_getCursorUnaryOperatorKind(CXCursor cursor);67316732/**6733* @}6734*/67356736/**6737* @}6738*/67396740LLVM_CLANG_C_EXTERN_C_END67416742#endif674367446745