diff options
Diffstat (limited to 'contrib/llvm/tools/clang/include/clang-c/Index.h')
-rw-r--r-- | contrib/llvm/tools/clang/include/clang-c/Index.h | 165 |
1 files changed, 142 insertions, 23 deletions
diff --git a/contrib/llvm/tools/clang/include/clang-c/Index.h b/contrib/llvm/tools/clang/include/clang-c/Index.h index aa3403c..787c44a 100644 --- a/contrib/llvm/tools/clang/include/clang-c/Index.h +++ b/contrib/llvm/tools/clang/include/clang-c/Index.h @@ -32,7 +32,7 @@ * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. */ #define CINDEX_VERSION_MAJOR 0 -#define CINDEX_VERSION_MINOR 6 +#define CINDEX_VERSION_MINOR 15 #define CINDEX_VERSION_ENCODE(major, minor) ( \ ((major) * 10000) \ @@ -297,6 +297,24 @@ CINDEX_LINKAGE CXString clang_getFileName(CXFile SFile); CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile); /** + * \brief Uniquely identifies a CXFile, that refers to the same underlying file, + * across an indexing session. + */ +typedef struct { + unsigned long long data[3]; +} CXFileUniqueID; + +/** + * \brief Retrieve the unique ID for the given \c file. + * + * \param file the file to get the ID for. + * \param outID stores the returned CXFileUniqueID. + * \returns If there was a failure getting the unique ID, returns non-zero, + * otherwise returns 0. +*/ +CINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID); + +/** * \brief Determine whether the given header is guarded against * multiple inclusions, either with the conventional * \#ifndef/\#define/\#endif macro guards or with \#pragma once. @@ -342,7 +360,7 @@ CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu, * to map a source location to a particular file, line, and column. */ typedef struct { - void *ptr_data[2]; + const void *ptr_data[2]; unsigned int_data; } CXSourceLocation; @@ -353,7 +371,7 @@ typedef struct { * starting and end locations from a source range, respectively. */ typedef struct { - void *ptr_data[2]; + const void *ptr_data[2]; unsigned begin_int_data; unsigned end_int_data; } CXSourceRange; @@ -361,7 +379,7 @@ typedef struct { /** * \brief Retrieve a NULL (invalid) source location. */ -CINDEX_LINKAGE CXSourceLocation clang_getNullLocation(); +CINDEX_LINKAGE CXSourceLocation clang_getNullLocation(void); /** * \brief Determine whether two source locations, which must refer into @@ -393,7 +411,7 @@ CINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu, /** * \brief Retrieve a NULL (invalid) source range. */ -CINDEX_LINKAGE CXSourceRange clang_getNullRange(); +CINDEX_LINKAGE CXSourceRange clang_getNullRange(void); /** * \brief Retrieve a source range given the beginning and ending source @@ -531,6 +549,35 @@ CINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location, unsigned *offset); /** + * \brief Retrieve the file, line, column, and offset represented by + * the given source location. + * + * If the location refers into a macro expansion, return where the macro was + * expanded or where the macro argument was written, if the location points at + * a macro argument. + * + * \param location the location within a source file that will be decomposed + * into its parts. + * + * \param file [out] if non-NULL, will be set to the file to which the given + * source location points. + * + * \param line [out] if non-NULL, will be set to the line to which the given + * source location points. + * + * \param column [out] if non-NULL, will be set to the column to which the given + * source location points. + * + * \param offset [out] if non-NULL, will be set to the offset into the + * buffer to which the given source location points. + */ +CINDEX_LINKAGE void clang_getFileLocation(CXSourceLocation location, + CXFile *file, + unsigned *line, + unsigned *column, + unsigned *offset); + +/** * \brief Retrieve a source location representing the first character within a * source range. */ @@ -2072,7 +2119,7 @@ enum CXCursorKind { typedef struct { enum CXCursorKind kind; int xdata; - void *data[3]; + const void *data[3]; } CXCursor; /** @@ -2330,7 +2377,7 @@ typedef struct CXCursorSetImpl *CXCursorSet; /** * \brief Creates an empty CXCursorSet. */ -CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(); +CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void); /** * \brief Disposes a CXCursorSet and releases its associated memory. @@ -2626,6 +2673,7 @@ enum CXCallingConv { CXCallingConv_AAPCS = 6, CXCallingConv_AAPCS_VFP = 7, CXCallingConv_PnaclCall = 8, + CXCallingConv_IntelOclBicc = 9, CXCallingConv_Invalid = 100, CXCallingConv_Unexposed = 200 @@ -2647,6 +2695,14 @@ typedef struct { CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C); /** + * \brief Pretty-print the underlying type using the rules of the + * language of the translation unit from which it came. + * + * If the type is invalid, an empty string is returned. + */ +CINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT); + +/** * \brief Retrieve the underlying type of a typedef declaration. * * If the cursor does not reference a typedef declaration, an invalid type is @@ -2683,18 +2739,27 @@ CINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C); CINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C); /** + * \brief Retrieve the bit width of a bit field declaration as an integer. + * + * If a cursor that is not a bit field declaration is passed in, -1 is returned. + */ +CINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C); + +/** * \brief Retrieve the number of non-variadic arguments associated with a given * cursor. * - * If a cursor that is not a function or method is passed in, -1 is returned. + * The number of arguments can be determined for calls as well as for + * declarations of functions or methods. For other cursors -1 is returned. */ CINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C); /** * \brief Retrieve the argument cursor of a function or method. * - * If a cursor that is not a function or method is passed in or the index - * exceeds the number of arguments, an invalid cursor is returned. + * The argument cursor can be determined for calls as well as for declarations + * of functions or methods. For other cursors and for invalid indices, an + * invalid cursor is returned. */ CINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i); @@ -3284,7 +3349,8 @@ CINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module); * * \returns the number of top level headers associated with this module. */ -CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXModule Module); +CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit, + CXModule Module); /** * \param Module a module object. @@ -3294,7 +3360,8 @@ CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXModule Module); * \returns the specified top level header associated with the module. */ CINDEX_LINKAGE -CXFile clang_Module_getTopLevelHeader(CXModule Module, unsigned Index); +CXFile clang_Module_getTopLevelHeader(CXTranslationUnit, + CXModule Module, unsigned Index); /** * @} @@ -4828,7 +4895,7 @@ CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results); * \brief Return a version string, suitable for showing to a user, but not * intended to be parsed (the format is not guaranteed to be stable). */ -CINDEX_LINKAGE CXString clang_getClangVersion(); +CINDEX_LINKAGE CXString clang_getClangVersion(void); /** @@ -4943,6 +5010,23 @@ typedef struct { enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange); } CXCursorAndRangeVisitor; +typedef enum { + /** + * \brief Function returned successfully. + */ + CXResult_Success = 0, + /** + * \brief One of the parameters was invalid for the function. + */ + CXResult_Invalid = 1, + /** + * \brief The function was terminated by a callback (e.g. it returned + * CXVisit_Break) + */ + CXResult_VisitBreak = 2 + +} CXResult; + /** * \brief Find references of a declaration in a specific file. * @@ -4954,10 +5038,28 @@ typedef struct { * each reference found. * The CXSourceRange will point inside the file; if the reference is inside * a macro (and not a macro argument) the CXSourceRange will be invalid. + * + * \returns one of the CXResult enumerators. */ -CINDEX_LINKAGE void clang_findReferencesInFile(CXCursor cursor, CXFile file, +CINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file, CXCursorAndRangeVisitor visitor); +/** + * \brief Find #import/#include directives in a specific file. + * + * \param TU translation unit containing the file to query. + * + * \param file to search for #import/#include directives. + * + * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for + * each directive found. + * + * \returns one of the CXResult enumerators. + */ +CINDEX_LINKAGE CXResult clang_findIncludesInFile(CXTranslationUnit TU, + CXFile file, + CXCursorAndRangeVisitor visitor); + #ifdef __has_feature # if __has_feature(blocks) @@ -4965,8 +5067,12 @@ typedef enum CXVisitorResult (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange); CINDEX_LINKAGE -void clang_findReferencesInFileWithBlock(CXCursor, CXFile, - CXCursorAndRangeVisitorBlock); +CXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile, + CXCursorAndRangeVisitorBlock); + +CINDEX_LINKAGE +CXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile, + CXCursorAndRangeVisitorBlock); # endif #endif @@ -5144,6 +5250,10 @@ typedef struct { CXIdxLoc classLoc; } CXIdxIBOutletCollectionAttrInfo; +typedef enum { + CXIdxDeclFlag_Skipped = 0x1 +} CXIdxDeclInfoFlags; + typedef struct { const CXIdxEntityInfo *entityInfo; CXCursor cursor; @@ -5165,6 +5275,9 @@ typedef struct { int isImplicit; const CXIdxAttrInfo *const *attributes; unsigned numAttributes; + + unsigned flags; + } CXIdxDeclInfo; typedef enum { @@ -5372,16 +5485,14 @@ CINDEX_LINKAGE void clang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity); /** - * \brief An indexing action, to be applied to one or multiple translation units - * but not on concurrent threads. If there are threads doing indexing - * concurrently, they should use different CXIndexAction objects. + * \brief An indexing action/session, to be applied to one or multiple + * translation units. */ typedef void *CXIndexAction; /** - * \brief An indexing action, to be applied to one or multiple translation units - * but not on concurrent threads. If there are threads doing indexing - * concurrently, they should use different CXIndexAction objects. + * \brief An indexing action/session, to be applied to one or multiple + * translation units. * * \param CIdx The index object with which the index action will be associated. */ @@ -5423,7 +5534,15 @@ typedef enum { /** * \brief Suppress all compiler warnings when parsing for indexing. */ - CXIndexOpt_SuppressWarnings = 0x8 + CXIndexOpt_SuppressWarnings = 0x8, + + /** + * \brief Skip a function/method body that was already parsed during an + * indexing session assosiated with a \c CXIndexAction object. + * Bodies in system headers are always skipped. + */ + CXIndexOpt_SkipParsedBodiesInSession = 0x10 + } CXIndexOptFlags; /** |