| /*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\ |
| |* *| |
| |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| |
| |* Exceptions. *| |
| |* See https://llvm.org/LICENSE.txt for license information. *| |
| |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| |
| |* *| |
| |*===----------------------------------------------------------------------===*| |
| |* *| |
| |* This header provides a public interface to a Clang library for extracting *| |
| |* high-level symbol information from source files without exposing the full *| |
| |* Clang C++ API. *| |
| |* *| |
| \*===----------------------------------------------------------------------===*/ |
| |
| #ifndef LLVM_CLANG_C_INDEX_H |
| #define LLVM_CLANG_C_INDEX_H |
| |
| #include <time.h> |
| |
| #include "clang-c/Platform.h" |
| #include "clang-c/CXErrorCode.h" |
| #include "clang-c/CXString.h" |
| #include "clang-c/BuildSystem.h" |
| |
| /** |
| * The version constants for the libclang API. |
| * CINDEX_VERSION_MINOR should increase when there are API additions. |
| * CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes. |
| * |
| * The policy about the libclang API was always to keep it source and ABI |
| * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. |
| */ |
| #define CINDEX_VERSION_MAJOR 0 |
| #define CINDEX_VERSION_MINOR 59 |
| |
| #define CINDEX_VERSION_ENCODE(major, minor) ( \ |
| ((major) * 10000) \ |
| + ((minor) * 1)) |
| |
| #define CINDEX_VERSION CINDEX_VERSION_ENCODE( \ |
| CINDEX_VERSION_MAJOR, \ |
| CINDEX_VERSION_MINOR ) |
| |
| #define CINDEX_VERSION_STRINGIZE_(major, minor) \ |
| #major"."#minor |
| #define CINDEX_VERSION_STRINGIZE(major, minor) \ |
| CINDEX_VERSION_STRINGIZE_(major, minor) |
| |
| #define CINDEX_VERSION_STRING CINDEX_VERSION_STRINGIZE( \ |
| CINDEX_VERSION_MAJOR, \ |
| CINDEX_VERSION_MINOR) |
| |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
| |
| /** \defgroup CINDEX libclang: C Interface to Clang |
| * |
| * The C Interface to Clang provides a relatively small API that exposes |
| * facilities for parsing source code into an abstract syntax tree (AST), |
| * loading already-parsed ASTs, traversing the AST, associating |
| * physical source locations with elements within the AST, and other |
| * facilities that support Clang-based development tools. |
| * |
| * This C interface to Clang will never provide all of the information |
| * representation stored in Clang's C++ AST, nor should it: the intent is to |
| * maintain an API that is relatively stable from one release to the next, |
| * providing only the basic functionality needed to support development tools. |
| * |
| * To avoid namespace pollution, data types are prefixed with "CX" and |
| * functions are prefixed with "clang_". |
| * |
| * @{ |
| */ |
| |
| /** |
| * An "index" that consists of a set of translation units that would |
| * typically be linked together into an executable or library. |
| */ |
| typedef void *CXIndex; |
| |
| /** |
| * An opaque type representing target information for a given translation |
| * unit. |
| */ |
| typedef struct CXTargetInfoImpl *CXTargetInfo; |
| |
| /** |
| * A single translation unit, which resides in an index. |
| */ |
| typedef struct CXTranslationUnitImpl *CXTranslationUnit; |
| |
| /** |
| * Opaque pointer representing client data that will be passed through |
| * to various callbacks and visitors. |
| */ |
| typedef void *CXClientData; |
| |
| /** |
| * Provides the contents of a file that has not yet been saved to disk. |
| * |
| * Each CXUnsavedFile instance provides the name of a file on the |
| * system along with the current contents of that file that have not |
| * yet been saved to disk. |
| */ |
| struct CXUnsavedFile { |
| /** |
| * The file whose contents have not yet been saved. |
| * |
| * This file must already exist in the file system. |
| */ |
| const char *Filename; |
| |
| /** |
| * A buffer containing the unsaved contents of this file. |
| */ |
| const char *Contents; |
| |
| /** |
| * The length of the unsaved contents of this buffer. |
| */ |
| unsigned long Length; |
| }; |
| |
| /** |
| * Describes the availability of a particular entity, which indicates |
| * whether the use of this entity will result in a warning or error due to |
| * it being deprecated or unavailable. |
| */ |
| enum CXAvailabilityKind { |
| /** |
| * The entity is available. |
| */ |
| CXAvailability_Available, |
| /** |
| * The entity is available, but has been deprecated (and its use is |
| * not recommended). |
| */ |
| CXAvailability_Deprecated, |
| /** |
| * The entity is not available; any use of it will be an error. |
| */ |
| CXAvailability_NotAvailable, |
| /** |
| * The entity is available, but not accessible; any use of it will be |
| * an error. |
| */ |
| CXAvailability_NotAccessible |
| }; |
| |
| /** |
| * Describes a version number of the form major.minor.subminor. |
| */ |
| typedef struct CXVersion { |
| /** |
| * The major version number, e.g., the '10' in '10.7.3'. A negative |
| * value indicates that there is no version number at all. |
| */ |
| int Major; |
| /** |
| * The minor version number, e.g., the '7' in '10.7.3'. This value |
| * will be negative if no minor version number was provided, e.g., for |
| * version '10'. |
| */ |
| int Minor; |
| /** |
| * The subminor version number, e.g., the '3' in '10.7.3'. This value |
| * will be negative if no minor or subminor version number was provided, |
| * e.g., in version '10' or '10.7'. |
| */ |
| int Subminor; |
| } CXVersion; |
| |
| /** |
| * Describes the exception specification of a cursor. |
| * |
| * A negative value indicates that the cursor is not a function declaration. |
| */ |
| enum CXCursor_ExceptionSpecificationKind { |
| /** |
| * The cursor has no exception specification. |
| */ |
| CXCursor_ExceptionSpecificationKind_None, |
| |
| /** |
| * The cursor has exception specification throw() |
| */ |
| CXCursor_ExceptionSpecificationKind_DynamicNone, |
| |
| /** |
| * The cursor has exception specification throw(T1, T2) |
| */ |
| CXCursor_ExceptionSpecificationKind_Dynamic, |
| |
| /** |
| * The cursor has exception specification throw(...). |
| */ |
| CXCursor_ExceptionSpecificationKind_MSAny, |
| |
| /** |
| * The cursor has exception specification basic noexcept. |
| */ |
| CXCursor_ExceptionSpecificationKind_BasicNoexcept, |
| |
| /** |
| * The cursor has exception specification computed noexcept. |
| */ |
| CXCursor_ExceptionSpecificationKind_ComputedNoexcept, |
| |
| /** |
| * The exception specification has not yet been evaluated. |
| */ |
| CXCursor_ExceptionSpecificationKind_Unevaluated, |
| |
| /** |
| * The exception specification has not yet been instantiated. |
| */ |
| CXCursor_ExceptionSpecificationKind_Uninstantiated, |
| |
| /** |
| * The exception specification has not been parsed yet. |
| */ |
| CXCursor_ExceptionSpecificationKind_Unparsed, |
| |
| /** |
| * The cursor has a __declspec(nothrow) exception specification. |
| */ |
| CXCursor_ExceptionSpecificationKind_NoThrow |
| }; |
| |
| /** |
| * Provides a shared context for creating translation units. |
| * |
| * It provides two options: |
| * |
| * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local" |
| * declarations (when loading any new translation units). A "local" declaration |
| * is one that belongs in the translation unit itself and not in a precompiled |
| * header that was used by the translation unit. If zero, all declarations |
| * will be enumerated. |
| * |
| * Here is an example: |
| * |
| * \code |
| * // excludeDeclsFromPCH = 1, displayDiagnostics=1 |
| * Idx = clang_createIndex(1, 1); |
| * |
| * // IndexTest.pch was produced with the following command: |
| * // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch" |
| * TU = clang_createTranslationUnit(Idx, "IndexTest.pch"); |
| * |
| * // This will load all the symbols from 'IndexTest.pch' |
| * clang_visitChildren(clang_getTranslationUnitCursor(TU), |
| * TranslationUnitVisitor, 0); |
| * clang_disposeTranslationUnit(TU); |
| * |
| * // This will load all the symbols from 'IndexTest.c', excluding symbols |
| * // from 'IndexTest.pch'. |
| * char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" }; |
| * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args, |
| * 0, 0); |
| * clang_visitChildren(clang_getTranslationUnitCursor(TU), |
| * TranslationUnitVisitor, 0); |
| * clang_disposeTranslationUnit(TU); |
| * \endcode |
| * |
| * This process of creating the 'pch', loading it separately, and using it (via |
| * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks |
| * (which gives the indexer the same performance benefit as the compiler). |
| */ |
| CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH, |
| int displayDiagnostics); |
| |
| /** |
| * Destroy the given index. |
| * |
| * The index must not be destroyed until all of the translation units created |
| * within that index have been destroyed. |
| */ |
| CINDEX_LINKAGE void clang_disposeIndex(CXIndex index); |
| |
| typedef enum { |
| /** |
| * Used to indicate that no special CXIndex options are needed. |
| */ |
| CXGlobalOpt_None = 0x0, |
| |
| /** |
| * Used to indicate that threads that libclang creates for indexing |
| * purposes should use background priority. |
| * |
| * Affects #clang_indexSourceFile, #clang_indexTranslationUnit, |
| * #clang_parseTranslationUnit, #clang_saveTranslationUnit. |
| */ |
| CXGlobalOpt_ThreadBackgroundPriorityForIndexing = 0x1, |
| |
| /** |
| * Used to indicate that threads that libclang creates for editing |
| * purposes should use background priority. |
| * |
| * Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt, |
| * #clang_annotateTokens |
| */ |
| CXGlobalOpt_ThreadBackgroundPriorityForEditing = 0x2, |
| |
| /** |
| * Used to indicate that all threads that libclang creates should use |
| * background priority. |
| */ |
| CXGlobalOpt_ThreadBackgroundPriorityForAll = |
| CXGlobalOpt_ThreadBackgroundPriorityForIndexing | |
| CXGlobalOpt_ThreadBackgroundPriorityForEditing |
| |
| } CXGlobalOptFlags; |
| |
| /** |
| * Sets general options associated with a CXIndex. |
| * |
| * For example: |
| * \code |
| * CXIndex idx = ...; |
| * clang_CXIndex_setGlobalOptions(idx, |
| * clang_CXIndex_getGlobalOptions(idx) | |
| * CXGlobalOpt_ThreadBackgroundPriorityForIndexing); |
| * \endcode |
| * |
| * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags. |
| */ |
| CINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options); |
| |
| /** |
| * Gets the general options associated with a CXIndex. |
| * |
| * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that |
| * are associated with the given CXIndex object. |
| */ |
| CINDEX_LINKAGE unsigned clang_CXIndex_getGlobalOptions(CXIndex); |
| |
| /** |
| * Sets the invocation emission path option in a CXIndex. |
| * |
| * The invocation emission path specifies a path which will contain log |
| * files for certain libclang invocations. A null value (default) implies that |
| * libclang invocations are not logged.. |
| */ |
| CINDEX_LINKAGE void |
| clang_CXIndex_setInvocationEmissionPathOption(CXIndex, const char *Path); |
| |
| /** |
| * \defgroup CINDEX_FILES File manipulation routines |
| * |
| * @{ |
| */ |
| |
| /** |
| * A particular source file that is part of a translation unit. |
| */ |
| typedef void *CXFile; |
| |
| /** |
| * Retrieve the complete file and path name of the given file. |
| */ |
| CINDEX_LINKAGE CXString clang_getFileName(CXFile SFile); |
| |
| /** |
| * Retrieve the last modification time of the given file. |
| */ |
| CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile); |
| |
| /** |
| * Uniquely identifies a CXFile, that refers to the same underlying file, |
| * across an indexing session. |
| */ |
| typedef struct { |
| unsigned long long data[3]; |
| } CXFileUniqueID; |
| |
| /** |
| * 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); |
| |
| /** |
| * Determine whether the given header is guarded against |
| * multiple inclusions, either with the conventional |
| * \#ifndef/\#define/\#endif macro guards or with \#pragma once. |
| */ |
| CINDEX_LINKAGE unsigned |
| clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file); |
| |
| /** |
| * Retrieve a file handle within the given translation unit. |
| * |
| * \param tu the translation unit |
| * |
| * \param file_name the name of the file. |
| * |
| * \returns the file handle for the named file in the translation unit \p tu, |
| * or a NULL file handle if the file was not a part of this translation unit. |
| */ |
| CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu, |
| const char *file_name); |
| |
| /** |
| * Retrieve the buffer associated with the given file. |
| * |
| * \param tu the translation unit |
| * |
| * \param file the file for which to retrieve the buffer. |
| * |
| * \param size [out] if non-NULL, will be set to the size of the buffer. |
| * |
| * \returns a pointer to the buffer in memory that holds the contents of |
| * \p file, or a NULL pointer when the file is not loaded. |
| */ |
| CINDEX_LINKAGE const char *clang_getFileContents(CXTranslationUnit tu, |
| CXFile file, size_t *size); |
| |
| /** |
| * Returns non-zero if the \c file1 and \c file2 point to the same file, |
| * or they are both NULL. |
| */ |
| CINDEX_LINKAGE int clang_File_isEqual(CXFile file1, CXFile file2); |
| |
| /** |
| * Returns the real path name of \c file. |
| * |
| * An empty string may be returned. Use \c clang_getFileName() in that case. |
| */ |
| CINDEX_LINKAGE CXString clang_File_tryGetRealPathName(CXFile file); |
| |
| /** |
| * @} |
| */ |
| |
| /** |
| * \defgroup CINDEX_LOCATIONS Physical source locations |
| * |
| * Clang represents physical source locations in its abstract syntax tree in |
| * great detail, with file, line, and column information for the majority of |
| * the tokens parsed in the source code. These data types and functions are |
| * used to represent source location information, either for a particular |
| * point in the program or for a range of points in the program, and extract |
| * specific location information from those data types. |
| * |
| * @{ |
| */ |
| |
| /** |
| * Identifies a specific source location within a translation |
| * unit. |
| * |
| * Use clang_getExpansionLocation() or clang_getSpellingLocation() |
| * to map a source location to a particular file, line, and column. |
| */ |
| typedef struct { |
| const void *ptr_data[2]; |
| unsigned int_data; |
| } CXSourceLocation; |
| |
| /** |
| * Identifies a half-open character range in the source code. |
| * |
| * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the |
| * starting and end locations from a source range, respectively. |
| */ |
| typedef struct { |
| const void *ptr_data[2]; |
| unsigned begin_int_data; |
| unsigned end_int_data; |
| } CXSourceRange; |
| |
| /** |
| * Retrieve a NULL (invalid) source location. |
| */ |
| CINDEX_LINKAGE CXSourceLocation clang_getNullLocation(void); |
| |
| /** |
| * Determine whether two source locations, which must refer into |
| * the same translation unit, refer to exactly the same point in the source |
| * code. |
| * |
| * \returns non-zero if the source locations refer to the same location, zero |
| * if they refer to different locations. |
| */ |
| CINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1, |
| CXSourceLocation loc2); |
| |
| /** |
| * Retrieves the source location associated with a given file/line/column |
| * in a particular translation unit. |
| */ |
| CINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu, |
| CXFile file, |
| unsigned line, |
| unsigned column); |
| /** |
| * Retrieves the source location associated with a given character offset |
| * in a particular translation unit. |
| */ |
| CINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu, |
| CXFile file, |
| unsigned offset); |
| |
| /** |
| * Returns non-zero if the given source location is in a system header. |
| */ |
| CINDEX_LINKAGE int clang_Location_isInSystemHeader(CXSourceLocation location); |
| |
| /** |
| * Returns non-zero if the given source location is in the main file of |
| * the corresponding translation unit. |
| */ |
| CINDEX_LINKAGE int clang_Location_isFromMainFile(CXSourceLocation location); |
| |
| /** |
| * Retrieve a NULL (invalid) source range. |
| */ |
| CINDEX_LINKAGE CXSourceRange clang_getNullRange(void); |
| |
| /** |
| * Retrieve a source range given the beginning and ending source |
| * locations. |
| */ |
| CINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin, |
| CXSourceLocation end); |
| |
| /** |
| * Determine whether two ranges are equivalent. |
| * |
| * \returns non-zero if the ranges are the same, zero if they differ. |
| */ |
| CINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1, |
| CXSourceRange range2); |
| |
| /** |
| * Returns non-zero if \p range is null. |
| */ |
| CINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range); |
| |
| /** |
| * Retrieve the file, line, column, and offset represented by |
| * the given source location. |
| * |
| * If the location refers into a macro expansion, retrieves the |
| * location of the macro expansion. |
| * |
| * \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_getExpansionLocation(CXSourceLocation location, |
| CXFile *file, |
| unsigned *line, |
| unsigned *column, |
| unsigned *offset); |
| |
| /** |
| * Retrieve the file, line and column represented by the given source |
| * location, as specified in a # line directive. |
| * |
| * Example: given the following source code in a file somefile.c |
| * |
| * \code |
| * #123 "dummy.c" 1 |
| * |
| * static int func(void) |
| * { |
| * return 0; |
| * } |
| * \endcode |
| * |
| * the location information returned by this function would be |
| * |
| * File: dummy.c Line: 124 Column: 12 |
| * |
| * whereas clang_getExpansionLocation would have returned |
| * |
| * File: somefile.c Line: 3 Column: 12 |
| * |
| * \param location the location within a source file that will be decomposed |
| * into its parts. |
| * |
| * \param filename [out] if non-NULL, will be set to the filename of the |
| * source location. Note that filenames returned will be for "virtual" files, |
| * which don't necessarily exist on the machine running clang - e.g. when |
| * parsing preprocessed output obtained from a different environment. If |
| * a non-NULL value is passed in, remember to dispose of the returned value |
| * using \c clang_disposeString() once you've finished with it. For an invalid |
| * source location, an empty string is returned. |
| * |
| * \param line [out] if non-NULL, will be set to the line number of the |
| * source location. For an invalid source location, zero is returned. |
| * |
| * \param column [out] if non-NULL, will be set to the column number of the |
| * source location. For an invalid source location, zero is returned. |
| */ |
| CINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location, |
| CXString *filename, |
| unsigned *line, |
| unsigned *column); |
| |
| /** |
| * Legacy API to retrieve the file, line, column, and offset represented |
| * by the given source location. |
| * |
| * This interface has been replaced by the newer interface |
| * #clang_getExpansionLocation(). See that interface's documentation for |
| * details. |
| */ |
| CINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location, |
| CXFile *file, |
| unsigned *line, |
| unsigned *column, |
| unsigned *offset); |
| |
| /** |
| * Retrieve the file, line, column, and offset represented by |
| * the given source location. |
| * |
| * If the location refers into a macro instantiation, return where the |
| * location was originally spelled in the source file. |
| * |
| * \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_getSpellingLocation(CXSourceLocation location, |
| CXFile *file, |
| unsigned *line, |
| unsigned *column, |
| unsigned *offset); |
| |
| /** |
| * 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); |
| |
| /** |
| * Retrieve a source location representing the first character within a |
| * source range. |
| */ |
| CINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range); |
| |
| /** |
| * Retrieve a source location representing the last character within a |
| * source range. |
| */ |
| CINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range); |
| |
| /** |
| * Identifies an array of ranges. |
| */ |
| typedef struct { |
| /** The number of ranges in the \c ranges array. */ |
| unsigned count; |
| /** |
| * An array of \c CXSourceRanges. |
| */ |
| CXSourceRange *ranges; |
| } CXSourceRangeList; |
| |
| /** |
| * Retrieve all ranges that were skipped by the preprocessor. |
| * |
| * The preprocessor will skip lines when they are surrounded by an |
| * if/ifdef/ifndef directive whose condition does not evaluate to true. |
| */ |
| CINDEX_LINKAGE CXSourceRangeList *clang_getSkippedRanges(CXTranslationUnit tu, |
| CXFile file); |
| |
| /** |
| * Retrieve all ranges from all files that were skipped by the |
| * preprocessor. |
| * |
| * The preprocessor will skip lines when they are surrounded by an |
| * if/ifdef/ifndef directive whose condition does not evaluate to true. |
| */ |
| CINDEX_LINKAGE CXSourceRangeList *clang_getAllSkippedRanges(CXTranslationUnit tu); |
| |
| /** |
| * Destroy the given \c CXSourceRangeList. |
| */ |
| CINDEX_LINKAGE void clang_disposeSourceRangeList(CXSourceRangeList *ranges); |
| |
| /** |
| * @} |
| */ |
| |
| /** |
| * \defgroup CINDEX_DIAG Diagnostic reporting |
| * |
| * @{ |
| */ |
| |
| /** |
| * Describes the severity of a particular diagnostic. |
| */ |
| enum CXDiagnosticSeverity { |
| /** |
| * A diagnostic that has been suppressed, e.g., by a command-line |
| * option. |
| */ |
| CXDiagnostic_Ignored = 0, |
| |
| /** |
| * This diagnostic is a note that should be attached to the |
| * previous (non-note) diagnostic. |
| */ |
| CXDiagnostic_Note = 1, |
| |
| /** |
| * This diagnostic indicates suspicious code that may not be |
| * wrong. |
| */ |
| CXDiagnostic_Warning = 2, |
| |
| /** |
| * This diagnostic indicates that the code is ill-formed. |
| */ |
| CXDiagnostic_Error = 3, |
| |
| /** |
| * This diagnostic indicates that the code is ill-formed such |
| * that future parser recovery is unlikely to produce useful |
| * results. |
| */ |
| CXDiagnostic_Fatal = 4 |
| }; |
| |
| /** |
| * A single diagnostic, containing the diagnostic's severity, |
| * location, text, source ranges, and fix-it hints. |
| */ |
| typedef void *CXDiagnostic; |
| |
| /** |
| * A group of CXDiagnostics. |
| */ |
| typedef void *CXDiagnosticSet; |
| |
| /** |
| * Determine the number of diagnostics in a CXDiagnosticSet. |
| */ |
| CINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags); |
| |
| /** |
| * Retrieve a diagnostic associated with the given CXDiagnosticSet. |
| * |
| * \param Diags the CXDiagnosticSet to query. |
| * \param Index the zero-based diagnostic number to retrieve. |
| * |
| * \returns the requested diagnostic. This diagnostic must be freed |
| * via a call to \c clang_disposeDiagnostic(). |
| */ |
| CINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags, |
| unsigned Index); |
| |
| /** |
| * Describes the kind of error that occurred (if any) in a call to |
| * \c clang_loadDiagnostics. |
| */ |
| enum CXLoadDiag_Error { |
| /** |
| * Indicates that no error occurred. |
| */ |
| CXLoadDiag_None = 0, |
| |
| /** |
| * Indicates that an unknown error occurred while attempting to |
| * deserialize diagnostics. |
| */ |
| CXLoadDiag_Unknown = 1, |
| |
| /** |
| * Indicates that the file containing the serialized diagnostics |
| * could not be opened. |
| */ |
| CXLoadDiag_CannotLoad = 2, |
| |
| /** |
| * Indicates that the serialized diagnostics file is invalid or |
| * corrupt. |
| */ |
| CXLoadDiag_InvalidFile = 3 |
| }; |
| |
| /** |
| * Deserialize a set of diagnostics from a Clang diagnostics bitcode |
| * file. |
| * |
| * \param file The name of the file to deserialize. |
| * \param error A pointer to a enum value recording if there was a problem |
| * deserializing the diagnostics. |
| * \param errorString A pointer to a CXString for recording the error string |
| * if the file was not successfully loaded. |
| * |
| * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise. These |
| * diagnostics should be released using clang_disposeDiagnosticSet(). |
| */ |
| CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file, |
| enum CXLoadDiag_Error *error, |
| CXString *errorString); |
| |
| /** |
| * Release a CXDiagnosticSet and all of its contained diagnostics. |
| */ |
| CINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags); |
| |
| /** |
| * Retrieve the child diagnostics of a CXDiagnostic. |
| * |
| * This CXDiagnosticSet does not need to be released by |
| * clang_disposeDiagnosticSet. |
| */ |
| CINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D); |
| |
| /** |
| * Determine the number of diagnostics produced for the given |
| * translation unit. |
| */ |
| CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit); |
| |
| /** |
| * Retrieve a diagnostic associated with the given translation unit. |
| * |
| * \param Unit the translation unit to query. |
| * \param Index the zero-based diagnostic number to retrieve. |
| * |
| * \returns the requested diagnostic. This diagnostic must be freed |
| * via a call to \c clang_disposeDiagnostic(). |
| */ |
| CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, |
| unsigned Index); |
| |
| /** |
| * Retrieve the complete set of diagnostics associated with a |
| * translation unit. |
| * |
| * \param Unit the translation unit to query. |
| */ |
| CINDEX_LINKAGE CXDiagnosticSet |
| clang_getDiagnosticSetFromTU(CXTranslationUnit Unit); |
| |
| /** |
| * Destroy a diagnostic. |
| */ |
| CINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic); |
| |
| /** |
| * Options to control the display of diagnostics. |
| * |
| * The values in this enum are meant to be combined to customize the |
| * behavior of \c clang_formatDiagnostic(). |
| */ |
| enum CXDiagnosticDisplayOptions { |
| /** |
| * Display the source-location information where the |
| * diagnostic was located. |
| * |
| * When set, diagnostics will be prefixed by the file, line, and |
| * (optionally) column to which the diagnostic refers. For example, |
| * |
| * \code |
| * test.c:28: warning: extra tokens at end of #endif directive |
| * \endcode |
| * |
| * This option corresponds to the clang flag \c -fshow-source-location. |
| */ |
| CXDiagnostic_DisplaySourceLocation = 0x01, |
| |
| /** |
| * If displaying the source-location information of the |
| * diagnostic, also include the column number. |
| * |
| * This option corresponds to the clang flag \c -fshow-column. |
| */ |
| CXDiagnostic_DisplayColumn = 0x02, |
| |
| /** |
| * If displaying the source-location information of the |
| * diagnostic, also include information about source ranges in a |
| * machine-parsable format. |
| * |
| * This option corresponds to the clang flag |
| * \c -fdiagnostics-print-source-range-info. |
| */ |
| CXDiagnostic_DisplaySourceRanges = 0x04, |
| |
| /** |
| * Display the option name associated with this diagnostic, if any. |
| * |
| * The option name displayed (e.g., -Wconversion) will be placed in brackets |
| * after the diagnostic text. This option corresponds to the clang flag |
| * \c -fdiagnostics-show-option. |
| */ |
| CXDiagnostic_DisplayOption = 0x08, |
| |
| /** |
| * Display the category number associated with this diagnostic, if any. |
| * |
| * The category number is displayed within brackets after the diagnostic text. |
| * This option corresponds to the clang flag |
| * \c -fdiagnostics-show-category=id. |
| */ |
| CXDiagnostic_DisplayCategoryId = 0x10, |
| |
| /** |
| * Display the category name associated with this diagnostic, if any. |
| * |
| * The category name is displayed within brackets after the diagnostic text. |
| * This option corresponds to the clang flag |
| * \c -fdiagnostics-show-category=name. |
| */ |
| CXDiagnostic_DisplayCategoryName = 0x20 |
| }; |
| |
| /** |
| * Format the given diagnostic in a manner that is suitable for display. |
| * |
| * This routine will format the given diagnostic to a string, rendering |
| * the diagnostic according to the various options given. The |
| * \c clang_defaultDiagnosticDisplayOptions() function returns the set of |
| * options that most closely mimics the behavior of the clang compiler. |
| * |
| * \param Diagnostic The diagnostic to print. |
| * |
| * \param Options A set of options that control the diagnostic display, |
| * created by combining \c CXDiagnosticDisplayOptions values. |
| * |
| * \returns A new string containing for formatted diagnostic. |
| */ |
| CINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, |
| unsigned Options); |
| |
| /** |
| * Retrieve the set of display options most similar to the |
| * default behavior of the clang compiler. |
| * |
| * \returns A set of display options suitable for use with \c |
| * clang_formatDiagnostic(). |
| */ |
| CINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void); |
| |
| /** |
| * Determine the severity of the given diagnostic. |
| */ |
| CINDEX_LINKAGE enum CXDiagnosticSeverity |
| clang_getDiagnosticSeverity(CXDiagnostic); |
| |
| /** |
| * Retrieve the source location of the given diagnostic. |
| * |
| * This location is where Clang would print the caret ('^') when |
| * displaying the diagnostic on the command line. |
| */ |
| CINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic); |
| |
| /** |
| * Retrieve the text of the given diagnostic. |
| */ |
| CINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic); |
| |
| /** |
| * Retrieve the name of the command-line option that enabled this |
| * diagnostic. |
| * |
| * \param Diag The diagnostic to be queried. |
| * |
| * \param Disable If non-NULL, will be set to the option that disables this |
| * diagnostic (if any). |
| * |
| * \returns A string that contains the command-line option used to enable this |
| * warning, such as "-Wconversion" or "-pedantic". |
| */ |
| CINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag, |
| CXString *Disable); |
| |
| /** |
| * Retrieve the category number for this diagnostic. |
| * |
| * Diagnostics can be categorized into groups along with other, related |
| * diagnostics (e.g., diagnostics under the same warning flag). This routine |
| * retrieves the category number for the given diagnostic. |
| * |
| * \returns The number of the category that contains this diagnostic, or zero |
| * if this diagnostic is uncategorized. |
| */ |
| CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic); |
| |
| /** |
| * Retrieve the name of a particular diagnostic category. This |
| * is now deprecated. Use clang_getDiagnosticCategoryText() |
| * instead. |
| * |
| * \param Category A diagnostic category number, as returned by |
| * \c clang_getDiagnosticCategory(). |
| * |
| * \returns The name of the given diagnostic category. |
| */ |
| CINDEX_DEPRECATED CINDEX_LINKAGE |
| CXString clang_getDiagnosticCategoryName(unsigned Category); |
| |
| /** |
| * Retrieve the diagnostic category text for a given diagnostic. |
| * |
| * \returns The text of the given diagnostic category. |
| */ |
| CINDEX_LINKAGE CXString clang_getDiagnosticCategoryText(CXDiagnostic); |
| |
| /** |
| * Determine the number of source ranges associated with the given |
| * diagnostic. |
| */ |
| CINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic); |
| |
| /** |
| * Retrieve a source range associated with the diagnostic. |
| * |
| * A diagnostic's source ranges highlight important elements in the source |
| * code. On the command line, Clang displays source ranges by |
| * underlining them with '~' characters. |
| * |
| * \param Diagnostic the diagnostic whose range is being extracted. |
| * |
| * \param Range the zero-based index specifying which range to |
| * |
| * \returns the requested source range. |
| */ |
| CINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic, |
| unsigned Range); |
| |
| /** |
| * Determine the number of fix-it hints associated with the |
| * given diagnostic. |
| */ |
| CINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic); |
| |
| /** |
| * Retrieve the replacement information for a given fix-it. |
| * |
| * Fix-its are described in terms of a source range whose contents |
| * should be replaced by a string. This approach generalizes over |
| * three kinds of operations: removal of source code (the range covers |
| * the code to be removed and the replacement string is empty), |
| * replacement of source code (the range covers the code to be |
| * replaced and the replacement string provides the new code), and |
| * insertion (both the start and end of the range point at the |
| * insertion location, and the replacement string provides the text to |
| * insert). |
| * |
| * \param Diagnostic The diagnostic whose fix-its are being queried. |
| * |
| * \param FixIt The zero-based index of the fix-it. |
| * |
| * \param ReplacementRange The source range whose contents will be |
| * replaced with the returned replacement string. Note that source |
| * ranges are half-open ranges [a, b), so the source code should be |
| * replaced from a and up to (but not including) b. |
| * |
| * \returns A string containing text that should be replace the source |
| * code indicated by the \c ReplacementRange. |
| */ |
| CINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic, |
| unsigned FixIt, |
| CXSourceRange *ReplacementRange); |
| |
| /** |
| * @} |
| */ |
| |
| /** |
| * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation |
| * |
| * The routines in this group provide the ability to create and destroy |
| * translation units from files, either by parsing the contents of the files or |
| * by reading in a serialized representation of a translation unit. |
| * |
| * @{ |
| */ |
| |
| /** |
| * Get the original translation unit source file name. |
| */ |
| CINDEX_LINKAGE CXString |
| clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit); |
| |
| /** |
| * Return the CXTranslationUnit for a given source file and the provided |
| * command line arguments one would pass to the compiler. |
| * |
| * Note: The 'source_filename' argument is optional. If the caller provides a |
| * NULL pointer, the name of the source file is expected to reside in the |
| * specified command line arguments. |
| * |
| * Note: When encountered in 'clang_command_line_args', the following options |
| * are ignored: |
| * |
| * '-c' |
| * '-emit-ast' |
| * '-fsyntax-only' |
| * '-o \<output file>' (both '-o' and '\<output file>' are ignored) |
| * |
| * \param CIdx The index object with which the translation unit will be |
| * associated. |
| * |
| * \param source_filename The name of the source file to load, or NULL if the |
| * source file is included in \p clang_command_line_args. |
| * |
| * \param num_clang_command_line_args The number of command-line arguments in |
| * \p clang_command_line_args. |
| * |
| * \param clang_command_line_args The command-line arguments that would be |
| * passed to the \c clang executable if it were being invoked out-of-process. |
| * These command-line options will be parsed and will affect how the translation |
| * unit is parsed. Note that the following options are ignored: '-c', |
| * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. |
| * |
| * \param num_unsaved_files the number of unsaved file entries in \p |
| * unsaved_files. |
| * |
| * \param unsaved_files the files that have not yet been saved to disk |
| * but may be required for code completion, including the contents of |
| * those files. The contents and name of these files (as specified by |
| * CXUnsavedFile) are copied when necessary, so the client only needs to |
| * guarantee their validity until the call to this function returns. |
| */ |
| CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile( |
| CXIndex CIdx, |
| const char *source_filename, |
| int num_clang_command_line_args, |
| const char * const *clang_command_line_args, |
| unsigned num_unsaved_files, |
| struct CXUnsavedFile *unsaved_files); |
| |
| /** |
| * Same as \c clang_createTranslationUnit2, but returns |
| * the \c CXTranslationUnit instead of an error code. In case of an error this |
| * routine returns a \c NULL \c CXTranslationUnit, without further detailed |
| * error codes. |
| */ |
| CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit( |
| CXIndex CIdx, |
| const char *ast_filename); |
| |
| /** |
| * Create a translation unit from an AST file (\c -emit-ast). |
| * |
| * \param[out] out_TU A non-NULL pointer to store the created |
| * \c CXTranslationUnit. |
| * |
| * \returns Zero on success, otherwise returns an error code. |
| */ |
| CINDEX_LINKAGE enum CXErrorCode clang_createTranslationUnit2( |
| CXIndex CIdx, |
| const char *ast_filename, |
| CXTranslationUnit *out_TU); |
| |
| /** |
| * Flags that control the creation of translation units. |
| * |
| * The enumerators in this enumeration type are meant to be bitwise |
| * ORed together to specify which options should be used when |
| * constructing the translation unit. |
| */ |
| enum CXTranslationUnit_Flags { |
| /** |
| * Used to indicate that no special translation-unit options are |
| * needed. |
| */ |
| CXTranslationUnit_None = 0x0, |
| |
| /** |
| * Used to indicate that the parser should construct a "detailed" |
| * preprocessing record, including all macro definitions and instantiations. |
| * |
| * Constructing a detailed preprocessing record requires more memory |
| * and time to parse, since the information contained in the record |
| * is usually not retained. However, it can be useful for |
| * applications that require more detailed information about the |
| * behavior of the preprocessor. |
| */ |
| CXTranslationUnit_DetailedPreprocessingRecord = 0x01, |
| |
| /** |
| * Used to indicate that the translation unit is incomplete. |
| * |
| * When a translation unit is considered "incomplete", semantic |
| * analysis that is typically performed at the end of the |
| * translation unit will be suppressed. For example, this suppresses |
| * the completion of tentative declarations in C and of |
| * instantiation of implicitly-instantiation function templates in |
| * C++. This option is typically used when parsing a header with the |
| * intent of producing a precompiled header. |
| */ |
| CXTranslationUnit_Incomplete = 0x02, |
| |
| /** |
| * Used to indicate that the translation unit should be built with an |
| * implicit precompiled header for the preamble. |
| * |
| * An implicit precompiled header is used as an optimization when a |
| * particular translation unit is likely to be reparsed many times |
| * when the sources aren't changing that often. In this case, an |
| * implicit precompiled header will be built containing all of the |
| * initial includes at the top of the main file (what we refer to as |
| * the "preamble" of the file). In subsequent parses, if the |
| * preamble or the files in it have not changed, \c |
| * clang_reparseTranslationUnit() will re-use the implicit |
| * precompiled header to improve parsing performance. |
| */ |
| CXTranslationUnit_PrecompiledPreamble = 0x04, |
| |
| /** |
| * Used to indicate that the translation unit should cache some |
| * code-completion results with each reparse of the source file. |
| * |
| * Caching of code-completion results is a performance optimization that |
| * introduces some overhead to reparsing but improves the performance of |
| * code-completion operations. |
| */ |
| CXTranslationUnit_CacheCompletionResults = 0x08, |
| |
| /** |
| * Used to indicate that the translation unit will be serialized with |
| * \c clang_saveTranslationUnit. |
| * |
| * This option is typically used when parsing a header with the intent of |
| * producing a precompiled header. |
| */ |
| CXTranslationUnit_ForSerialization = 0x10, |
| |
| /** |
| * DEPRECATED: Enabled chained precompiled preambles in C++. |
| * |
| * Note: this is a *temporary* option that is available only while |
| * we are testing C++ precompiled preamble support. It is deprecated. |
| */ |
| CXTranslationUnit_CXXChainedPCH = 0x20, |
| |
| /** |
| * Used to indicate that function/method bodies should be skipped while |
| * parsing. |
| * |
| * This option can be used to search for declarations/definitions while |
| * ignoring the usages. |
| */ |
| CXTranslationUnit_SkipFunctionBodies = 0x40, |
| |
| /** |
| * Used to indicate that brief documentation comments should be |
| * included into the set of code completions returned from this translation |
| * unit. |
| */ |
| CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 0x80, |
| |
| /** |
| * Used to indicate that the precompiled preamble should be created on |
| * the first parse. Otherwise it will be created on the first reparse. This |
| * trades runtime on the first parse (serializing the preamble takes time) for |
| * reduced runtime on the second parse (can now reuse the preamble). |
| */ |
| CXTranslationUnit_CreatePreambleOnFirstParse = 0x100, |
| |
| /** |
| * Do not stop processing when fatal errors are encountered. |
| * |
| * When fatal errors are encountered while parsing a translation unit, |
| * semantic analysis is typically stopped early when compiling code. A common |
| * source for fatal errors are unresolvable include files. For the |
| * purposes of an IDE, this is undesirable behavior and as much information |
| * as possible should be reported. Use this flag to enable this behavior. |
| */ |
| CXTranslationUnit_KeepGoing = 0x200, |
| |
| /** |
| * Sets the preprocessor in a mode for parsing a single file only. |
| */ |
| CXTranslationUnit_SingleFileParse = 0x400, |
| |
| /** |
| * Used in combination with CXTranslationUnit_SkipFunctionBodies to |
| * constrain the skipping of function bodies to the preamble. |
| * |
| * The function bodies of the main file are not skipped. |
| */ |
| CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 0x800, |
| |
| /** |
| * Used to indicate that attributed types should be included in CXType. |
| */ |
| CXTranslationUnit_IncludeAttributedTypes = 0x1000, |
| |
| /** |
| * Used to indicate that implicit attributes should be visited. |
| */ |
| CXTranslationUnit_VisitImplicitAttributes = 0x2000, |
| |
| /** |
| * Used to indicate that non-errors from included files should be ignored. |
| * |
| * If set, clang_getDiagnosticSetFromTU() will not report e.g. warnings from |
| * included files anymore. This speeds up clang_getDiagnosticSetFromTU() for |
| * the case where these warnings are not of interest, as for an IDE for |
| * example, which typically shows only the diagnostics in the main file. |
| */ |
| CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000, |
| |
| /** |
| * Tells the preprocessor not to skip excluded conditional blocks. |
| */ |
| CXTranslationUnit_RetainExcludedConditionalBlocks = 0x8000 |
| }; |
| |
| /** |
| * Returns the set of flags that is suitable for parsing a translation |
| * unit that is being edited. |
| * |
| * The set of flags returned provide options for \c clang_parseTranslationUnit() |
| * to indicate that the translation unit is likely to be reparsed many times, |
| * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly |
| * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag |
| * set contains an unspecified set of optimizations (e.g., the precompiled |
| * preamble) geared toward improving the performance of these routines. The |
| * set of optimizations enabled may change from one version to the next. |
| */ |
| CINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void); |
| |
| /** |
| * Same as \c clang_parseTranslationUnit2, but returns |
| * the \c CXTranslationUnit instead of an error code. In case of an error this |
| * routine returns a \c NULL \c CXTranslationUnit, without further detailed |
| * error codes. |
| */ |
| CINDEX_LINKAGE CXTranslationUnit |
| clang_parseTranslationUnit(CXIndex CIdx, |
| const char *source_filename, |
| const char *const *command_line_args, |
| int num_command_line_args, |
| struct CXUnsavedFile *unsaved_files, |
| unsigned num_unsaved_files, |
| unsigned options); |
| |
| /** |
| * Parse the given source file and the translation unit corresponding |
| * to that file. |
| * |
| * This routine is the main entry point for the Clang C API, providing the |
| * ability to parse a source file into a translation unit that can then be |
| * queried by other functions in the API. This routine accepts a set of |
| * command-line arguments so that the compilation can be configured in the same |
| * way that the compiler is configured on the command line. |
| * |
| * \param CIdx The index object with which the translation unit will be |
| * associated. |
| * |
| * \param source_filename The name of the source file to load, or NULL if the |
| * source file is included in \c command_line_args. |
| * |
| * \param command_line_args The command-line arguments that would be |
| * passed to the \c clang executable if it were being invoked out-of-process. |
| * These command-line options will be parsed and will affect how the translation |
| * unit is parsed. Note that the following options are ignored: '-c', |
| * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. |
| * |
| * \param num_command_line_args The number of command-line arguments in |
| * \c command_line_args. |
| * |
| * \param unsaved_files the files that have not yet been saved to disk |
| * but may be required for parsing, including the contents of |
| * those files. The contents and name of these files (as specified by |
| * CXUnsavedFile) are copied when necessary, so the client only needs to |
| * guarantee their validity until the call to this function returns. |
| * |
| * \param num_unsaved_files the number of unsaved file entries in \p |
| * unsaved_files. |
| * |
| * \param options A bitmask of options that affects how the translation unit |
| * is managed but not its compilation. This should be a bitwise OR of the |
| * CXTranslationUnit_XXX flags. |
| * |
| * \param[out] out_TU A non-NULL pointer to store the created |
| * \c CXTranslationUnit, describing the parsed code and containing any |
| * diagnostics produced by the compiler. |
| * |
| * \returns Zero on success, otherwise returns an error code. |
| */ |
| CINDEX_LINKAGE enum CXErrorCode |
| clang_parseTranslationUnit2(CXIndex CIdx, |
| const char *source_filename, |
| const char *const *command_line_args, |
| int num_command_line_args, |
| struct CXUnsavedFile *unsaved_files, |
| unsigned num_unsaved_files, |
| unsigned options, |
| CXTranslationUnit *out_TU); |
| |
| /** |
| * Same as clang_parseTranslationUnit2 but requires a full command line |
| * for \c command_line_args including argv[0]. This is useful if the standard |
| * library paths are relative to the binary. |
| */ |
| CINDEX_LINKAGE enum CXErrorCode clang_parseTranslationUnit2FullArgv( |
| CXIndex CIdx, const char *source_filename, |
| const char *const *command_line_args, int num_command_line_args, |
| struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files, |
| unsigned options, CXTranslationUnit *out_TU); |
| |
| /** |
| * Flags that control how translation units are saved. |
| * |
| * The enumerators in this enumeration type are meant to be bitwise |
| * ORed together to specify which options should be used when |
| * saving the translation unit. |
| */ |
| enum CXSaveTranslationUnit_Flags { |
| /** |
| * Used to indicate that no special saving options are needed. |
| */ |
| CXSaveTranslationUnit_None = 0x0 |
| }; |
| |
| /** |
| * Returns the set of flags that is suitable for saving a translation |
| * unit. |
| * |
| * The set of flags returned provide options for |
| * \c clang_saveTranslationUnit() by default. The returned flag |
| * set contains an unspecified set of options that save translation units with |
| * the most commonly-requested data. |
| */ |
| CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU); |
| |
| /** |
| * Describes the kind of error that occurred (if any) in a call to |
| * \c clang_saveTranslationUnit(). |
| */ |
| enum CXSaveError { |
| /** |
| * Indicates that no error occurred while saving a translation unit. |
| */ |
| CXSaveError_None = 0, |
| |
| /** |
| * Indicates that an unknown error occurred while attempting to save |
| * the file. |
| * |
| * This error typically indicates that file I/O failed when attempting to |
| * write the file. |
| */ |
| CXSaveError_Unknown = 1, |
| |
| /** |
| * Indicates that errors during translation prevented this attempt |
| * to save the translation unit. |
| * |
| * Errors that prevent the translation unit from being saved can be |
| * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic(). |
| */ |
| CXSaveError_TranslationErrors = 2, |
| |
| /** |
| * Indicates that the translation unit to be saved was somehow |
| * invalid (e.g., NULL). |
| */ |
| CXSaveError_InvalidTU = 3 |
| }; |
| |
| /** |
| * Saves a translation unit into a serialized representation of |
| * that translation unit on disk. |
| * |
| * Any translation unit that was parsed without error can be saved |
| * into a file. The translation unit can then be deserialized into a |
| * new \c CXTranslationUnit with \c clang_createTranslationUnit() or, |
| * if it is an incomplete translation unit that corresponds to a |
| * header, used as a precompiled header when parsing other translation |
| * units. |
| * |
| * \param TU The translation unit to save. |
| * |
| * \param FileName The file to which the translation unit will be saved. |
| * |
| * \param options A bitmask of options that affects how the translation unit |
| * is saved. This should be a bitwise OR of the |
| * CXSaveTranslationUnit_XXX flags. |
| * |
| * \returns A value that will match one of the enumerators of the CXSaveError |
| * enumeration. Zero (CXSaveError_None) indicates that the translation unit was |
| * saved successfully, while a non-zero value indicates that a problem occurred. |
| */ |
| CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU, |
| const char *FileName, |
| unsigned options); |
| |
| /** |
| * Suspend a translation unit in order to free memory associated with it. |
| * |
| * A suspended translation unit uses significantly less memory but on the other |
| * side does not support any other calls than \c clang_reparseTranslationUnit |
| * to resume it or \c clang_disposeTranslationUnit to dispose it completely. |
| */ |
| CINDEX_LINKAGE unsigned clang_suspendTranslationUnit(CXTranslationUnit); |
| |
| /** |
| * Destroy the specified CXTranslationUnit object. |
| */ |
| CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit); |
| |
| /** |
| * Flags that control the reparsing of translation units. |
| * |
| * The enumerators in this enumeration type are meant to be bitwise |
| * ORed together to specify which options should be used when |
| * reparsing the translation unit. |
| */ |
| enum CXReparse_Flags { |
| /** |
| * Used to indicate that no special reparsing options are needed. |
| */ |
| CXReparse_None = 0x0 |
| }; |
| |
| /** |
| * Returns the set of flags that is suitable for reparsing a translation |
| * unit. |
| * |
| * The set of flags returned provide options for |
| * \c clang_reparseTranslationUnit() by default. The returned flag |
| * set contains an unspecified set of optimizations geared toward common uses |
| * of reparsing. The set of optimizations enabled may change from one version |
| * to the next. |
| */ |
| CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU); |
| |
| /** |
| * Reparse the source files that produced this translation unit. |
| * |
| * This routine can be used to re-parse the source files that originally |
| * created the given translation unit, for example because those source files |
| * have changed (either on disk or as passed via \p unsaved_files). The |
| * source code will be reparsed with the same command-line options as it |
| * was originally parsed. |
| * |
| * Reparsing a translation unit invalidates all cursors and source locations |
| * that refer into that translation unit. This makes reparsing a translation |
| * unit semantically equivalent to destroying the translation unit and then |
| * creating a new translation unit with the same command-line arguments. |
| * However, it may be more efficient to reparse a translation |
| * unit using this routine. |
| * |
| * \param TU The translation unit whose contents will be re-parsed. The |
| * translation unit must originally have been built with |
| * \c clang_createTranslationUnitFromSourceFile(). |
| * |
| * \param num_unsaved_files The number of unsaved file entries in \p |
| * unsaved_files. |
| * |
| * \param unsaved_files The files that have not yet been saved to disk |
| * but may be required for parsing, including the contents of |
| * those files. The contents and name of these files (as specified by |
| * CXUnsavedFile) are copied when necessary, so the client only needs to |
| * guarantee their validity until the call to this function returns. |
| * |
| * \param options A bitset of options composed of the flags in CXReparse_Flags. |
| * The function \c clang_defaultReparseOptions() produces a default set of |
| * options recommended for most uses, based on the translation unit. |
| * |
| * \returns 0 if the sources could be reparsed. A non-zero error code will be |
| * returned if reparsing was impossible, such that the translation unit is |
| * invalid. In such cases, the only valid call for \c TU is |
| * \c clang_disposeTranslationUnit(TU). The error codes returned by this |
| * routine are described by the \c CXErrorCode enum. |
| */ |
| CINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU, |
| unsigned num_unsaved_files, |
| struct CXUnsavedFile *unsaved_files, |
| unsigned options); |
| |
| /** |
| * Categorizes how memory is being used by a translation unit. |
| */ |
| enum CXTUResourceUsageKind { |
| CXTUResourceUsage_AST = 1, |
| CXTUResourceUsage_Identifiers = 2, |
| CXTUResourceUsage_Selectors = 3, |
| CXTUResourceUsage_GlobalCompletionResults = 4, |
| CXTUResourceUsage_SourceManagerContentCache = 5, |
| CXTUResourceUsage_AST_SideTables = 6, |
| CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7, |
| CXTUResourceUsage_SourceManager_Membuffer_MMap = 8, |
| CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9, |
| CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10, |
| CXTUResourceUsage_Preprocessor = 11, |
| CXTUResourceUsage_PreprocessingRecord = 12, |
| CXTUResourceUsage_SourceManager_DataStructures = 13, |
| CXTUResourceUsage_Preprocessor_HeaderSearch = 14, |
| CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST, |
| CXTUResourceUsage_MEMORY_IN_BYTES_END = |
| CXTUResourceUsage_Preprocessor_HeaderSearch, |
| |
| CXTUResourceUsage_First = CXTUResourceUsage_AST, |
| CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch |
| }; |
| |
| /** |
| * Returns the human-readable null-terminated C string that represents |
| * the name of the memory category. This string should never be freed. |
| */ |
| CINDEX_LINKAGE |
| const char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind); |
| |
| typedef struct CXTUResourceUsageEntry { |
| /* The memory usage category. */ |
| enum CXTUResourceUsageKind kind; |
| /* Amount of resources used. |
| The units will depend on the resource kind. */ |
| unsigned long amount; |
| } CXTUResourceUsageEntry; |
| |
| /** |
| * The memory usage of a CXTranslationUnit, broken into categories. |
| */ |
| typedef struct CXTUResourceUsage { |
| /* Private data member, used for queries. */ |
| void *data; |
| |
| /* The number of entries in the 'entries' array. */ |
| unsigned numEntries; |
| |
| /* An array of key-value pairs, representing the breakdown of memory |
| usage. */ |
| CXTUResourceUsageEntry *entries; |
| |
| } CXTUResourceUsage; |
| |
| /** |
| * Return the memory usage of a translation unit. This object |
| * should be released with clang_disposeCXTUResourceUsage(). |
| */ |
| CINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU); |
| |
| CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage); |
| |
| /** |
| * Get target information for this translation unit. |
| * |
| * The CXTargetInfo object cannot outlive the CXTranslationUnit object. |
| */ |
| CINDEX_LINKAGE CXTargetInfo |
| clang_getTranslationUnitTargetInfo(CXTranslationUnit CTUnit); |
| |
| /** |
| * Destroy the CXTargetInfo object. |
| */ |
| CINDEX_LINKAGE void |
| clang_TargetInfo_dispose(CXTargetInfo Info); |
| |
| /** |
| * Get the normalized target triple as a string. |
| * |
| * Returns the empty string in case of any error. |
| */ |
| CINDEX_LINKAGE CXString |
| clang_TargetInfo_getTriple(CXTargetInfo Info); |
| |
| /** |
| * Get the pointer width of the target in bits. |
| * |
| * Returns -1 in case of error. |
| */ |
| CINDEX_LINKAGE int |
| clang_TargetInfo_getPointerWidth(CXTargetInfo Info); |
| |
| /** |
| * @} |
| */ |
| |
| /** |
| * Describes the kind of entity that a cursor refers to. |
| */ |
| enum CXCursorKind { |
| /* Declarations */ |
| /** |
| * A declaration whose specific kind is not exposed via this |
| * interface. |
| * |
| * Unexposed declarations have the same operations as any other kind |
| * of declaration; one can extract their location information, |
| * spelling, find their definitions, etc. However, the specific kind |
| * of the declaration is not reported. |
| */ |
| CXCursor_UnexposedDecl = 1, |
| /** A C or C++ struct. */ |
| CXCursor_StructDecl = 2, |
| /** A C or C++ union. */ |
| CXCursor_UnionDecl = 3, |
| /** A C++ class. */ |
| CXCursor_ClassDecl = 4, |
| /** An enumeration. */ |
| CXCursor_EnumDecl = 5, |
| /** |
| * A field (in C) or non-static data member (in C++) in a |
| * struct, union, or C++ class. |
| */ |
| CXCursor_FieldDecl = 6, |
| /** An enumerator constant. */ |
| CXCursor_EnumConstantDecl = 7, |
| /** A function. */ |
| CXCursor_FunctionDecl = 8, |
| /** A variable. */ |
| CXCursor_VarDecl = 9, |
| /** A function or method parameter. */ |
| CXCursor_ParmDecl = 10, |
| /** An Objective-C \@interface. */ |
| CXCursor_ObjCInterfaceDecl = 11, |
| /** An Objective-C \@interface for a category. */ |
| CXCursor_ObjCCategoryDecl = 12, |
| /** An Objective-C \@protocol declaration. */ |
| CXCursor_ObjCProtocolDecl = 13, |
| /** An Objective-C \@property declaration. */ |
| CXCursor_ObjCPropertyDecl = 14, |
| /** An Objective-C instance variable. */ |
| CXCursor_ObjCIvarDecl = 15, |
| /** An Objective-C instance method. */ |
| CXCursor_ObjCInstanceMethodDecl = 16, |
| /** An Objective-C class method. */ |
| CXCursor_ObjCClassMethodDecl = 17, |
| /** An Objective-C \@implementation. */ |
| CXCursor_ObjCImplementationDecl = 18, |
| /** An Objective-C \@implementation for a category. */ |
| CXCursor_ObjCCategoryImplDecl = 19, |
| /** A typedef. */ |
| CXCursor_TypedefDecl = 20, |
| /** A C++ class method. */ |
| CXCursor_CXXMethod = 21, |
| /** A C++ namespace. */ |
| CXCursor_Namespace = 22, |
| /** A linkage specification, e.g. 'extern "C"'. */ |
| CXCursor_LinkageSpec = 23, |
| /** A C++ constructor. */ |
| CXCursor_Constructor = 24, |
| /** A C++ destructor. */ |
| CXCursor_Destructor = 25, |
| /** A C++ conversion function. */ |
| CXCursor_ConversionFunction = 26, |
| /** A C++ template type parameter. */ |
| CXCursor_TemplateTypeParameter = 27, |
| /** A C++ non-type template parameter. */ |
| CXCursor_NonTypeTemplateParameter = 28, |
| /** A C++ template template parameter. */ |
| CXCursor_TemplateTemplateParameter = 29, |
| /** A C++ function template. */ |
| CXCursor_FunctionTemplate = 30, |
| /** A C++ class template. */ |
| CXCursor_ClassTemplate = 31, |
| /** A C++ class template partial specialization. */ |
| CXCursor_ClassTemplatePartialSpecialization = 32, |
| /** A C++ namespace alias declaration. */ |
| CXCursor_NamespaceAlias = 33, |
| /** A C++ using directive. */ |
| CXCursor_UsingDirective = 34, |
| /** A C++ using declaration. */ |
| CXCursor_UsingDeclaration = 35, |
| /** A C++ alias declaration */ |
| CXCursor_TypeAliasDecl = 36, |
| /** An Objective-C \@synthesize definition. */ |
| CXCursor_ObjCSynthesizeDecl = 37, |
| /** An Objective-C \@dynamic definition. */ |
| CXCursor_ObjCDynamicDecl = 38, |
| /** An access specifier. */ |
| CXCursor_CXXAccessSpecifier = 39, |
| |
| CXCursor_FirstDecl = CXCursor_UnexposedDecl, |
| CXCursor_LastDecl = CXCursor_CXXAccessSpecifier, |
| |
| /* References */ |
| CXCursor_FirstRef = 40, /* Decl references */ |
| CXCursor_ObjCSuperClassRef = 40, |
| CXCursor_ObjCProtocolRef = 41, |
| CXCursor_ObjCClassRef = 42, |
| /** |
| * A reference to a type declaration. |
| * |
| * A type reference occurs anywhere where a type is named but not |
| * declared. For example, given: |
| * |
| * \code |
| * typedef unsigned size_type; |
| * size_type size; |
| * \endcode |
| * |
| * The typedef is a declaration of size_type (CXCursor_TypedefDecl), |
| * while the type of the variable "size" is referenced. The cursor |
| * referenced by the type of size is the typedef for size_type. |
| */ |
| CXCursor_TypeRef = 43, |
| CXCursor_CXXBaseSpecifier = 44, |
| /** |
| * A reference to a class template, function template, template |
| * template parameter, or class template partial specialization. |
| */ |
| CXCursor_TemplateRef = 45, |
| /** |
| * A reference to a namespace or namespace alias. |
| */ |
| CXCursor_NamespaceRef = 46, |
| /** |
| * A reference to a member of a struct, union, or class that occurs in |
| * some non-expression context, e.g., a designated initializer. |
| */ |
| CXCursor_MemberRef = 47, |
| /** |
| * A reference to a labeled statement. |
| * |
| * This cursor kind is used to describe the jump to "start_over" in the |
| * goto statement in the following example: |
| * |
| * \code |
| * start_over: |
| * ++counter; |
| * |
| * goto start_over; |
| * \endcode |
| * |
| * A label reference cursor refers to a label statement. |
| */ |
| CXCursor_LabelRef = 48, |
| |
| /** |
| * A reference to a set of overloaded functions or function templates |
| * that has not yet been resolved to a specific function or function template. |
| * |
| * An overloaded declaration reference cursor occurs in C++ templates where |
| * a dependent name refers to a function. For example: |
| * |
| * \code |
| * template<typename T> void swap(T&, T&); |
| * |
| * struct X { ... }; |
| * void swap(X&, X&); |
| * |
| * template<typename T> |
| * void reverse(T* first, T* last) { |
| * while (first < last - 1) { |
| * swap(*first, *--last); |
| * ++first; |
| * } |
| * } |
| * |
| * struct Y { }; |
| * void swap(Y&, Y&); |
| * \endcode |
| * |
| * Here, the identifier "swap" is associated with an overloaded declaration |
| * reference. In the template definition, "swap" refers to either of the two |
| * "swap" functions declared above, so both results will be available. At |
| * instantiation time, "swap" may also refer to other functions found via |
| * argument-dependent lookup (e.g., the "swap" function at the end of the |
| * example). |
| * |
| * The functions \c clang_getNumOverloadedDecls() and |
| * \c clang_getOverloadedDecl() can be used to retrieve the definitions |
| * referenced by this cursor. |
| */ |
| CXCursor_OverloadedDeclRef = 49, |
| |
| /** |
| * A reference to a variable that occurs in some non-expression |
| * context, e.g., a C++ lambda capture list. |
| */ |
| CXCursor_VariableRef = 50, |
| |
| CXCursor_LastRef = CXCursor_VariableRef, |
| |
| /* Error conditions */ |
| CXCursor_FirstInvalid = 70, |
| CXCursor_InvalidFile = 70, |
| CXCursor_NoDeclFound = 71, |
| CXCursor_NotImplemented = 72, |
| CXCursor_InvalidCode = 73, |
| CXCursor_LastInvalid = CXCursor_InvalidCode, |
| |
| /* Expressions */ |
| CXCursor_FirstExpr = 100, |
| |
| /** |
| * An expression whose specific kind is not exposed via this |
| * interface. |
| * |
| * Unexposed expressions have the same operations as any other kind |
| * of expression; one can extract their location information, |
| * spelling, children, etc. However, the specific kind of the |
| * expression is not reported. |
| */ |
| CXCursor_UnexposedExpr = 100, |
| |
| /** |
| * An expression that refers to some value declaration, such |
| * as a function, variable, or enumerator. |
| */ |
| CXCursor_DeclRefExpr = 101, |
| |
| /** |
| * An expression that refers to a member of a struct, union, |
| * class, Objective-C class, etc. |
| */ |
| CXCursor_MemberRefExpr = 102, |
| |
| /** An expression that calls a function. */ |
| CXCursor_CallExpr = 103, |
| |
| /** An expression that sends a message to an Objective-C |
| object or class. */ |
| CXCursor_ObjCMessageExpr = 104, |
| |
| /** An expression that represents a block literal. */ |
| CXCursor_BlockExpr = 105, |
| |
| /** An integer literal. |
| */ |
| CXCursor_IntegerLiteral = 106, |
| |
| /** A floating point number literal. |
| */ |
| CXCursor_FloatingLiteral = 107, |
| |
| /** An imaginary number literal. |
| */ |
| CXCursor_ImaginaryLiteral = 108, |
| |
| /** A string literal. |
| */ |
| CXCursor_StringLiteral = 109, |
| |
| /** A character literal. |
| */ |
| CXCursor_CharacterLiteral = 110, |
| |
| /** A parenthesized expression, e.g. "(1)". |
| * |
| * This AST node is only formed if full location information is requested. |
| */ |
| CXCursor_ParenExpr = 111, |
| |
| /** This represents the unary-expression's (except sizeof and |
| * alignof). |
| */ |
| CXCursor_UnaryOperator = 112, |
| |
| /** [C99 6.5.2.1] Array Subscripting. |
| */ |
| CXCursor_ArraySubscriptExpr = 113, |
| |
| /** A builtin binary operation expression such as "x + y" or |
| * "x <= y". |
| */ |
| CXCursor_BinaryOperator = 114, |
| |
| /** Compound assignment such as "+=". |
| */ |
| CXCursor_CompoundAssignOperator = 115, |
| |
| /** The ?: ternary operator. |
| */ |
| CXCursor_ConditionalOperator = 116, |
| |
| /** An explicit cast in C (C99 6.5.4) or a C-style cast in C++ |
| * (C++ [expr.cast]), which uses the syntax (Type)expr. |
| * |
| * For example: (int)f. |
| */ |
| CXCursor_CStyleCastExpr = 117, |
| |
| /** [C99 6.5.2.5] |
| */ |
| CXCursor_CompoundLiteralExpr = 118, |
| |
| /** Describes an C or C++ initializer list. |
| */ |
| CXCursor_InitListExpr = 119, |
| |
| /** The GNU address of label extension, representing &&label. |
| */ |
| CXCursor_AddrLabelExpr = 120, |
| |
| /** This is the GNU Statement Expression extension: ({int X=4; X;}) |
| */ |
| CXCursor_StmtExpr = 121, |
| |
| /** Represents a C11 generic selection. |
| */ |
| CXCursor_GenericSelectionExpr = 122, |
| |
| /** Implements the GNU __null extension, which is a name for a null |
| * pointer constant that has integral type (e.g., int or long) and is the same |
| * size and alignment as a pointer. |
| * |
| * The __null extension is typically only used by system headers, which define |
| * NULL as __null in C++ rather than using 0 (which is an integer that may not |
| * match the size of a pointer). |
| */ |
| CXCursor_GNUNullExpr = 123, |
| |
| /** C++'s static_cast<> expression. |
| */ |
| CXCursor_CXXStaticCastExpr = 124, |
| |
| /** C++'s dynamic_cast<> expression. |
| */ |
| CXCursor_CXXDynamicCastExpr = 125, |
| |
| /** C++'s reinterpret_cast<> expression. |
| */ |
| CXCursor_CXXReinterpretCastExpr = 126, |
| |
| /** C++'s const_cast<> expression. |
| */ |
| CXCursor_CXXConstCastExpr = 127, |
| |
| /** Represents an explicit C++ type conversion that uses "functional" |
| * notion (C++ [expr.type.conv]). |
| * |
| * Example: |
| * \code |
| * x = int(0.5); |
| * \endcode |
| */ |
| CXCursor_CXXFunctionalCastExpr = 128, |
| |
| /** A C++ typeid expression (C++ [expr.typeid]). |
| */ |
| CXCursor_CXXTypeidExpr = 129, |
| |
| /** [C++ 2.13.5] C++ Boolean Literal. |
| */ |
| CXCursor_CXXBoolLiteralExpr = 130, |
| |
| /** [C++0x 2.14.7] C++ Pointer Literal. |
| */ |
| CXCursor_CXXNullPtrLiteralExpr = 131, |
| |
| /** Represents the "this" expression in C++ |
| */ |
| CXCursor_CXXThisExpr = 132, |
| |
| /** [C++ 15] C++ Throw Expression. |
| * |
| * This handles 'throw' and 'throw' assignment-expression. When |
| * assignment-expression isn't present, Op will be null. |
| */ |
| CXCursor_CXXThrowExpr = 133, |
| |
| /** A new expression for memory allocation and constructor calls, e.g: |
| * "new CXXNewExpr(foo)". |
| */ |
| CXCursor_CXXNewExpr = 134, |
| |
| /** A delete expression for memory deallocation and destructor calls, |
| * e.g. "delete[] pArray". |
| */ |
| CXCursor_CXXDeleteExpr = 135, |
| |
| /** A unary expression. (noexcept, sizeof, or other traits) |
| */ |
| CXCursor_UnaryExpr = 136, |
| |
| /** An Objective-C string literal i.e. @"foo". |
| */ |
| CXCursor_ObjCStringLiteral = 137, |
| |
| /** An Objective-C \@encode expression. |
| */ |
| CXCursor_ObjCEncodeExpr = 138, |
| |
| /** An Objective-C \@selector expression. |
| */ |
| CXCursor_ObjCSelectorExpr = 139, |
| |
| /** An Objective-C \@protocol expression. |
| */ |
| CXCursor_ObjCProtocolExpr = 140, |
| |
| /** An Objective-C "bridged" cast expression, which casts between |
| * Objective-C pointers and C pointers, transferring ownership in the process. |
| * |
| * \code |
| * NSString *str = (__bridge_transfer NSString *)CFCreateString(); |
| * \endcode |
| */ |
| CXCursor_ObjCBridgedCastExpr = 141, |
| |
| /** Represents a C++0x pack expansion that produces a sequence of |
| * expressions. |
| * |
| * A pack expansion expression contains a pattern (which itself is an |
| * expression) followed by an ellipsis. For example: |
| * |
| * \code |
| * template<typename F, typename ...Types> |
| * void forward(F f, Types &&...args) { |
| * f(static_cast<Types&&>(args)...); |
| * } |
| * \endcode |
| */ |
| CXCursor_PackExpansionExpr = 142, |
| |
| /** Represents an expression that computes the length of a parameter |
| * pack. |
| * |
| * \code |
| * template<typename ...Types> |
| * struct count { |
| * static const unsigned value = sizeof...(Types); |
| * }; |
| * \endcode |
| */ |
| CXCursor_SizeOfPackExpr = 143, |
| |
| /* Represents a C++ lambda expression that produces a local function |
| * object. |
| * |
| * \code |
| * void abssort(float *x, unsigned N) { |
| * std::sort(x, x + N, |
| * [](float a, float b) { |
| * return std::abs(a) < std::abs(b); |
| * }); |
| * } |
| * \endcode |
| */ |
| CXCursor_LambdaExpr = 144, |
| |
| /** Objective-c Boolean Literal. |
| */ |
| CXCursor_ObjCBoolLiteralExpr = 145, |
| |
| /** Represents the "self" expression in an Objective-C method. |
| */ |
| CXCursor_ObjCSelfExpr = 146, |
| |
| /** OpenMP 4.0 [2.4, Array Section]. |
| */ |
| CXCursor_OMPArraySectionExpr = 147, |
| |
| /** Represents an @available(...) check. |
| */ |
| CXCursor_ObjCAvailabilityCheckExpr = 148, |
| |
| /** |
| * Fixed point literal |
| */ |
| CXCursor_FixedPointLiteral = 149, |
| |
| CXCursor_LastExpr = CXCursor_FixedPointLiteral, |
| |
| /* Statements */ |
| CXCursor_FirstStmt = 200, |
| /** |
| * A statement whose specific kind is not exposed via this |
| * interface. |
| * |
| * Unexposed statements have the same operations as any other kind of |
| * statement; one can extract their location information, spelling, |
| * children, etc. However, the specific kind of the statement is not |
| * reported. |
| */ |
| CXCursor_UnexposedStmt = 200, |
| |
| /** A labelled statement in a function. |
| * |
| * This cursor kind is used to describe the "start_over:" label statement in |
| * the following example: |
| * |
| * \code |
| * start_over: |
| * ++counter; |
| * \endcode |
| * |
| */ |
| CXCursor_LabelStmt = 201, |
| |
| /** A group of statements like { stmt stmt }. |
| * |
| * This cursor kind is used to describe compound statements, e.g. function |
| * bodies. |
| */ |
| CXCursor_CompoundStmt = 202, |
| |
| /** A case statement. |
| */ |
| CXCursor_CaseStmt = 203, |
| |
| /** A default statement. |
| */ |
| CXCursor_DefaultStmt = 204, |
| |
| /** An if statement |
| */ |
| CXCursor_IfStmt = 205, |
| |
| /** A switch statement. |
| */ |
| CXCursor_SwitchStmt = 206, |
| |
| /** A while statement. |
| */ |
| CXCursor_WhileStmt = 207, |
| |
| /** A do statement. |
| */ |
| CXCursor_DoStmt = 208, |
| |
| /** A for statement. |
| */ |
| CXCursor_ForStmt = 209, |
| |
| /** A goto statement. |
| */ |
| CXCursor_GotoStmt = 210, |
| |
| /** An indirect goto statement. |
| */ |
| CXCursor_IndirectGotoStmt = 211, |
| |
| /** A continue statement. |
| */ |
| CXCursor_ContinueStmt = 212, |
| |
| /** A break statement. |
| */ |
| CXCursor_BreakStmt = 213, |
| |
| /** A return statement. |
| */ |
| CXCursor_ReturnStmt = 214, |
| |
| /** A GCC inline assembly statement extension. |
| */ |
| CXCursor_GCCAsmStmt = 215, |
| CXCursor_AsmStmt = CXCursor_GCCAsmStmt, |
| |
| /** Objective-C's overall \@try-\@catch-\@finally statement. |
| */ |
| CXCursor_ObjCAtTryStmt = 216, |
| |
| /** Objective-C's \@catch statement. |
| */ |
| CXCursor_ObjCAtCatchStmt = 217, |
| |
| /** Objective-C's \@finally statement. |
| */ |
| CXCursor_ObjCAtFinallyStmt = 218, |
| |
| /** Objective-C's \@throw statement. |
| */ |
| CXCursor_ObjCAtThrowStmt = 219, |
| |
| /** Objective-C's \@synchronized statement. |
| */ |
| CXCursor_ObjCAtSynchronizedStmt = 220, |
| |
| /** Objective-C's autorelease pool statement. |
| */ |
| CXCursor_ObjCAutoreleasePoolStmt = 221, |
| |
| /** Objective-C's collection statement. |
| */ |
| CXCursor_ObjCForCollectionStmt = 222, |
| |
| /** C++'s catch statement. |
| */ |
| CXCursor_CXXCatchStmt = 223, |
| |
| /** C++'s try statement. |
| */ |
| CXCursor_CXXTryStmt = 224, |
| |
| /** C++'s for (* : *) statement. |
| */ |
| CXCursor_CXXForRangeStmt = 225, |
| |
| /** Windows Structured Exception Handling's try statement. |
| */ |
| CXCursor_SEHTryStmt = 226, |
| |
| /** Windows Structured Exception Handling's except statement. |
| */ |
| CXCursor_SEHExceptStmt = 227, |
| |
| /** Windows Structured Exception Handling's finally statement. |
| */ |
| CXCursor_SEHFinallyStmt = 228, |
| |
| /** A MS inline assembly statement extension. |
| */ |
| CXCursor_MSAsmStmt = 229, |
| |
| /** The null statement ";": C99 6.8.3p3. |
| * |
| * This cursor kind is used to describe the null statement. |
| */ |
| CXCursor_NullStmt = 230, |
| |
| /** Adaptor class for mixing declarations with statements and |
| * expressions. |
| */ |
| CXCursor_DeclStmt = 231, |
| |
| /** OpenMP parallel directive. |
| */ |
| CXCursor_OMPParallelDirective = 232, |
| |
| /** OpenMP SIMD directive. |
| */ |
| CXCursor_OMPSimdDirective = 233, |
| |
| /** OpenMP for directive. |
| */ |
| CXCursor_OMPForDirective = 234, |
| |
| /** OpenMP sections directive. |
| */ |
| CXCursor_OMPSectionsDirective = 235, |
| |
| /** OpenMP section directive. |
| */ |
| CXCursor_OMPSectionDirective = 236, |
| |
| /** OpenMP single directive. |
| */ |
| CXCursor_OMPSingleDirective = 237, |
| |
| /** OpenMP parallel for directive. |
| */ |
| CXCursor_OMPParallelForDirective = 238, |
| |
| /** OpenMP parallel sections directive. |
| */ |
| CXCursor_OMPParallelSectionsDirective = 239, |
| |
| /** OpenMP task directive. |
| */ |
| CXCursor_OMPTaskDirective = 240, |
| |
| /** OpenMP master directive. |
| */ |
| CXCursor_OMPMasterDirective = 241, |
| |
| /** OpenMP critical directive. |
| */ |
| CXCursor_OMPCriticalDirective = 242, |
| |
| /** OpenMP taskyield directive. |
| */ |
| CXCursor_OMPTaskyieldDirective = 243, |
| |
| /** OpenMP barrier directive. |
| */ |
| CXCursor_OMPBarrierDirective = 244, |
| |
| /** OpenMP taskwait directive. |
| */ |
| CXCursor_OMPTaskwaitDirective = 245, |
| |
| /** OpenMP flush directive. |
| */ |
| CXCursor_OMPFlushDirective = 246, |
| |
| /** Windows Structured Exception Handling's leave statement. |
| */ |
| CXCursor_SEHLeaveStmt = 247, |
| |
| /** OpenMP ordered directive. |
| */ |
| CXCursor_OMPOrderedDirective = 248, |
| |
| /** OpenMP atomic directive. |
| */ |
| CXCursor_OMPAtomicDirective = 249, |
| |
| /** OpenMP for SIMD directive. |
| */ |
| CXCursor_OMPForSimdDirective = 250, |
| |
| /** OpenMP parallel for SIMD directive. |
| */ |
| CXCursor_OMPParallelForSimdDirective = 251, |
| |
| /** OpenMP target directive. |
| */ |
| CXCursor_OMPTargetDirective = 252, |
| |
| /** OpenMP teams directive. |
| */ |
| CXCursor_OMPTeamsDirective = 253, |
| |
| /** OpenMP taskgroup directive. |
| */ |
| CXCursor_OMPTaskgroupDirective = 254, |
| |
| /** OpenMP cancellation point directive. |
| */ |
| CXCursor_OMPCancellationPointDirective = 255, |
| |
| /** OpenMP cancel directive. |
| */ |
| CXCursor_OMPCancelDirective = 256, |
| |
| /** OpenMP target data directive. |
| */ |
| CXCursor_OMPTargetDataDirective = 257, |
| |
| /** OpenMP taskloop directive. |
| */ |
| CXCursor_OMPTaskLoopDirective = 258, |
| |
| /** OpenMP taskloop simd directive. |
| */ |
| CXCursor_OMPTaskLoopSimdDirective = 259, |
| |
| /** OpenMP distribute directive. |
| */ |
| CXCursor_OMPDistributeDirective = 260, |
| |
| /** OpenMP target enter data directive. |
| */ |
| CXCursor_OMPTargetEnterDataDirective = 261, |
| |
| /** OpenMP target exit data directive. |
| */ |
| CXCursor_OMPTargetExitDataDirective = 262, |
| |
| /** OpenMP target parallel directive. |
| */ |
| CXCursor_OMPTargetParallelDirective = 263, |
| |
| /** OpenMP target parallel for directive. |
| */ |
| CXCursor_OMPTargetParallelForDirective = 264, |
| |
| /** OpenMP target update directive. |
| */ |
| CXCursor_OMPTargetUpdateDirective = 265, |
| |
| /** OpenMP distribute parallel for directive. |
| */ |
| CXCursor_OMPDistributeParallelForDirective = 266, |
| |
| /** OpenMP distribute parallel for simd directive. |
| */ |
| CXCursor_OMPDistributeParallelForSimdDirective = 267, |
| |
| /** OpenMP distribute simd directive. |
| */ |
| CXCursor_OMPDistributeSimdDirective = 268, |
| |
| /** OpenMP target parallel for simd directive. |
| */ |
| CXCursor_OMPTargetParallelForSimdDirective = 269, |
| |
| /** OpenMP target simd directive. |
| */ |
| CXCursor_OMPTargetSimdDirective = 270, |
| |
| /** OpenMP teams distribute directive. |
| */ |
| CXCursor_OMPTeamsDistributeDirective = 271, |
| |
| /** OpenMP teams distribute simd directive. |
| */ |
| CXCursor_OMPTeamsDistributeSimdDirective = 272, |
| |
| /** OpenMP teams distribute parallel for simd directive. |
| */ |
| CXCursor_OMPTeamsDistributeParallelForSimdDirective = 273, |
| |
| /** OpenMP teams distribute parallel for directive. |
| */ |
| CXCursor_OMPTeamsDistributeParallelForDirective = 274, |
| |
| /** OpenMP target teams directive. |
| */ |
| CXCursor_OMPTargetTeamsDirective = 275, |
| |
| /** OpenMP target teams distribute directive. |
| */ |
| CXCursor_OMPTargetTeamsDistributeDirective = 276, |
| |
| /** OpenMP target teams distribute parallel for directive. |
| */ |
| CXCursor_OMPTargetTeamsDistributeParallelForDirective = 277, |
| |
| /** OpenMP target teams distribute parallel for simd directive. |
| */ |
| CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective = 278, |
| |
| /** OpenMP target teams distribute simd directive. |
| */ |
| CXCursor_OMPTargetTeamsDistributeSimdDirective = 279, |
| |
| /** C++2a std::bit_cast expression. |
| */ |
| CXCursor_BuiltinBitCastExpr = 280, |
| |
| /** OpenMP master taskloop directive. |
| */ |
| CXCursor_OMPMasterTaskLoopDirective = 281, |
| |
| /** OpenMP parallel master taskloop directive. |
| */ |
| CXCursor_OMPParallelMasterTaskLoopDirective = 282, |
| |
| CXCursor_LastStmt = CXCursor_OMPParallelMasterTaskLoopDirective, |
| |
| /** |
| * Cursor that represents the translation unit itself. |
| * |
| * The translation unit cursor exists primarily to act as the root |
| * cursor for traversing the contents of a translation unit. |
| */ |
| CXCursor_TranslationUnit = 300, |
| |
| /* Attributes */ |
| CXCursor_FirstAttr = 400, |
| /** |
| * An attribute whose specific kind is not exposed via this |
| * interface. |
| */ |
| CXCursor_UnexposedAttr = 400, |
| |
| CXCursor_IBActionAttr = 401, |
| CXCursor_IBOutletAttr = 402, |
| CXCursor_IBOutletCollectionAttr = 403, |
| CXCursor_CXXFinalAttr = 404, |
| CXCursor_CXXOverrideAttr = 405, |
| CXCursor_AnnotateAttr = 406, |
| CXCursor_AsmLabelAttr = 407, |
| CXCursor_PackedAttr = 408, |
| CXCursor_PureAttr = 409, |
| CXCursor_ConstAttr = 410, |
| CXCursor_NoDuplicateAttr = 411, |
| CXCursor_CUDAConstantAttr = 412, |
| CXCursor_CUDADeviceAttr = 413, |
| CXCursor_CUDAGlobalAttr = 414, |
| CXCursor_CUDAHostAttr = 415, |
| CXCursor_CUDASharedAttr = 416, |
| CXCursor_VisibilityAttr = 417, |
| CXCursor_DLLExport = 418, |
| CXCursor_DLLImport = 419, |
| CXCursor_NSReturnsRetained = 420, |
| CXCursor_NSReturnsNotRetained = 421, |
| CXCursor_NSReturnsAutoreleased = 422, |
| CXCursor_NSConsumesSelf = 423, |
| CXCursor_NSConsumed = 424, |
| CXCursor_ObjCException = 425, |
| CXCursor_ObjCNSObject = 426, |
| CXCursor_ObjCIndependentClass = 427, |
| CXCursor_ObjCPreciseLifetime = 428, |
| CXCursor_ObjCReturnsInnerPointer = 429, |
| CXCursor_ObjCRequiresSuper = 430, |
| CXCursor_ObjCRootClass = 431, |
| CXCursor_ObjCSubclassingRestricted = 432, |
| CXCursor_ObjCExplicitProtocolImpl = 433, |
| CXCursor_ObjCDesignatedInitializer = 434, |
| CXCursor_ObjCRuntimeVisible = 435, |
| CXCursor_ObjCBoxable = 436, |
| CXCursor_FlagEnum = 437, |
| CXCursor_ConvergentAttr = 438, |
| CXCursor_WarnUnusedAttr = 439, |
| CXCursor_WarnUnusedResultAttr = 440, |
| CXCursor_AlignedAttr = 441, |
| CXCursor_LastAttr = CXCursor_AlignedAttr, |
| |
| /* Preprocessing */ |
| CXCursor_PreprocessingDirective = 500, |
| CXCursor_MacroDefinition = 501, |
| CXCursor_MacroExpansion = 502, |
| CXCursor_MacroInstantiation = CXCursor_MacroExpansion, |
| CXCursor_InclusionDirective = 503, |
| CXCursor_FirstPreprocessing = CXCursor_PreprocessingDirective, |
| CXCursor_LastPreprocessing = CXCursor_InclusionDirective, |
| |
| /* Extra Declarations */ |
| /** |
| * A module import declaration. |
| */ |
| CXCursor_ModuleImportDecl = 600, |
| CXCursor_TypeAliasTemplateDecl = 601, |
| /** |
| * A static_assert or _Static_assert node |
| */ |
| CXCursor_StaticAssert = 602, |
| /** |
| * a friend declaration. |
| */ |
| CXCursor_FriendDecl = 603, |
| CXCursor_FirstExtraDecl = CXCursor_ModuleImportDecl, |
| CXCursor_LastExtraDecl = CXCursor_FriendDecl, |
| |
| /** |
| * A code completion overload candidate. |
| */ |
| CXCursor_OverloadCandidate = 700 |
| }; |
| |
| /** |
| * A cursor representing some element in the abstract syntax tree for |
| * a translation unit. |
| * |
| * The cursor abstraction unifies the different kinds of entities in a |
| * program--declaration, statements, expressions, references to declarations, |
| * etc.--under a single "cursor" abstraction with a common set of operations. |
| * Common operation for a cursor include: getting the physical location in |
| * a source file where the cursor points, getting the name associated with a |
| * cursor, and retrieving cursors for any child nodes of a particular cursor. |
| * |
| * Cursors can be produced in two specific ways. |
| * clang_getTranslationUnitCursor() produces a cursor for a translation unit, |
| * from which one can use clang_visitChildren() to explore the rest of the |
| * translation unit. clang_getCursor() maps from a physical source location |
| * to the entity that resides at that location, allowing one to map from the |
| * source code into the AST. |
| */ |
| typedef struct { |
| enum CXCursorKind kind; |
| int xdata; |
| const void *data[3]; |
| } CXCursor; |
| |
| /** |
| * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations |
| * |
| * @{ |
| */ |
| |
| /** |
| * Retrieve the NULL cursor, which represents no entity. |
| */ |
| CINDEX_LINKAGE CXCursor clang_getNullCursor(void); |
| |
| /** |
| * Retrieve the cursor that represents the given translation unit. |
| * |
| * The translation unit cursor can be used to start traversing the |
| * various declarations within the given translation unit. |
| */ |
| CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit); |
| |
| /** |
| * Determine whether two cursors are equivalent. |
| */ |
| CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor); |
| |
| /** |
| * Returns non-zero if \p cursor is null. |
| */ |
| CINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor); |
| |
| /** |
| * Compute a hash value for the given cursor. |
| */ |
| CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor); |
| |
| /** |
| * Retrieve the kind of the given cursor. |
| */ |
| CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor); |
| |
| /** |
| * Determine whether the given cursor kind represents a declaration. |
| */ |
| CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind); |
| |
| /** |
| * Determine whether the given declaration is invalid. |
| * |
| * A declaration is invalid if it could not be parsed successfully. |
| * |
| * \returns non-zero if the cursor represents a declaration and it is |
| * invalid, otherwise NULL. |
| */ |
| CINDEX_LINKAGE unsigned clang_isInvalidDeclaration(CXCursor); |
| |
| /** |
| * Determine whether the given cursor kind represents a simple |
| * reference. |
| * |
| * Note that other kinds of cursors (such as expressions) can also refer to |
| * other cursors. Use clang_getCursorReferenced() to determine whether a |
| * particular cursor refers to another entity. |
| */ |
| CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind); |
| |
| /** |
| * Determine whether the given cursor kind represents an expression. |
| */ |
| CINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind); |
| |
| /** |
| * Determine whether the given cursor kind represents a statement. |
| */ |
| CINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind); |
| |
| /** |
| * Determine whether the given cursor kind represents an attribute. |
| */ |
| CINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind); |
| |
| /** |
| * Determine whether the given cursor has any attributes. |
| */ |
| CINDEX_LINKAGE unsigned clang_Cursor_hasAttrs(CXCursor C); |
| |
| /** |
| * Determine whether the given cursor kind represents an invalid |
| * cursor. |
| */ |
| CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind); |
| |
| /** |
| * Determine whether the given cursor kind represents a translation |
| * unit. |
| */ |
| CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind); |
| |
| /*** |
| * Determine whether the given cursor represents a preprocessing |
| * element, such as a preprocessor directive or macro instantiation. |
| */ |
| CINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind); |
| |
| /*** |
| * Determine whether the given cursor represents a currently |
| * unexposed piece of the AST (e.g., CXCursor_UnexposedStmt). |
| */ |
| CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind); |
| |
| /** |
| * Describe the linkage of the entity referred to by a cursor. |
| */ |
| enum CXLinkageKind { |
| /** This value indicates that no linkage information is available |
| * for a provided CXCursor. */ |
| CXLinkage_Invalid, |
| /** |
| * This is the linkage for variables, parameters, and so on that |
| * have automatic storage. This covers normal (non-extern) local variables. |
| */ |
| CXLinkage_NoLinkage, |
| /** This is the linkage for static variables and static functions. */ |
| CXLinkage_Internal, |
| /** This is the linkage for entities with external linkage that live |
| * in C++ anonymous namespaces.*/ |
| CXLinkage_UniqueExternal, |
| /** This is the linkage for entities with true, external linkage. */ |
| CXLinkage_External |
| }; |
| |
| /** |
| * Determine the linkage of the entity referred to by a given cursor. |
| */ |
| CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor); |
| |
| enum CXVisibilityKind { |
| /** This value indicates that no visibility information is available |
| * for a provided CXCursor. */ |
| CXVisibility_Invalid, |
| |
| /** Symbol not seen by the linker. */ |
| CXVisibility_Hidden, |
| /** Symbol seen by the linker but resolves to a symbol inside this object. */ |
| CXVisibility_Protected, |
| /** Symbol seen by the linker and acts like a normal symbol. */ |
| CXVisibility_Default |
| }; |
| |
| /** |
| * Describe the visibility of the entity referred to by a cursor. |
| * |
| * This returns the default visibility if not explicitly specified by |
| * a visibility attribute. The default visibility may be changed by |
| * commandline arguments. |
| * |
| * \param cursor The cursor to query. |
| * |
| * \returns The visibility of the cursor. |
| */ |
| CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor cursor); |
| |
| /** |
| * Determine the availability of the entity that this cursor refers to, |
| * taking the current target platform into account. |
| * |
| * \param cursor The cursor to query. |
| * |
| * \returns The availability of the cursor. |
| */ |
| CINDEX_LINKAGE enum CXAvailabilityKind |
| clang_getCursorAvailability(CXCursor cursor); |
| |
| /** |
| * Describes the availability of a given entity on a particular platform, e.g., |
| * a particular class might only be available on Mac OS 10.7 or newer. |
| */ |
| typedef struct CXPlatformAvailability { |
| /** |
| * A string that describes the platform for which this structure |
| * provides availability information. |
| * |
| * Possible values are "ios" or "macos". |
| */ |
| CXString Platform; |
| /** |
| * The version number in which this entity was introduced. |
| */ |
| CXVersion Introduced; |
| /** |
| * The version number in which this entity was deprecated (but is |
| * still available). |
| */ |
| CXVersion Deprecated; |
| /** |
| * The version number in which this entity was obsoleted, and therefore |
| * is no longer available. |
| */ |
| CXVersion Obsoleted; |
| /** |
| * Whether the entity is unconditionally unavailable on this platform. |
| */ |
| int Unavailable; |
| /** |
| * An optional message to provide to a user of this API, e.g., to |
| * suggest replacement APIs. |
| */ |
| CXString Message; |
| } CXPlatformAvailability; |
| |
| /** |
| * Determine the availability of the entity that this cursor refers to |
| * on any platforms for which availability information is known. |
| * |
| * \param cursor The cursor to query. |
| * |
| * \param always_deprecated If non-NULL, will be set to indicate whether the |
| * entity is deprecated on all platforms. |
| * |
| * \param deprecated_message If non-NULL, will be set to the message text |
| * provided along with the unconditional deprecation of this entity. The client |
| * is responsible for deallocating this string. |
| * |
| * \param always_unavailable If non-NULL, will be set to indicate whether the |
| * entity is unavailable on all platforms. |
| * |
| * \param unavailable_message If non-NULL, will be set to the message text |
| * provided along with the unconditional unavailability of this entity. The |
| * client is responsible for deallocating this string. |
| * |
| * \param availability If non-NULL, an array of CXPlatformAvailability instances |
| * that will be populated with platform availability information, up to either |
| * the number of platforms for which availability information is available (as |
| * returned by this function) or \c availability_size, whichever is smaller. |
| * |
| * \param availability_size The number of elements available in the |
| * \c availability array. |
| * |
| * \returns The number of platforms (N) for which availability information is |
| * available (which is unrelated to \c availability_size). |
| * |
| * Note that the client is responsible for calling |
| * \c clang_disposeCXPlatformAvailability to free each of the |
| * platform-availability structures returned. There are |
| * \c min(N, availability_size) such structures. |
| */ |
| CINDEX_LINKAGE int |
| clang_getCursorPlatformAvailability(CXCursor cursor, |
| int *always_deprecated, |
| CXString *deprecated_message, |
| int *always_unavailable, |
| CXString *unavailable_message, |
| CXPlatformAvailability *availability, |
| int availability_size); |
| |
| /** |
| * Free the memory associated with a \c CXPlatformAvailability structure. |
| */ |
| CINDEX_LINKAGE void |
| clang_disposeCXPlatformAvailability(CXPlatformAvailability *availability); |
| |
| /** |
| * Describe the "language" of the entity referred to by a cursor. |
| */ |
| enum CXLanguageKind { |
| CXLanguage_Invalid = 0, |
| CXLanguage_C, |
| CXLanguage_ObjC, |
| CXLanguage_CPlusPlus |
| }; |
| |
| /** |
| * Determine the "language" of the entity referred to by a given cursor. |
| */ |
| CINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor); |
| |
| /** |
| * Describe the "thread-local storage (TLS) kind" of the declaration |
| * referred to by a cursor. |
| */ |
| enum CXTLSKind { |
| CXTLS_None = 0, |
| CXTLS_Dynamic, |
| CXTLS_Static |
| }; |
| |
| /** |
| * Determine the "thread-local storage (TLS) kind" of the declaration |
| * referred to by a cursor. |
| */ |
| CINDEX_LINKAGE enum CXTLSKind clang_getCursorTLSKind(CXCursor cursor); |
| |
| /** |
| * Returns the translation unit that a cursor originated from. |
| */ |
| CINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor); |
| |
| /** |
| * A fast container representing a set of CXCursors. |
| */ |
| typedef struct CXCursorSetImpl *CXCursorSet; |
| |
| /** |
| * Creates an empty CXCursorSet. |
| */ |
| CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void); |
| |
| /** |
| * Disposes a CXCursorSet and releases its associated memory. |
| */ |
| CINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset); |
| |
| /** |
| * Queries a CXCursorSet to see if it contains a specific CXCursor. |
| * |
| * \returns non-zero if the set contains the specified cursor. |
| */ |
| CINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset, |
| CXCursor cursor); |
| |
| /** |
| * Inserts a CXCursor into a CXCursorSet. |
| * |
| * \returns zero if the CXCursor was already in the set, and non-zero otherwise. |
| */ |
| CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset, |
| CXCursor cursor); |
| |
| /** |
| * Determine the semantic parent of the given cursor. |
| * |
| * The semantic parent of a cursor is the cursor that semantically contains |
| * the given \p cursor. For many declarations, the lexical and semantic parents |
| * are equivalent (the lexical parent is returned by |
| * \c clang_getCursorLexicalParent()). They diverge when declarations or |
| * definitions are provided out-of-line. For example: |
| * |
| * \code |
| * class C { |
| * void f(); |
| * }; |
| * |
| * void C::f() { } |
| * \endcode |
| * |
| * In the out-of-line definition of \c C::f, the semantic parent is |
| * the class \c C, of which this function is a member. The lexical parent is |
| * the place where the declaration actually occurs in the source code; in this |
| * case, the definition occurs in the translation unit. In general, the |
| * lexical parent for a given entity can change without affecting the semantics |
| * of the program, and the lexical parent of different declarations of the |
| * same entity may be different. Changing the semantic parent of a declaration, |
| * on the other hand, can have a major impact on semantics, and redeclarations |
| * of a particular entity should all have the same semantic context. |
| * |
| * In the example above, both declarations of \c C::f have \c C as their |
| * semantic context, while the lexical context of the first \c C::f is \c C |
| * and the lexical context of the second \c C::f is the translation unit. |
| * |
| * For global declarations, the semantic parent is the translation unit. |
| */ |
| CINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor); |
| |
| /** |
| * Determine the lexical parent of the given cursor. |
| * |
| * The lexical parent of a cursor is the cursor in which the given \p cursor |
| * was actually written. For many declarations, the lexical and semantic parents |
| * are equivalent (the semantic parent is returned by |
| * \c clang_getCursorSemanticParent()). They diverge when declarations or |
| * definitions are provided out-of-line. For example: |
| * |
| * \code |
| * class C { |
| * void f(); |
| * }; |
| * |
| * void C::f() { } |
| * \endcode |
| * |
| * In the out-of-line definition of \c C::f, the semantic parent is |
| * the class \c C, of which this function is a member. The lexical parent is |
| * the place where the declaration actually occurs in the source code; in this |
| * case, the definition occurs in the translation unit. In general, the |
| * lexical parent for a given entity can change without affecting the semantics |
| * of the program, and the lexical parent of different declarations of the |
| * same entity may be different. Changing the semantic parent of a declaration, |
| * on the other hand, can have a major impact on semantics, and redeclarations |
| * of a particular entity should all have the same semantic context. |
| * |
| * In the example above, both declarations of \c C::f have \c C as their |
| * semantic context, while the lexical context of the first \c C::f is \c C |
| * and the lexical context of the second \c C::f is the translation unit. |
| * |
| * For declarations written in the global scope, the lexical parent is |
| * the translation unit. |
| */ |
| CINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor); |
| |
| /** |
| * Determine the set of methods that are overridden by the given |
| * method. |
| * |
| * In both Objective-C and C++, a method (aka virtual member function, |
| * in C++) can override a virtual method in a base class. For |
| * Objective-C, a method is said to override any method in the class's |
| * base class, its protocols, or its categories' protocols, that has the same |
| * selector and is of the same kind (class or instance). |
| * If no such method exists, the search continues to the class's superclass, |
| * its protocols, and its categories, and so on. A method from an Objective-C |
| * implementation is considered to override the same methods as its |
| * corresponding method in the interface. |
| * |
| * For C++, a virtual member function overrides any virtual member |
| * function with the same signature that occurs in its base |
| * classes. With multiple inheritance, a virtual member function can |
| * override several virtual member functions coming from different |
| * base classes. |
| * |
| * In all cases, this function determines the immediate overridden |
| * method, rather than all of the overridden methods. For example, if |
| * a method is originally declared in a class A, then overridden in B |
| * (which in inherits from A) and also in C (which inherited from B), |
| * then the only overridden method returned from this function when |
| * invoked on C's method will be B's method. The client may then |
| * invoke this function again, given the previously-found overridden |
| * methods, to map out the complete method-override set. |
| * |
| * \param cursor A cursor representing an Objective-C or C++ |
| * method. This routine will compute the set of methods that this |
| * method overrides. |
| * |
| * \param overridden A pointer whose pointee will be replaced with a |
| * pointer to an array of cursors, representing the set of overridden |
| * methods. If there are no overridden methods, the pointee will be |
| * set to NULL. The pointee must be freed via a call to |
| * \c clang_disposeOverriddenCursors(). |
| * |
| * \param num_overridden A pointer to the number of overridden |
| * functions, will be set to the number of overridden functions in the |
| * array pointed to by \p overridden. |
| */ |
| CINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor, |
| CXCursor **overridden, |
| unsigned *num_overridden); |
| |
| /** |
| * Free the set of overridden cursors returned by \c |
| * clang_getOverriddenCursors(). |
| */ |
| CINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden); |
| |
| /** |
| * Retrieve the file that is included by the given inclusion directive |
| * cursor. |
| */ |
| CINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor); |
| |
| /** |
| * @} |
| */ |
| |
| /** |
| * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code |
| * |
| * Cursors represent a location within the Abstract Syntax Tree (AST). These |
| * routines help map between cursors and the physical locations where the |
| * described entities occur in the source code. The mapping is provided in |
| * both directions, so one can map from source code to the AST and back. |
| * |
| * @{ |
| */ |
| |
| /** |
| * Map a source location to the cursor that describes the entity at that |
| * location in the source code. |
| * |
| * clang_getCursor() maps an arbitrary source location within a translation |
| * unit down to the most specific cursor that describes the entity at that |
| * location. For example, given an expression \c x + y, invoking |
| * clang_getCursor() with a source location pointing to "x" will return the |
| * cursor for "x"; similarly for "y". If the cursor points anywhere between |
| * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor() |
| * will return a cursor referring to the "+" expression. |
| * |
| * \returns a cursor representing the entity at the given source location, or |
| * a NULL cursor if no such entity can be found. |
| */ |
| CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation); |
| |
| /** |
| * Retrieve the physical location of the source constructor referenced |
| * by the given cursor. |
| * |
| * The location of a declaration is typically the location of the name of that |
| * declaration, where the name of that declaration would occur if it is |
| * unnamed, or some keyword that introduces that particular declaration. |
| * The location of a reference is where that reference occurs within the |
| * source code. |
| */ |
| CINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor); |
| |
| /** |
| * Retrieve the physical extent of the source construct referenced by |
| * the given cursor. |
| * |
| * The extent of a cursor starts with the file/line/column pointing at the |
| * first character within the source construct that the cursor refers to and |
| * ends with the last character within that source construct. For a |
| * declaration, the extent covers the declaration itself. For a reference, |
| * the extent covers the location of the reference (e.g., where the referenced |
| * entity was actually used). |
| */ |
| CINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor); |
| |
| /** |
| * @} |
| */ |
| |
| /** |
| * \defgroup CINDEX_TYPES Type information for CXCursors |
| * |
| * @{ |
| */ |
| |
| /** |
| * Describes the kind of type |
| */ |
| enum CXTypeKind { |
| /** |
| * Represents an invalid type (e.g., where no type is available). |
| */ |
| CXType_Invalid = 0, |
| |
| /** |
| * A type whose specific kind is not exposed via this |
| * interface. |
| */ |
| CXType_Unexposed = 1, |
| |
| /* Builtin types */ |
| CXType_Void = 2, |
| CXType_Bool = 3, |
| CXType_Char_U = 4, |
| CXType_UChar = 5, |
| CXType_Char16 = 6, |
| CXType_Char32 = 7, |
| CXType_UShort = 8, |
| CXType_UInt = 9, |
| CXType_ULong = 10, |
| CXType_ULongLong = 11, |
| CXType_UInt128 = 12, |
| CXType_Char_S = 13, |
| CXType_SChar = 14, |
| CXType_WChar = 15, |
| CXType_Short = 16, |
| CXType_Int = 17, |
| CXType_Long = 18, |
| CXType_LongLong = 19, |
| CXType_Int128 = 20, |
| CXType_Float = 21, |
| CXType_Double = 22, |
| CXType_LongDouble = 23, |
| CXType_NullPtr = 24, |
| CXType_Overload = 25, |
| CXType_Dependent = 26, |
| CXType_ObjCId = 27, |
| CXType_ObjCClass = 28, |
| CXType_ObjCSel = 29, |
| CXType_Float128 = 30, |
| CXType_Half = 31, |
| CXType_Float16 = 32, |
| CXType_ShortAccum = 33, |
| CXType_Accum = 34, |
| CXType_LongAccum = 35, |
| CXType_UShortAccum = 36, |
| CXType_UAccum = 37, |
| CXType_ULongAccum = 38, |
| CXType_FirstBuiltin = CXType_Void, |
| CXType_LastBuiltin = CXType_ULongAccum, |
| |
| CXType_Complex = 100, |
| CXType_Pointer = 101, |
| CXType_BlockPointer = 102, |
| CXType_LValueReference = 103, |
| CXType_RValueReference = 104, |
| CXType_Record = 105, |
| CXType_Enum = 106, |
| CXType_Typedef = 107, |
| CXType_ObjCInterface = 108, |
| CXType_ObjCObjectPointer = 109, |
| CXType_FunctionNoProto = 110, |
| CXType_FunctionProto = 111, |
| CXType_ConstantArray = 112, |
| CXType_Vector = 113, |
| CXType_IncompleteArray = 114, |
| CXType_VariableArray = 115, |
| CXType_DependentSizedArray = 116, |
| CXType_MemberPointer = 117, |
| CXType_Auto = 118, |
| |
| /** |
| * Represents a type that was referred to using an elaborated type keyword. |
| * |
| * E.g., struct S, or via a qualified name, e.g., N::M::type, or both. |
| */ |
| CXType_Elaborated = 119, |
| |
| /* OpenCL PipeType. */ |
| CXType_Pipe = 120, |
| |
| /* OpenCL builtin types. */ |
| CXType_OCLImage1dRO = 121, |
| CXType_OCLImage1dArrayRO = 122, |
| CXType_OCLImage1dBufferRO = 123, |
| CXType_OCLImage2dRO = 124, |
| CXType_OCLImage2dArrayRO = 125, |
| CXType_OCLImage2dDepthRO = 126, |
| CXType_OCLImage2dArrayDepthRO = 127, |
| CXType_OCLImage2dMSAARO = 128, |
| CXType_OCLImage2dArrayMSAARO = 129, |
| CXType_OCLImage2dMSAADepthRO = 130, |
| CXType_OCLImage2dArrayMSAADepthRO = 131, |
| CXType_OCLImage3dRO = 132, |
| CXType_OCLImage1dWO = 133, |
| CXType_OCLImage1dArrayWO = 134, |
| CXType_OCLImage1dBufferWO = 135, |
| CXType_OCLImage2dWO = 136, |
| CXType_OCLImage2dArrayWO = 137, |
| CXType_OCLImage2dDepthWO = 138, |
| CXType_OCLImage2dArrayDepthWO = 139, |
| CXType_OCLImage2dMSAAWO = 140, |
| CXType_OCLImage2dArrayMSAAWO = 141, |
| CXType_OCLImage2dMSAADepthWO = 142, |
| CXType_OCLImage2dArrayMSAADepthWO = 143, |
| CXType_OCLImage3dWO = 144, |
| CXType_OCLImage1dRW = 145, |
| CXType_OCLImage1dArrayRW = 146, |
| CXType_OCLImage1dBufferRW = 147, |
| CXType_OCLImage2dRW = 148, |
| CXType_OCLImage2dArrayRW = 149, |
| CXType_OCLImage2dDepthRW = 150, |
| CXType_OCLImage2dArrayDepthRW = 151, |
| CXType_OCLImage2dMSAARW = 152, |
| CXType_OCLImage2dArrayMSAARW = 153, |
| CXType_OCLImage2dMSAADepthRW = 154, |
| CXType_OCLImage2dArrayMSAADepthRW = 155, |
| CXType_OCLImage3dRW = 156, |
| CXType_OCLSampler = 157, |
| CXType_OCLEvent = 158, |
| CXType_OCLQueue = 159, |
| CXType_OCLReserveID = 160, |
| |
| CXType_ObjCObject = 161, |
| CXType_ObjCTypeParam = 162, |
| CXType_Attributed = 163, |
| |
| CXType_OCLIntelSubgroupAVCMcePayload = 164, |
| CXType_OCLIntelSubgroupAVCImePayload = 165, |
| CXType_OCLIntelSubgroupAVCRefPayload = 166, |
| CXType_OCLIntelSubgroupAVCSicPayload = 167, |
| CXType_OCLIntelSubgroupAVCMceResult = 168, |
| CXType_OCLIntelSubgroupAVCImeResult = 169, |
| CXType_OCLIntelSubgroupAVCRefResult = 170, |
| CXType_OCLIntelSubgroupAVCSicResult = 171, |
| CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout = 172, |
| CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout = 173, |
| CXType_OCLIntelSubgroupAVCImeSingleRefStreamin = 174, |
| |
| CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175, |
| |
| CXType_ExtVector = 176 |
| }; |
| |
| /** |
| * Describes the calling convention of a function type |
| */ |
| enum CXCallingConv { |
| CXCallingConv_Default = 0, |
| CXCallingConv_C = 1, |
| CXCallingConv_X86StdCall = 2, |
| CXCallingConv_X86FastCall = 3, |
| CXCallingConv_X86ThisCall = 4, |
| CXCallingConv_X86Pascal = 5, |
| CXCallingConv_AAPCS = 6, |
| CXCallingConv_AAPCS_VFP = 7, |
| CXCallingConv_X86RegCall = 8, |
| CXCallingConv_IntelOclBicc = 9, |
| CXCallingConv_Win64 = 10, |
| /* Alias for compatibility with older versions of API. */ |
| CXCallingConv_X86_64Win64 = CXCallingConv_Win64, |
| CXCallingConv_X86_64SysV = 11, |
| CXCallingConv_X86VectorCall = 12, |
| CXCallingConv_Swift = 13, |
| CXCallingConv_PreserveMost = 14, |
| CXCallingConv_PreserveAll = 15, |
| CXCallingConv_AArch64VectorCall = 16, |
| |
| CXCallingConv_Invalid = 100, |
| CXCallingConv_Unexposed = 200 |
| }; |
| |
| /** |
| * The type of an element in the abstract syntax tree. |
| * |
| */ |
| typedef struct { |
| enum CXTypeKind kind; |
| void *data[2]; |
| } CXType; |
| |
| /** |
| * Retrieve the type of a CXCursor (if any). |
| */ |
| CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C); |
| |
| /** |
| * 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); |
| |
| /** |
| * Retrieve the underlying type of a typedef declaration. |
| * |
| * If the cursor does not reference a typedef declaration, an invalid type is |
| * returned. |
| */ |
| CINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C); |
| |
| /** |
| * Retrieve the integer type of an enum declaration. |
| * |
| * If the cursor does not reference an enum declaration, an invalid type is |
| * returned. |
| */ |
| CINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C); |
| |
| /** |
| * Retrieve the integer value of an enum constant declaration as a signed |
| * long long. |
| * |
| * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned. |
| * Since this is also potentially a valid constant value, the kind of the cursor |
| * must be verified before calling this function. |
| */ |
| CINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C); |
| |
| /** |
| * Retrieve the integer value of an enum constant declaration as an unsigned |
| * long long. |
| * |
| * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned. |
| * Since this is also potentially a valid constant value, the kind of the cursor |
| * must be verified before calling this function. |
| */ |
| CINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C); |
| |
| /** |
| * 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); |
| |
| /** |
| * Retrieve the number of non-variadic arguments associated with a given |
| * cursor. |
| * |
| * 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); |
| |
| /** |
| * Retrieve the argument cursor of a function or method. |
| * |
| * 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); |
| |
| /** |
| * Describes the kind of a template argument. |
| * |
| * See the definition of llvm::clang::TemplateArgument::ArgKind for full |
| * element descriptions. |
| */ |
| enum CXTemplateArgumentKind { |
| CXTemplateArgumentKind_Null, |
| CXTemplateArgumentKind_Type, |
| CXTemplateArgumentKind_Declaration, |
| CXTemplateArgumentKind_NullPtr, |
| CXTemplateArgumentKind_Integral, |
| CXTemplateArgumentKind_Template, |
| CXTemplateArgumentKind_TemplateExpansion, |
| CXTemplateArgumentKind_Expression, |
| CXTemplateArgumentKind_Pack, |
| /* Indicates an error case, preventing the kind from being deduced. */ |
| CXTemplateArgumentKind_Invalid |
| }; |
| |
| /** |
| *Returns the number of template args of a function decl representing a |
| * template specialization. |
| * |
| * If the argument cursor cannot be converted into a template function |
| * declaration, -1 is returned. |
| * |
| * For example, for the following declaration and specialization: |
| * template <typename T, int kInt, bool kBool> |
| * void foo() { ... } |
| * |
| * template <> |
| * void foo<float, -7, true>(); |
| * |
| * The value 3 would be returned from this call. |
| */ |
| CINDEX_LINKAGE int clang_Cursor_getNumTemplateArguments(CXCursor C); |
| |
| /** |
| * Retrieve the kind of the I'th template argument of the CXCursor C. |
| * |
| * If the argument CXCursor does not represent a FunctionDecl, an invalid |
| * template argument kind is returned. |
| * |
| * For example, for the following declaration and specialization: |
| * template <typename T, int kInt, bool kBool> |
| * void foo() { ... } |
| * |
| * template <> |
| * void foo<float, -7, true>(); |
| * |
| * For I = 0, 1, and 2, Type, Integral, and Integral will be returned, |
| * respectively. |
| */ |
| CINDEX_LINKAGE enum CXTemplateArgumentKind clang_Cursor_getTemplateArgumentKind( |
| CXCursor C, unsigned I); |
| |
| /** |
| * Retrieve a CXType representing the type of a TemplateArgument of a |
| * function decl representing a template specialization. |
| * |
| * If the argument CXCursor does not represent a FunctionDecl whose I'th |
| * template argument has a kind of CXTemplateArgKind_Integral, an invalid type |
| * is returned. |
| * |
| * For example, for the following declaration and specialization: |
| * template <typename T, int kInt, bool kBool> |
| * void foo() { ... } |
| * |
| * template <> |
| * void foo<float, -7, true>(); |
| * |
| * If called with I = 0, "float", will be returned. |
| * Invalid types will be returned for I == 1 or 2. |
| */ |
| CINDEX_LINKAGE CXType clang_Cursor_getTemplateArgumentType(CXCursor C, |
| unsigned I); |
| |
| /** |
| * Retrieve the value of an Integral TemplateArgument (of a function |
| * decl representing a template specialization) as a signed long long. |
| * |
| * It is undefined to call this function on a CXCursor that does not represent a |
| * FunctionDecl or whose I'th template argument is not an integral value. |
| * |
| * For example, for the following declaration and specialization: |
| * template <typename T, int kInt, bool kBool> |
| * void foo() { ... } |
| * |
| * template <> |
| * void foo<float, -7, true>(); |
| * |
| * If called with I = 1 or 2, -7 or true will be returned, respectively. |
| * For I == 0, this function's behavior is undefined. |
| */ |
| CINDEX_LINKAGE long long clang_Cursor_getTemplateArgumentValue(CXCursor C, |
| unsigned I); |
| |
| /** |
| * Retrieve the value of an Integral TemplateArgument (of a function |
| * decl representing a template specialization) as an unsigned long long. |
| * |
| * It is undefined to call this function on a CXCursor that does not represent a |
| * FunctionDecl or whose I'th template argument is not an integral value. |
| * |
| * For example, for the following declaration and specialization: |
| * template <typename T, int kInt, bool kBool> |
| * void foo() { ... } |
| * |
| * template <> |
| * void foo<float, 2147483649, true>(); |
| * |
| * If called with I = 1 or 2, 2147483649 or true will be returned, respectively. |
| * For I == 0, this function's behavior is undefined. |
| */ |
| CINDEX_LINKAGE unsigned long long clang_Cursor_getTemplateArgumentUnsignedValue( |
| CXCursor C, unsigned I); |
| |
| /** |
| * Determine whether two CXTypes represent the same type. |
| * |
| * \returns non-zero if the CXTypes represent the same type and |
| * zero otherwise. |
| */ |
| CINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B); |
| |
| /** |
| * Return the canonical type for a CXType. |
| * |
| * Clang's type system explicitly models typedefs and all the ways |
| * a specific type can be represented. The canonical type is the underlying |
| * type with all the "sugar" removed. For example, if 'T' is a typedef |
| * for 'int', the canonical type for 'T' would be 'int'. |
| */ |
| CINDEX_LINKAGE CXType clang_getCanonicalType(CXType T); |
| |
| /** |
| * Determine whether a CXType has the "const" qualifier set, |
| * without looking through typedefs that may have added "const" at a |
| * different level. |
| */ |
| CINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T); |
| |
| /** |
| * Determine whether a CXCursor that is a macro, is |
| * function like. |
| */ |
| CINDEX_LINKAGE unsigned clang_Cursor_isMacroFunctionLike(CXCursor C); |
| |
| /** |
| * Determine whether a CXCursor that is a macro, is a |
| * builtin one. |
| */ |
| CINDEX_LINKAGE unsigned clang_Cursor_isMacroBuiltin(CXCursor C); |
| |
| /** |
| * Determine whether a CXCursor that is a function declaration, is an |
| * inline declaration. |
| */ |
| CINDEX_LINKAGE unsigned clang_Cursor_isFunctionInlined(CXCursor C); |
| |
| /** |
| * Determine whether a CXType has the "volatile" qualifier set, |
| * without looking through typedefs that may have added "volatile" at |
| * a different level. |
| */ |
| CINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T); |
| |
| /** |
| * Determine whether a CXType has the "restrict" qualifier set, |
| * without looking through typedefs that may have added "restrict" at a |
| * different level. |
| */ |
| CINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T); |
| |
| /** |
| * Returns the address space of the given type. |
| */ |
| CINDEX_LINKAGE unsigned clang_getAddressSpace(CXType T); |
| |
| /** |
| * Returns the typedef name of the given type. |
| */ |
| CINDEX_LINKAGE CXString clang_getTypedefName(CXType CT); |
| |
| /** |
| * For pointer types, returns the type of the pointee. |
| */ |
| CINDEX_LINKAGE CXType clang_getPointeeType(CXType T); |
| |
| /** |
| * Return the cursor for the declaration of the given type. |
| */ |
| CINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T); |
| |
| /** |
| * Returns the Objective-C type encoding for the specified declaration. |
| */ |
| CINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C); |
| |
| /** |
| * Returns the Objective-C type encoding for the specified CXType. |
| */ |
| CINDEX_LINKAGE CXString clang_Type_getObjCEncoding(CXType type); |
| |
| /** |
| * Retrieve the spelling of a given CXTypeKind. |
| */ |
| CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K); |
| |
| /** |
| * Retrieve the calling convention associated with a function type. |
| * |
| * If a non-function type is passed in, CXCallingConv_Invalid is returned. |
| */ |
| CINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T); |
| |
| /** |
| * Retrieve the return type associated with a function type. |
| * |
| * If a non-function type is passed in, an invalid type is returned. |
| */ |
| CINDEX_LINKAGE CXType clang_getResultType(CXType T); |
| |
| /** |
| * Retrieve the exception specification type associated with a function type. |
| * This is a value of type CXCursor_ExceptionSpecificationKind. |
| * |
| * If a non-function type is passed in, an error code of -1 is returned. |
| */ |
| CINDEX_LINKAGE int clang_getExceptionSpecificationType(CXType T); |
| |
| /** |
| * Retrieve the number of non-variadic parameters associated with a |
| * function type. |
| * |
| * If a non-function type is passed in, -1 is returned. |
| */ |
| CINDEX_LINKAGE int clang_getNumArgTypes(CXType T); |
| |
| /** |
| * Retrieve the type of a parameter of a function type. |
| * |
| * If a non-function type is passed in or the function does not have enough |
| * parameters, an invalid type is returned. |
| */ |
| CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i); |
| |
| /** |
| * Retrieves the base type of the ObjCObjectType. |
| * |
| * If the type is not an ObjC object, an invalid type is returned. |
| */ |
| CINDEX_LINKAGE CXType clang_Type_getObjCObjectBaseType(CXType T); |
| |
| /** |
| * Retrieve the number of protocol references associated with an ObjC object/id. |
| * |
| * If the type is not an ObjC object, 0 is returned. |
| */ |
| CINDEX_LINKAGE unsigned clang_Type_getNumObjCProtocolRefs(CXType T); |
| |
| /** |
| * Retrieve the decl for a protocol reference for an ObjC object/id. |
| * |
| * If the type is not an ObjC object or there are not enough protocol |
| * references, an invalid cursor is returned. |
| */ |
| CINDEX_LINKAGE CXCursor clang_Type_getObjCProtocolDecl(CXType T, unsigned i); |
| |
| /** |
| * Retreive the number of type arguments associated with an ObjC object. |
| * |
| * If the type is not an ObjC object, 0 is returned. |
| */ |
| CINDEX_LINKAGE unsigned clang_Type_getNumObjCTypeArgs(CXType T); |
| |
| /** |
| * Retrieve a type argument associated with an ObjC object. |
| * |
| * If the type is not an ObjC or the index is not valid, |
| * an invalid type is returned. |
| */ |
| CINDEX_LINKAGE CXType clang_Type_getObjCTypeArg(CXType T, unsigned i); |
| |
| /** |
| * Return 1 if the CXType is a variadic function type, and 0 otherwise. |
| */ |
| CINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T); |
| |
| /** |
| * Retrieve the return type associated with a given cursor. |
| * |
| * This only returns a valid type if the cursor refers to a function or method. |
| */ |
| CINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C); |
| |
| /** |
| * Retrieve the exception specification type associated with a given cursor. |
| * This is a value of type CXCursor_ExceptionSpecificationKind. |
| * |
| * This only returns a valid result if the cursor refers to a function or method. |
| */ |
| CINDEX_LINKAGE int clang_getCursorExceptionSpecificationType(CXCursor C); |
| |
| /** |
| * Return 1 if the CXType is a POD (plain old data) type, and 0 |
| * otherwise. |
| */ |
| CINDEX_LINKAGE unsigned clang_isPODType(CXType T); |
| |
| /** |
| * Return the element type of an array, complex, or vector type. |
| * |
| * If a type is passed in that is not an array, complex, or vector type, |
| * an invalid type is returned. |
| */ |
| CINDEX_LINKAGE CXType clang_getElementType(CXType T); |
| |
| /** |
| * Return the number of elements of an array or vector type. |
| * |
| * If a type is passed in that is not an array or vector type, |
| * -1 is returned. |
| */ |
| CINDEX_LINKAGE long long clang_getNumElements(CXType T); |
| |
| /** |
| * Return the element type of an array type. |
| * |
| * If a non-array type is passed in, an invalid type is returned. |
| */ |
| CINDEX_LINKAGE CXType clang_getArrayElementType(CXType T); |
| |
| |