[clang] Reformat cindex. NFC.
to reduce spurios changes in patches after clang-formatting them. In particular, these files contain long enums that clang-format reformats in their entirety if e.g. an element is added. Reviews having this problem include https://reviews.llvm.org/D76342 and https://reviews.llvm.org/D71447.
This commit is contained in:
parent
a32b94c6c3
commit
7520cf03ee
@ -35,22 +35,17 @@
|
||||
#define CINDEX_VERSION_MAJOR 0
|
||||
#define CINDEX_VERSION_MINOR 59
|
||||
|
||||
#define CINDEX_VERSION_ENCODE(major, minor) ( \
|
||||
((major) * 10000) \
|
||||
+ ((minor) * 1))
|
||||
#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 \
|
||||
CINDEX_VERSION_ENCODE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR)
|
||||
|
||||
#define CINDEX_VERSION_STRINGIZE_(major, minor) \
|
||||
#major"."#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)
|
||||
#define CINDEX_VERSION_STRING \
|
||||
CINDEX_VERSION_STRINGIZE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR)
|
||||
|
||||
LLVM_CLANG_C_EXTERN_C_BEGIN
|
||||
|
||||
@ -390,8 +385,8 @@ CINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID);
|
||||
* multiple inclusions, either with the conventional
|
||||
* \#ifndef/\#define/\#endif macro guards or with \#pragma once.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned
|
||||
clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
|
||||
CINDEX_LINKAGE unsigned clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu,
|
||||
CXFile file);
|
||||
|
||||
/**
|
||||
* Retrieve a file handle within the given translation unit.
|
||||
@ -496,8 +491,7 @@ CINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1,
|
||||
* in a particular translation unit.
|
||||
*/
|
||||
CINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu,
|
||||
CXFile file,
|
||||
unsigned line,
|
||||
CXFile file, unsigned line,
|
||||
unsigned column);
|
||||
/**
|
||||
* Retrieves the source location associated with a given character offset
|
||||
@ -566,8 +560,7 @@ CINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range);
|
||||
* buffer to which the given source location points.
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location,
|
||||
CXFile *file,
|
||||
unsigned *line,
|
||||
CXFile *file, unsigned *line,
|
||||
unsigned *column,
|
||||
unsigned *offset);
|
||||
|
||||
@ -613,8 +606,7 @@ CINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location,
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location,
|
||||
CXString *filename,
|
||||
unsigned *line,
|
||||
unsigned *column);
|
||||
unsigned *line, unsigned *column);
|
||||
|
||||
/**
|
||||
* Legacy API to retrieve the file, line, column, and offset represented
|
||||
@ -625,8 +617,7 @@ CINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location,
|
||||
* details.
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location,
|
||||
CXFile *file,
|
||||
unsigned *line,
|
||||
CXFile *file, unsigned *line,
|
||||
unsigned *column,
|
||||
unsigned *offset);
|
||||
|
||||
@ -653,8 +644,7 @@ CINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location,
|
||||
* buffer to which the given source location points.
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location,
|
||||
CXFile *file,
|
||||
unsigned *line,
|
||||
CXFile *file, unsigned *line,
|
||||
unsigned *column,
|
||||
unsigned *offset);
|
||||
|
||||
@ -682,10 +672,8 @@ CINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location,
|
||||
* buffer to which the given source location points.
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_getFileLocation(CXSourceLocation location,
|
||||
CXFile *file,
|
||||
unsigned *line,
|
||||
unsigned *column,
|
||||
unsigned *offset);
|
||||
CXFile *file, unsigned *line,
|
||||
unsigned *column, unsigned *offset);
|
||||
|
||||
/**
|
||||
* Retrieve a source location representing the first character within a
|
||||
@ -727,7 +715,8 @@ CINDEX_LINKAGE CXSourceRangeList *clang_getSkippedRanges(CXTranslationUnit tu,
|
||||
* 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);
|
||||
CINDEX_LINKAGE CXSourceRangeList *
|
||||
clang_getAllSkippedRanges(CXTranslationUnit tu);
|
||||
|
||||
/**
|
||||
* Destroy the given \c CXSourceRangeList.
|
||||
@ -849,9 +838,8 @@ enum CXLoadDiag_Error {
|
||||
* \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);
|
||||
CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(
|
||||
const char *file, enum CXLoadDiag_Error *error, CXString *errorString);
|
||||
|
||||
/**
|
||||
* Release a CXDiagnosticSet and all of its contained diagnostics.
|
||||
@ -1049,8 +1037,8 @@ CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic);
|
||||
*
|
||||
* \returns The name of the given diagnostic category.
|
||||
*/
|
||||
CINDEX_DEPRECATED CINDEX_LINKAGE
|
||||
CXString clang_getDiagnosticCategoryName(unsigned Category);
|
||||
CINDEX_DEPRECATED CINDEX_LINKAGE CXString
|
||||
clang_getDiagnosticCategoryName(unsigned Category);
|
||||
|
||||
/**
|
||||
* Retrieve the diagnostic category text for a given diagnostic.
|
||||
@ -1112,9 +1100,8 @@ CINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
|
||||
* \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);
|
||||
CINDEX_LINKAGE CXString clang_getDiagnosticFixIt(
|
||||
CXDiagnostic Diagnostic, unsigned FixIt, CXSourceRange *ReplacementRange);
|
||||
|
||||
/**
|
||||
* @}
|
||||
@ -1177,11 +1164,8 @@ clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
|
||||
* 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,
|
||||
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);
|
||||
|
||||
/**
|
||||
@ -1190,9 +1174,8 @@ CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile(
|
||||
* routine returns a \c NULL \c CXTranslationUnit, without further detailed
|
||||
* error codes.
|
||||
*/
|
||||
CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(
|
||||
CXIndex CIdx,
|
||||
const char *ast_filename);
|
||||
CINDEX_LINKAGE CXTranslationUnit
|
||||
clang_createTranslationUnit(CXIndex CIdx, const char *ast_filename);
|
||||
|
||||
/**
|
||||
* Create a translation unit from an AST file (\c -emit-ast).
|
||||
@ -1202,9 +1185,8 @@ CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(
|
||||
*
|
||||
* \returns Zero on success, otherwise returns an error code.
|
||||
*/
|
||||
CINDEX_LINKAGE enum CXErrorCode clang_createTranslationUnit2(
|
||||
CXIndex CIdx,
|
||||
const char *ast_filename,
|
||||
CINDEX_LINKAGE enum CXErrorCode
|
||||
clang_createTranslationUnit2(CXIndex CIdx, const char *ast_filename,
|
||||
CXTranslationUnit *out_TU);
|
||||
|
||||
/**
|
||||
@ -1383,13 +1365,10 @@ CINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void);
|
||||
* 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,
|
||||
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);
|
||||
|
||||
/**
|
||||
@ -1436,15 +1415,11 @@ clang_parseTranslationUnit(CXIndex CIdx,
|
||||
*
|
||||
* \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);
|
||||
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
|
||||
@ -1623,8 +1598,8 @@ CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
|
||||
* \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,
|
||||
CINDEX_LINKAGE int
|
||||
clang_reparseTranslationUnit(CXTranslationUnit TU, unsigned num_unsaved_files,
|
||||
struct CXUnsavedFile *unsaved_files,
|
||||
unsigned options);
|
||||
|
||||
@ -1689,7 +1664,8 @@ typedef struct 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 CXTUResourceUsage
|
||||
clang_getCXTUResourceUsage(CXTranslationUnit TU);
|
||||
|
||||
CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage);
|
||||
|
||||
@ -1704,24 +1680,21 @@ clang_getTranslationUnitTargetInfo(CXTranslationUnit CTUnit);
|
||||
/**
|
||||
* Destroy the CXTargetInfo object.
|
||||
*/
|
||||
CINDEX_LINKAGE void
|
||||
clang_TargetInfo_dispose(CXTargetInfo Info);
|
||||
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);
|
||||
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);
|
||||
CINDEX_LINKAGE int clang_TargetInfo_getPointerWidth(CXTargetInfo Info);
|
||||
|
||||
/**
|
||||
* @}
|
||||
@ -2943,14 +2916,10 @@ typedef struct CXPlatformAvailability {
|
||||
* 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);
|
||||
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.
|
||||
@ -2977,11 +2946,7 @@ 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
|
||||
};
|
||||
enum CXTLSKind { CXTLS_None = 0, CXTLS_Dynamic, CXTLS_Static };
|
||||
|
||||
/**
|
||||
* Determine the "thread-local storage (TLS) kind" of the declaration
|
||||
@ -3441,9 +3406,9 @@ 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.
|
||||
* 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);
|
||||
|
||||
@ -3451,11 +3416,12 @@ 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.
|
||||
* 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);
|
||||
CINDEX_LINKAGE unsigned long long
|
||||
clang_getEnumConstantDeclUnsignedValue(CXCursor C);
|
||||
|
||||
/**
|
||||
* Retrieve the bit width of a bit field declaration as an integer.
|
||||
@ -3536,8 +3502,8 @@ CINDEX_LINKAGE int clang_Cursor_getNumTemplateArguments(CXCursor C);
|
||||
* 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);
|
||||
CINDEX_LINKAGE enum CXTemplateArgumentKind
|
||||
clang_Cursor_getTemplateArgumentKind(CXCursor C, unsigned I);
|
||||
|
||||
/**
|
||||
* Retrieve a CXType representing the type of a TemplateArgument of a
|
||||
@ -3597,8 +3563,8 @@ CINDEX_LINKAGE long long clang_Cursor_getTemplateArgumentValue(CXCursor C,
|
||||
* 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);
|
||||
CINDEX_LINKAGE unsigned long long
|
||||
clang_Cursor_getTemplateArgumentUnsignedValue(CXCursor C, unsigned I);
|
||||
|
||||
/**
|
||||
* Determine whether two CXTypes represent the same type.
|
||||
@ -3783,7 +3749,8 @@ 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.
|
||||
* This only returns a valid result if the cursor refers to a function or
|
||||
* method.
|
||||
*/
|
||||
CINDEX_LINKAGE int clang_getCursorExceptionSpecificationType(CXCursor C);
|
||||
|
||||
@ -4011,7 +3978,8 @@ CINDEX_LINKAGE int clang_Type_getNumTemplateArguments(CXType T);
|
||||
* This function only returns template type arguments and does not handle
|
||||
* template template arguments or variadic packs.
|
||||
*/
|
||||
CINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T, unsigned i);
|
||||
CINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T,
|
||||
unsigned i);
|
||||
|
||||
/**
|
||||
* Retrieve the ref-qualifier kind of a function or method.
|
||||
@ -4047,9 +4015,9 @@ enum CX_CXXAccessSpecifier {
|
||||
/**
|
||||
* Returns the access control level for the referenced object.
|
||||
*
|
||||
* If the cursor refers to a C++ declaration, its access control level within its
|
||||
* parent scope is returned. Otherwise, if the cursor refers to a base specifier or
|
||||
* access specifier, the specifier itself is returned.
|
||||
* If the cursor refers to a C++ declaration, its access control level within
|
||||
* its parent scope is returned. Otherwise, if the cursor refers to a base
|
||||
* specifier or access specifier, the specifier itself is returned.
|
||||
*/
|
||||
CINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor);
|
||||
|
||||
@ -4211,15 +4179,15 @@ CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent,
|
||||
* The visitor should return one of the \c CXChildVisitResult values
|
||||
* to direct clang_visitChildrenWithBlock().
|
||||
*/
|
||||
typedef enum CXChildVisitResult
|
||||
(^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent);
|
||||
typedef enum CXChildVisitResult (^CXCursorVisitorBlock)(CXCursor cursor,
|
||||
CXCursor parent);
|
||||
|
||||
/**
|
||||
* Visits the children of a cursor using the specified block. Behaves
|
||||
* identically to clang_visitChildren() in all other respects.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_visitChildrenWithBlock(CXCursor parent,
|
||||
CXCursorVisitorBlock block);
|
||||
CINDEX_LINKAGE unsigned
|
||||
clang_visitChildrenWithBlock(CXCursor parent, CXCursorVisitorBlock block);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -4257,9 +4225,8 @@ CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name);
|
||||
/**
|
||||
* Construct a USR for a specified Objective-C category.
|
||||
*/
|
||||
CINDEX_LINKAGE CXString
|
||||
clang_constructUSR_ObjCCategory(const char *class_name,
|
||||
const char *category_name);
|
||||
CINDEX_LINKAGE CXString clang_constructUSR_ObjCCategory(
|
||||
const char *class_name, const char *category_name);
|
||||
|
||||
/**
|
||||
* Construct a USR for a specified Objective-C protocol.
|
||||
@ -4305,9 +4272,8 @@ CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);
|
||||
*
|
||||
* \param options Reserved.
|
||||
*/
|
||||
CINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor,
|
||||
unsigned pieceIndex,
|
||||
unsigned options);
|
||||
CINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(
|
||||
CXCursor, unsigned pieceIndex, unsigned options);
|
||||
|
||||
/**
|
||||
* Opaque pointer representing a policy that controls pretty printing
|
||||
@ -4361,7 +4327,8 @@ clang_PrintingPolicy_getProperty(CXPrintingPolicy Policy,
|
||||
/**
|
||||
* Set a property value for the given printing policy.
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_PrintingPolicy_setProperty(CXPrintingPolicy Policy,
|
||||
CINDEX_LINKAGE void
|
||||
clang_PrintingPolicy_setProperty(CXPrintingPolicy Policy,
|
||||
enum CXPrintingPolicyProperty Property,
|
||||
unsigned Value);
|
||||
|
||||
@ -4534,8 +4501,8 @@ typedef enum {
|
||||
*
|
||||
* \param reserved Reserved for future use, pass 0.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C,
|
||||
unsigned reserved);
|
||||
CINDEX_LINKAGE unsigned
|
||||
clang_Cursor_getObjCPropertyAttributes(CXCursor C, unsigned reserved);
|
||||
|
||||
/**
|
||||
* Given a cursor that represents a property declaration, return the
|
||||
@ -4597,7 +4564,8 @@ CINDEX_LINKAGE unsigned clang_Cursor_isVariadic(CXCursor C);
|
||||
* non-zero if the 'generated_declaration' is set in the attribute.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_Cursor_isExternalSymbol(CXCursor C,
|
||||
CXString *language, CXString *definedIn,
|
||||
CXString *language,
|
||||
CXString *definedIn,
|
||||
unsigned *isGenerated);
|
||||
|
||||
/**
|
||||
@ -4724,8 +4692,8 @@ CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit,
|
||||
* \returns the specified top level header associated with the module.
|
||||
*/
|
||||
CINDEX_LINKAGE
|
||||
CXFile clang_Module_getTopLevelHeader(CXTranslationUnit,
|
||||
CXModule Module, unsigned Index);
|
||||
CXFile clang_Module_getTopLevelHeader(CXTranslationUnit, CXModule Module,
|
||||
unsigned Index);
|
||||
|
||||
/**
|
||||
* @}
|
||||
@ -4743,7 +4711,8 @@ CXFile clang_Module_getTopLevelHeader(CXTranslationUnit,
|
||||
/**
|
||||
* Determine if a C++ constructor is a converting constructor.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_CXXConstructor_isConvertingConstructor(CXCursor C);
|
||||
CINDEX_LINKAGE unsigned
|
||||
clang_CXXConstructor_isConvertingConstructor(CXCursor C);
|
||||
|
||||
/**
|
||||
* Determine if a C++ constructor is a copy constructor.
|
||||
@ -4873,9 +4842,8 @@ CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C);
|
||||
* \returns The piece of the name pointed to by the given cursor. If there is no
|
||||
* name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
|
||||
*/
|
||||
CINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C,
|
||||
unsigned NameFlags,
|
||||
unsigned PieceIndex);
|
||||
CINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(
|
||||
CXCursor C, unsigned NameFlags, unsigned PieceIndex);
|
||||
|
||||
enum CXNameRefFlags {
|
||||
/**
|
||||
@ -5043,15 +5011,14 @@ CINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
|
||||
* \param Cursors an array of \p NumTokens cursors, whose contents will be
|
||||
* replaced with the cursors corresponding to each token.
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU,
|
||||
CXToken *Tokens, unsigned NumTokens,
|
||||
CXCursor *Cursors);
|
||||
CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU, CXToken *Tokens,
|
||||
unsigned NumTokens, CXCursor *Cursors);
|
||||
|
||||
/**
|
||||
* Free the given set of tokens.
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU,
|
||||
CXToken *Tokens, unsigned NumTokens);
|
||||
CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU, CXToken *Tokens,
|
||||
unsigned NumTokens);
|
||||
|
||||
/**
|
||||
* @}
|
||||
@ -5068,13 +5035,9 @@ CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU,
|
||||
|
||||
/* for debug/testing */
|
||||
CINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind);
|
||||
CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor,
|
||||
const char **startBuf,
|
||||
const char **endBuf,
|
||||
unsigned *startLine,
|
||||
unsigned *startColumn,
|
||||
unsigned *endLine,
|
||||
unsigned *endColumn);
|
||||
CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(
|
||||
CXCursor, const char **startBuf, const char **endBuf, unsigned *startLine,
|
||||
unsigned *startColumn, unsigned *endLine, unsigned *endColumn);
|
||||
CINDEX_LINKAGE void clang_enableStackTraces(void);
|
||||
CINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void *), void *user_data,
|
||||
unsigned stack_size);
|
||||
@ -5327,9 +5290,8 @@ clang_getCompletionChunkKind(CXCompletionString completion_string,
|
||||
*
|
||||
* \returns the text associated with the chunk at index \c chunk_number.
|
||||
*/
|
||||
CINDEX_LINKAGE CXString
|
||||
clang_getCompletionChunkText(CXCompletionString completion_string,
|
||||
unsigned chunk_number);
|
||||
CINDEX_LINKAGE CXString clang_getCompletionChunkText(
|
||||
CXCompletionString completion_string, unsigned chunk_number);
|
||||
|
||||
/**
|
||||
* Retrieve the completion string associated with a particular chunk
|
||||
@ -5342,9 +5304,8 @@ clang_getCompletionChunkText(CXCompletionString completion_string,
|
||||
* \returns the completion string associated with the chunk at index
|
||||
* \c chunk_number.
|
||||
*/
|
||||
CINDEX_LINKAGE CXCompletionString
|
||||
clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
|
||||
unsigned chunk_number);
|
||||
CINDEX_LINKAGE CXCompletionString clang_getCompletionChunkCompletionString(
|
||||
CXCompletionString completion_string, unsigned chunk_number);
|
||||
|
||||
/**
|
||||
* Retrieve the number of chunks in the given code-completion string.
|
||||
@ -5401,9 +5362,8 @@ clang_getCompletionNumAnnotations(CXCompletionString completion_string);
|
||||
* \returns annotation string associated with the completion at index
|
||||
* \c annotation_number, or a NULL string if that annotation is not available.
|
||||
*/
|
||||
CINDEX_LINKAGE CXString
|
||||
clang_getCompletionAnnotation(CXCompletionString completion_string,
|
||||
unsigned annotation_number);
|
||||
CINDEX_LINKAGE CXString clang_getCompletionAnnotation(
|
||||
CXCompletionString completion_string, unsigned annotation_number);
|
||||
|
||||
/**
|
||||
* Retrieve the parent context of the given completion string.
|
||||
@ -5421,9 +5381,8 @@ clang_getCompletionAnnotation(CXCompletionString completion_string,
|
||||
* \returns The name of the completion parent, e.g., "NSObject" if
|
||||
* the completion string represents a method in the NSObject class.
|
||||
*/
|
||||
CINDEX_LINKAGE CXString
|
||||
clang_getCompletionParent(CXCompletionString completion_string,
|
||||
enum CXCursorKind *kind);
|
||||
CINDEX_LINKAGE CXString clang_getCompletionParent(
|
||||
CXCompletionString completion_string, enum CXCursorKind *kind);
|
||||
|
||||
/**
|
||||
* Retrieve the brief documentation comment attached to the declaration
|
||||
@ -5779,13 +5738,11 @@ CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);
|
||||
* completion fails, returns NULL.
|
||||
*/
|
||||
CINDEX_LINKAGE
|
||||
CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
|
||||
const char *complete_filename,
|
||||
unsigned complete_line,
|
||||
unsigned complete_column,
|
||||
CXCodeCompleteResults *
|
||||
clang_codeCompleteAt(CXTranslationUnit TU, const char *complete_filename,
|
||||
unsigned complete_line, unsigned complete_column,
|
||||
struct CXUnsavedFile *unsaved_files,
|
||||
unsigned num_unsaved_files,
|
||||
unsigned options);
|
||||
unsigned num_unsaved_files, unsigned options);
|
||||
|
||||
/**
|
||||
* Sort the code-completion results in case-insensitive alphabetical
|
||||
@ -5834,8 +5791,8 @@ CXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,
|
||||
* along with the given code completion results.
|
||||
*/
|
||||
CINDEX_LINKAGE
|
||||
unsigned long long clang_codeCompleteGetContexts(
|
||||
CXCodeCompleteResults *Results);
|
||||
unsigned long long
|
||||
clang_codeCompleteGetContexts(CXCodeCompleteResults *Results);
|
||||
|
||||
/**
|
||||
* Returns the cursor kind for the container for the current code
|
||||
@ -5854,8 +5811,8 @@ unsigned long long clang_codeCompleteGetContexts(
|
||||
* container
|
||||
*/
|
||||
CINDEX_LINKAGE
|
||||
enum CXCursorKind clang_codeCompleteGetContainerKind(
|
||||
CXCodeCompleteResults *Results,
|
||||
enum CXCursorKind
|
||||
clang_codeCompleteGetContainerKind(CXCodeCompleteResults *Results,
|
||||
unsigned *IsIncomplete);
|
||||
|
||||
/**
|
||||
@ -5986,7 +5943,8 @@ CINDEX_LINKAGE unsigned clang_EvalResult_isUnsignedInt(CXEvalResult E);
|
||||
* Returns the evaluation result as an unsigned integer if
|
||||
* the kind is Int and clang_EvalResult_isUnsignedInt is non-zero.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned long long clang_EvalResult_getAsUnsigned(CXEvalResult E);
|
||||
CINDEX_LINKAGE unsigned long long
|
||||
clang_EvalResult_getAsUnsigned(CXEvalResult E);
|
||||
|
||||
/**
|
||||
* Returns the evaluation result as double if the
|
||||
@ -6058,7 +6016,8 @@ CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);
|
||||
* is associated with.
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index,
|
||||
CXString *original, CXString *transformed);
|
||||
CXString *original,
|
||||
CXString *transformed);
|
||||
|
||||
/**
|
||||
* Dispose the remapping.
|
||||
@ -6074,10 +6033,7 @@ CINDEX_LINKAGE void clang_remap_dispose(CXRemapping);
|
||||
* @{
|
||||
*/
|
||||
|
||||
enum CXVisitorResult {
|
||||
CXVisit_Break,
|
||||
CXVisit_Continue
|
||||
};
|
||||
enum CXVisitorResult { CXVisit_Break, CXVisit_Continue };
|
||||
|
||||
typedef struct CXCursorAndRangeVisitor {
|
||||
void *context;
|
||||
@ -6115,8 +6071,8 @@ typedef enum {
|
||||
*
|
||||
* \returns one of the CXResult enumerators.
|
||||
*/
|
||||
CINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file,
|
||||
CXCursorAndRangeVisitor visitor);
|
||||
CINDEX_LINKAGE CXResult clang_findReferencesInFile(
|
||||
CXCursor cursor, CXFile file, CXCursorAndRangeVisitor visitor);
|
||||
|
||||
/**
|
||||
* Find #import/#include directives in a specific file.
|
||||
@ -6130,15 +6086,14 @@ CINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file,
|
||||
*
|
||||
* \returns one of the CXResult enumerators.
|
||||
*/
|
||||
CINDEX_LINKAGE CXResult clang_findIncludesInFile(CXTranslationUnit TU,
|
||||
CXFile file,
|
||||
CXCursorAndRangeVisitor visitor);
|
||||
CINDEX_LINKAGE CXResult clang_findIncludesInFile(
|
||||
CXTranslationUnit TU, CXFile file, CXCursorAndRangeVisitor visitor);
|
||||
|
||||
#ifdef __has_feature
|
||||
#if __has_feature(blocks)
|
||||
|
||||
typedef enum CXVisitorResult
|
||||
(^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange);
|
||||
typedef enum CXVisitorResult (^CXCursorAndRangeVisitorBlock)(CXCursor,
|
||||
CXSourceRange);
|
||||
|
||||
CINDEX_LINKAGE
|
||||
CXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile,
|
||||
@ -6325,9 +6280,7 @@ typedef struct {
|
||||
CXIdxLoc classLoc;
|
||||
} CXIdxIBOutletCollectionAttrInfo;
|
||||
|
||||
typedef enum {
|
||||
CXIdxDeclFlag_Skipped = 0x1
|
||||
} CXIdxDeclInfoFlags;
|
||||
typedef enum { CXIdxDeclFlag_Skipped = 0x1 } CXIdxDeclInfoFlags;
|
||||
|
||||
typedef struct {
|
||||
const CXIdxEntityInfo *entityInfo;
|
||||
@ -6496,11 +6449,10 @@ typedef struct {
|
||||
/**
|
||||
* Called at the end of indexing; passes the complete diagnostic set.
|
||||
*/
|
||||
void (*diagnostic)(CXClientData client_data,
|
||||
CXDiagnosticSet, void *reserved);
|
||||
void (*diagnostic)(CXClientData client_data, CXDiagnosticSet, void *reserved);
|
||||
|
||||
CXIdxClientFile (*enteredMainFile)(CXClientData client_data,
|
||||
CXFile mainFile, void *reserved);
|
||||
CXIdxClientFile (*enteredMainFile)(CXClientData client_data, CXFile mainFile,
|
||||
void *reserved);
|
||||
|
||||
/**
|
||||
* Called when a file gets \#included/\#imported.
|
||||
@ -6525,8 +6477,7 @@ typedef struct {
|
||||
CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data,
|
||||
void *reserved);
|
||||
|
||||
void (*indexDeclaration)(CXClientData client_data,
|
||||
const CXIdxDeclInfo *);
|
||||
void (*indexDeclaration)(CXClientData client_data, const CXIdxDeclInfo *);
|
||||
|
||||
/**
|
||||
* Called to index a reference of an entity.
|
||||
@ -6570,8 +6521,8 @@ clang_index_getClientContainer(const CXIdxContainerInfo *);
|
||||
* For setting a custom CXIdxClientContainer attached to a
|
||||
* container.
|
||||
*/
|
||||
CINDEX_LINKAGE void
|
||||
clang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer);
|
||||
CINDEX_LINKAGE void clang_index_setClientContainer(const CXIdxContainerInfo *,
|
||||
CXIdxClientContainer);
|
||||
|
||||
/**
|
||||
* For retrieving a custom CXIdxClientEntity attached to an entity.
|
||||
@ -6582,8 +6533,8 @@ clang_index_getClientEntity(const CXIdxEntityInfo *);
|
||||
/**
|
||||
* For setting a custom CXIdxClientEntity attached to an entity.
|
||||
*/
|
||||
CINDEX_LINKAGE void
|
||||
clang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity);
|
||||
CINDEX_LINKAGE void clang_index_setClientEntity(const CXIdxEntityInfo *,
|
||||
CXIdxClientEntity);
|
||||
|
||||
/**
|
||||
* An indexing action/session, to be applied to one or multiple
|
||||
@ -6671,18 +6622,12 @@ typedef enum {
|
||||
*
|
||||
* The rest of the parameters are the same as #clang_parseTranslationUnit.
|
||||
*/
|
||||
CINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction,
|
||||
CXClientData client_data,
|
||||
IndexerCallbacks *index_callbacks,
|
||||
unsigned index_callbacks_size,
|
||||
unsigned index_options,
|
||||
const char *source_filename,
|
||||
const char * const *command_line_args,
|
||||
int num_command_line_args,
|
||||
struct CXUnsavedFile *unsaved_files,
|
||||
unsigned num_unsaved_files,
|
||||
CXTranslationUnit *out_TU,
|
||||
unsigned TU_options);
|
||||
CINDEX_LINKAGE int clang_indexSourceFile(
|
||||
CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks,
|
||||
unsigned index_callbacks_size, unsigned index_options,
|
||||
const char *source_filename, const char *const *command_line_args,
|
||||
int num_command_line_args, struct CXUnsavedFile *unsaved_files,
|
||||
unsigned num_unsaved_files, CXTranslationUnit *out_TU, unsigned TU_options);
|
||||
|
||||
/**
|
||||
* Same as clang_indexSourceFile but requires a full command line
|
||||
@ -6712,12 +6657,9 @@ CINDEX_LINKAGE int clang_indexSourceFileFullArgv(
|
||||
* \returns If there is a failure from which there is no recovery, returns
|
||||
* non-zero, otherwise returns 0.
|
||||
*/
|
||||
CINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction,
|
||||
CXClientData client_data,
|
||||
IndexerCallbacks *index_callbacks,
|
||||
unsigned index_callbacks_size,
|
||||
unsigned index_options,
|
||||
CXTranslationUnit);
|
||||
CINDEX_LINKAGE int clang_indexTranslationUnit(
|
||||
CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks,
|
||||
unsigned index_callbacks_size, unsigned index_options, CXTranslationUnit);
|
||||
|
||||
/**
|
||||
* Retrieve the CXIdxFile, file, line, column, and offset represented by
|
||||
@ -6729,8 +6671,7 @@ CINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction,
|
||||
*/
|
||||
CINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc,
|
||||
CXIdxClientFile *indexFile,
|
||||
CXFile *file,
|
||||
unsigned *line,
|
||||
CXFile *file, unsigned *line,
|
||||
unsigned *column,
|
||||
unsigned *offset);
|
||||
|
||||
@ -6773,8 +6714,7 @@ typedef enum CXVisitorResult (*CXFieldVisitor)(CXCursor C,
|
||||
* \returns a non-zero value if the traversal was terminated
|
||||
* prematurely by the visitor returning \c CXFieldVisit_Break.
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_Type_visitFields(CXType T,
|
||||
CXFieldVisitor visitor,
|
||||
CINDEX_LINKAGE unsigned clang_Type_visitFields(CXType T, CXFieldVisitor visitor,
|
||||
CXClientData client_data);
|
||||
|
||||
/**
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,9 +12,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "CXTranslationUnit.h"
|
||||
#include "CXCursor.h"
|
||||
#include "CXString.h"
|
||||
#include "CXTranslationUnit.h"
|
||||
#include "CXType.h"
|
||||
#include "clang-c/Index.h"
|
||||
#include "clang/AST/Attr.h"
|
||||
@ -40,48 +40,90 @@ CXCursor cxcursor::MakeCXCursorInvalid(CXCursorKind K, CXTranslationUnit TU) {
|
||||
static CXCursorKind GetCursorKind(const Attr *A) {
|
||||
assert(A && "Invalid arguments!");
|
||||
switch (A->getKind()) {
|
||||
default: break;
|
||||
case attr::IBAction: return CXCursor_IBActionAttr;
|
||||
case attr::IBOutlet: return CXCursor_IBOutletAttr;
|
||||
case attr::IBOutletCollection: return CXCursor_IBOutletCollectionAttr;
|
||||
case attr::Final: return CXCursor_CXXFinalAttr;
|
||||
case attr::Override: return CXCursor_CXXOverrideAttr;
|
||||
case attr::Annotate: return CXCursor_AnnotateAttr;
|
||||
case attr::AsmLabel: return CXCursor_AsmLabelAttr;
|
||||
case attr::Packed: return CXCursor_PackedAttr;
|
||||
case attr::Pure: return CXCursor_PureAttr;
|
||||
case attr::Const: return CXCursor_ConstAttr;
|
||||
case attr::NoDuplicate: return CXCursor_NoDuplicateAttr;
|
||||
case attr::CUDAConstant: return CXCursor_CUDAConstantAttr;
|
||||
case attr::CUDADevice: return CXCursor_CUDADeviceAttr;
|
||||
case attr::CUDAGlobal: return CXCursor_CUDAGlobalAttr;
|
||||
case attr::CUDAHost: return CXCursor_CUDAHostAttr;
|
||||
case attr::CUDAShared: return CXCursor_CUDASharedAttr;
|
||||
case attr::Visibility: return CXCursor_VisibilityAttr;
|
||||
case attr::DLLExport: return CXCursor_DLLExport;
|
||||
case attr::DLLImport: return CXCursor_DLLImport;
|
||||
case attr::NSReturnsRetained: return CXCursor_NSReturnsRetained;
|
||||
case attr::NSReturnsNotRetained: return CXCursor_NSReturnsNotRetained;
|
||||
case attr::NSReturnsAutoreleased: return CXCursor_NSReturnsAutoreleased;
|
||||
case attr::NSConsumesSelf: return CXCursor_NSConsumesSelf;
|
||||
case attr::NSConsumed: return CXCursor_NSConsumed;
|
||||
case attr::ObjCException: return CXCursor_ObjCException;
|
||||
case attr::ObjCNSObject: return CXCursor_ObjCNSObject;
|
||||
case attr::ObjCIndependentClass: return CXCursor_ObjCIndependentClass;
|
||||
case attr::ObjCPreciseLifetime: return CXCursor_ObjCPreciseLifetime;
|
||||
case attr::ObjCReturnsInnerPointer: return CXCursor_ObjCReturnsInnerPointer;
|
||||
case attr::ObjCRequiresSuper: return CXCursor_ObjCRequiresSuper;
|
||||
case attr::ObjCRootClass: return CXCursor_ObjCRootClass;
|
||||
case attr::ObjCSubclassingRestricted: return CXCursor_ObjCSubclassingRestricted;
|
||||
case attr::ObjCExplicitProtocolImpl: return CXCursor_ObjCExplicitProtocolImpl;
|
||||
case attr::ObjCDesignatedInitializer: return CXCursor_ObjCDesignatedInitializer;
|
||||
case attr::ObjCRuntimeVisible: return CXCursor_ObjCRuntimeVisible;
|
||||
case attr::ObjCBoxable: return CXCursor_ObjCBoxable;
|
||||
case attr::FlagEnum: return CXCursor_FlagEnum;
|
||||
case attr::Convergent: return CXCursor_ConvergentAttr;
|
||||
case attr::WarnUnused: return CXCursor_WarnUnusedAttr;
|
||||
case attr::WarnUnusedResult: return CXCursor_WarnUnusedResultAttr;
|
||||
case attr::Aligned: return CXCursor_AlignedAttr;
|
||||
default:
|
||||
break;
|
||||
case attr::IBAction:
|
||||
return CXCursor_IBActionAttr;
|
||||
case attr::IBOutlet:
|
||||
return CXCursor_IBOutletAttr;
|
||||
case attr::IBOutletCollection:
|
||||
return CXCursor_IBOutletCollectionAttr;
|
||||
case attr::Final:
|
||||
return CXCursor_CXXFinalAttr;
|
||||
case attr::Override:
|
||||
return CXCursor_CXXOverrideAttr;
|
||||
case attr::Annotate:
|
||||
return CXCursor_AnnotateAttr;
|
||||
case attr::AsmLabel:
|
||||
return CXCursor_AsmLabelAttr;
|
||||
case attr::Packed:
|
||||
return CXCursor_PackedAttr;
|
||||
case attr::Pure:
|
||||
return CXCursor_PureAttr;
|
||||
case attr::Const:
|
||||
return CXCursor_ConstAttr;
|
||||
case attr::NoDuplicate:
|
||||
return CXCursor_NoDuplicateAttr;
|
||||
case attr::CUDAConstant:
|
||||
return CXCursor_CUDAConstantAttr;
|
||||
case attr::CUDADevice:
|
||||
return CXCursor_CUDADeviceAttr;
|
||||
case attr::CUDAGlobal:
|
||||
return CXCursor_CUDAGlobalAttr;
|
||||
case attr::CUDAHost:
|
||||
return CXCursor_CUDAHostAttr;
|
||||
case attr::CUDAShared:
|
||||
return CXCursor_CUDASharedAttr;
|
||||
case attr::Visibility:
|
||||
return CXCursor_VisibilityAttr;
|
||||
case attr::DLLExport:
|
||||
return CXCursor_DLLExport;
|
||||
case attr::DLLImport:
|
||||
return CXCursor_DLLImport;
|
||||
case attr::NSReturnsRetained:
|
||||
return CXCursor_NSReturnsRetained;
|
||||
case attr::NSReturnsNotRetained:
|
||||
return CXCursor_NSReturnsNotRetained;
|
||||
case attr::NSReturnsAutoreleased:
|
||||
return CXCursor_NSReturnsAutoreleased;
|
||||
case attr::NSConsumesSelf:
|
||||
return CXCursor_NSConsumesSelf;
|
||||
case attr::NSConsumed:
|
||||
return CXCursor_NSConsumed;
|
||||
case attr::ObjCException:
|
||||
return CXCursor_ObjCException;
|
||||
case attr::ObjCNSObject:
|
||||
return CXCursor_ObjCNSObject;
|
||||
case attr::ObjCIndependentClass:
|
||||
return CXCursor_ObjCIndependentClass;
|
||||
case attr::ObjCPreciseLifetime:
|
||||
return CXCursor_ObjCPreciseLifetime;
|
||||
case attr::ObjCReturnsInnerPointer:
|
||||
return CXCursor_ObjCReturnsInnerPointer;
|
||||
case attr::ObjCRequiresSuper:
|
||||
return CXCursor_ObjCRequiresSuper;
|
||||
case attr::ObjCRootClass:
|
||||
return CXCursor_ObjCRootClass;
|
||||
case attr::ObjCSubclassingRestricted:
|
||||
return CXCursor_ObjCSubclassingRestricted;
|
||||
case attr::ObjCExplicitProtocolImpl:
|
||||
return CXCursor_ObjCExplicitProtocolImpl;
|
||||
case attr::ObjCDesignatedInitializer:
|
||||
return CXCursor_ObjCDesignatedInitializer;
|
||||
case attr::ObjCRuntimeVisible:
|
||||
return CXCursor_ObjCRuntimeVisible;
|
||||
case attr::ObjCBoxable:
|
||||
return CXCursor_ObjCBoxable;
|
||||
case attr::FlagEnum:
|
||||
return CXCursor_FlagEnum;
|
||||
case attr::Convergent:
|
||||
return CXCursor_ConvergentAttr;
|
||||
case attr::WarnUnused:
|
||||
return CXCursor_WarnUnusedAttr;
|
||||
case attr::WarnUnusedResult:
|
||||
return CXCursor_WarnUnusedResultAttr;
|
||||
case attr::Aligned:
|
||||
return CXCursor_AlignedAttr;
|
||||
}
|
||||
|
||||
return CXCursor_UnexposedAttr;
|
||||
@ -114,7 +156,8 @@ CXCursor cxcursor::MakeCXCursor(const Decl *D, CXTranslationUnit TU,
|
||||
if (I != SelLocs.end())
|
||||
SelectorIdIndex = I - SelLocs.begin();
|
||||
}
|
||||
CXCursor C = { K, SelectorIdIndex,
|
||||
CXCursor C = {K,
|
||||
SelectorIdIndex,
|
||||
{D, (void *)(intptr_t)(FirstInDeclGroup ? 1 : 0), TU}};
|
||||
return C;
|
||||
}
|
||||
@ -303,8 +346,8 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent,
|
||||
break;
|
||||
|
||||
case Stmt::PseudoObjectExprClass:
|
||||
return MakeCXCursor(cast<PseudoObjectExpr>(S)->getSyntacticForm(),
|
||||
Parent, TU, RegionOfInterest);
|
||||
return MakeCXCursor(cast<PseudoObjectExpr>(S)->getSyntacticForm(), Parent,
|
||||
TU, RegionOfInterest);
|
||||
|
||||
case Stmt::CompoundStmtClass:
|
||||
K = CXCursor_CompoundStmt;
|
||||
@ -355,8 +398,8 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent,
|
||||
break;
|
||||
|
||||
case Stmt::ConstantExprClass:
|
||||
return MakeCXCursor(cast<ConstantExpr>(S)->getSubExpr(),
|
||||
Parent, TU, RegionOfInterest);
|
||||
return MakeCXCursor(cast<ConstantExpr>(S)->getSubExpr(), Parent, TU,
|
||||
RegionOfInterest);
|
||||
|
||||
case Stmt::ParenExprClass:
|
||||
K = CXCursor_ParenExpr;
|
||||
@ -509,8 +552,8 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent,
|
||||
break;
|
||||
|
||||
case Stmt::DeclRefExprClass:
|
||||
if (const ImplicitParamDecl *IPD =
|
||||
dyn_cast_or_null<ImplicitParamDecl>(cast<DeclRefExpr>(S)->getDecl())) {
|
||||
if (const ImplicitParamDecl *IPD = dyn_cast_or_null<ImplicitParamDecl>(
|
||||
cast<DeclRefExpr>(S)->getDecl())) {
|
||||
if (const ObjCMethodDecl *MD =
|
||||
dyn_cast<ObjCMethodDecl>(IPD->getDeclContext())) {
|
||||
if (MD->getSelfDecl() == IPD) {
|
||||
@ -865,7 +908,8 @@ cxcursor::getCursorVariableRef(CXCursor C) {
|
||||
SourceLocation::getFromPtrEncoding(C.data[1]));
|
||||
}
|
||||
|
||||
CXCursor cxcursor::MakeCursorMemberRef(const FieldDecl *Field, SourceLocation Loc,
|
||||
CXCursor cxcursor::MakeCursorMemberRef(const FieldDecl *Field,
|
||||
SourceLocation Loc,
|
||||
CXTranslationUnit TU) {
|
||||
|
||||
assert(Field && TU && "Invalid arguments!");
|
||||
@ -894,11 +938,10 @@ const CXXBaseSpecifier *cxcursor::getCursorCXXBaseSpecifier(CXCursor C) {
|
||||
|
||||
CXCursor cxcursor::MakePreprocessingDirectiveCursor(SourceRange Range,
|
||||
CXTranslationUnit TU) {
|
||||
CXCursor C = { CXCursor_PreprocessingDirective, 0,
|
||||
{ Range.getBegin().getPtrEncoding(),
|
||||
Range.getEnd().getPtrEncoding(),
|
||||
TU }
|
||||
};
|
||||
CXCursor C = {
|
||||
CXCursor_PreprocessingDirective,
|
||||
0,
|
||||
{Range.getBegin().getPtrEncoding(), Range.getEnd().getPtrEncoding(), TU}};
|
||||
return C;
|
||||
}
|
||||
|
||||
@ -985,9 +1028,7 @@ CXCursor cxcursor::MakeCursorOverloadedDeclRef(const OverloadExpr *E,
|
||||
OverloadedDeclRefStorage Storage(E);
|
||||
void *RawLoc = E->getNameLoc().getPtrEncoding();
|
||||
CXCursor C = {
|
||||
CXCursor_OverloadedDeclRef, 0,
|
||||
{ Storage.getOpaqueValue(), RawLoc, TU }
|
||||
};
|
||||
CXCursor_OverloadedDeclRef, 0, {Storage.getOpaqueValue(), RawLoc, TU}};
|
||||
return C;
|
||||
}
|
||||
|
||||
@ -998,9 +1039,7 @@ CXCursor cxcursor::MakeCursorOverloadedDeclRef(const Decl *D,
|
||||
void *RawLoc = Loc.getPtrEncoding();
|
||||
OverloadedDeclRefStorage Storage(D);
|
||||
CXCursor C = {
|
||||
CXCursor_OverloadedDeclRef, 0,
|
||||
{ Storage.getOpaqueValue(), RawLoc, TU }
|
||||
};
|
||||
CXCursor_OverloadedDeclRef, 0, {Storage.getOpaqueValue(), RawLoc, TU}};
|
||||
return C;
|
||||
}
|
||||
|
||||
@ -1011,9 +1050,7 @@ CXCursor cxcursor::MakeCursorOverloadedDeclRef(TemplateName Name,
|
||||
void *RawLoc = Loc.getPtrEncoding();
|
||||
OverloadedDeclRefStorage Storage(Name.getAsOverloadedTemplate());
|
||||
CXCursor C = {
|
||||
CXCursor_OverloadedDeclRef, 0,
|
||||
{ Storage.getOpaqueValue(), RawLoc, TU }
|
||||
};
|
||||
CXCursor_OverloadedDeclRef, 0, {Storage.getOpaqueValue(), RawLoc, TU}};
|
||||
return C;
|
||||
}
|
||||
|
||||
@ -1072,8 +1109,9 @@ void cxcursor::getOverriddenCursors(CXCursor cursor,
|
||||
SmallVector<const NamedDecl *, 8> OverDecls;
|
||||
D->getASTContext().getOverriddenMethods(D, OverDecls);
|
||||
|
||||
for (SmallVectorImpl<const NamedDecl *>::iterator
|
||||
I = OverDecls.begin(), E = OverDecls.end(); I != E; ++I) {
|
||||
for (SmallVectorImpl<const NamedDecl *>::iterator I = OverDecls.begin(),
|
||||
E = OverDecls.end();
|
||||
I != E; ++I) {
|
||||
overridden.push_back(MakeCXCursor(*I, TU));
|
||||
}
|
||||
}
|
||||
@ -1101,16 +1139,16 @@ CXCursor cxcursor::getSelectorIdentifierCursor(int SelIdx, CXCursor cursor) {
|
||||
|
||||
if (cursor.kind == CXCursor_ObjCMessageExpr) {
|
||||
if (SelIdx == -1 ||
|
||||
unsigned(SelIdx) >= cast<ObjCMessageExpr>(getCursorExpr(cursor))
|
||||
->getNumSelectorLocs())
|
||||
unsigned(SelIdx) >=
|
||||
cast<ObjCMessageExpr>(getCursorExpr(cursor))->getNumSelectorLocs())
|
||||
newCursor.xdata = -1;
|
||||
else
|
||||
newCursor.xdata = SelIdx;
|
||||
} else if (cursor.kind == CXCursor_ObjCClassMethodDecl ||
|
||||
cursor.kind == CXCursor_ObjCInstanceMethodDecl) {
|
||||
if (SelIdx == -1 ||
|
||||
unsigned(SelIdx) >= cast<ObjCMethodDecl>(getCursorDecl(cursor))
|
||||
->getNumSelectorLocs())
|
||||
unsigned(SelIdx) >=
|
||||
cast<ObjCMethodDecl>(getCursorDecl(cursor))->getNumSelectorLocs())
|
||||
newCursor.xdata = -1;
|
||||
else
|
||||
newCursor.xdata = SelIdx;
|
||||
@ -1128,8 +1166,8 @@ CXCursor cxcursor::getTypeRefCursor(CXCursor cursor) {
|
||||
|
||||
const Expr *E = getCursorExpr(cursor);
|
||||
TypeSourceInfo *Type = nullptr;
|
||||
if (const CXXUnresolvedConstructExpr *
|
||||
UnCtor = dyn_cast<CXXUnresolvedConstructExpr>(E)) {
|
||||
if (const CXXUnresolvedConstructExpr *UnCtor =
|
||||
dyn_cast<CXXUnresolvedConstructExpr>(E)) {
|
||||
Type = UnCtor->getTypeSourceInfo();
|
||||
} else if (const CXXTemporaryObjectExpr *Tmp =
|
||||
dyn_cast<CXXTemporaryObjectExpr>(E)) {
|
||||
@ -1224,15 +1262,13 @@ CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i) {
|
||||
const Expr *E = cxcursor::getCursorExpr(C);
|
||||
if (const CallExpr *CE = dyn_cast<CallExpr>(E)) {
|
||||
if (i < CE->getNumArgs()) {
|
||||
return cxcursor::MakeCXCursor(CE->getArg(i),
|
||||
getCursorDecl(C),
|
||||
return cxcursor::MakeCXCursor(CE->getArg(i), getCursorDecl(C),
|
||||
cxcursor::getCursorTU(C));
|
||||
}
|
||||
}
|
||||
if (const CXXConstructExpr *CE = dyn_cast<CXXConstructExpr>(E)) {
|
||||
if (i < CE->getNumArgs()) {
|
||||
return cxcursor::MakeCXCursor(CE->getArg(i),
|
||||
getCursorDecl(C),
|
||||
return cxcursor::MakeCXCursor(CE->getArg(i), getCursorDecl(C),
|
||||
cxcursor::getCursorTU(C));
|
||||
}
|
||||
}
|
||||
@ -1246,8 +1282,8 @@ int clang_Cursor_getNumTemplateArguments(CXCursor C) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const FunctionDecl *FD = llvm::dyn_cast_or_null<clang::FunctionDecl>(
|
||||
getCursorDecl(C));
|
||||
const FunctionDecl *FD =
|
||||
llvm::dyn_cast_or_null<clang::FunctionDecl>(getCursorDecl(C));
|
||||
if (!FD) {
|
||||
return -1;
|
||||
}
|
||||
@ -1278,14 +1314,14 @@ enum CXGetTemplateArgumentStatus {
|
||||
CXGetTemplateArgumentStatus_InvalidIndex = -4
|
||||
};
|
||||
|
||||
static int clang_Cursor_getTemplateArgument(
|
||||
CXCursor C, unsigned I, TemplateArgument *TA) {
|
||||
static int clang_Cursor_getTemplateArgument(CXCursor C, unsigned I,
|
||||
TemplateArgument *TA) {
|
||||
if (clang_getCursorKind(C) != CXCursor_FunctionDecl) {
|
||||
return CXGetTemplateArgumentStatus_CursorNotFunctionDecl;
|
||||
}
|
||||
|
||||
const FunctionDecl *FD = llvm::dyn_cast_or_null<clang::FunctionDecl>(
|
||||
getCursorDecl(C));
|
||||
const FunctionDecl *FD =
|
||||
llvm::dyn_cast_or_null<clang::FunctionDecl>(getCursorDecl(C));
|
||||
if (!FD) {
|
||||
return CXGetTemplateArgumentStatus_BadFunctionDeclCast;
|
||||
}
|
||||
@ -1312,17 +1348,24 @@ enum CXTemplateArgumentKind clang_Cursor_getTemplateArgumentKind(CXCursor C,
|
||||
}
|
||||
|
||||
switch (TA.getKind()) {
|
||||
case TemplateArgument::Null: return CXTemplateArgumentKind_Null;
|
||||
case TemplateArgument::Type: return CXTemplateArgumentKind_Type;
|
||||
case TemplateArgument::Null:
|
||||
return CXTemplateArgumentKind_Null;
|
||||
case TemplateArgument::Type:
|
||||
return CXTemplateArgumentKind_Type;
|
||||
case TemplateArgument::Declaration:
|
||||
return CXTemplateArgumentKind_Declaration;
|
||||
case TemplateArgument::NullPtr: return CXTemplateArgumentKind_NullPtr;
|
||||
case TemplateArgument::Integral: return CXTemplateArgumentKind_Integral;
|
||||
case TemplateArgument::Template: return CXTemplateArgumentKind_Template;
|
||||
case TemplateArgument::NullPtr:
|
||||
return CXTemplateArgumentKind_NullPtr;
|
||||
case TemplateArgument::Integral:
|
||||
return CXTemplateArgumentKind_Integral;
|
||||
case TemplateArgument::Template:
|
||||
return CXTemplateArgumentKind_Template;
|
||||
case TemplateArgument::TemplateExpansion:
|
||||
return CXTemplateArgumentKind_TemplateExpansion;
|
||||
case TemplateArgument::Expression: return CXTemplateArgumentKind_Expression;
|
||||
case TemplateArgument::Pack: return CXTemplateArgumentKind_Pack;
|
||||
case TemplateArgument::Expression:
|
||||
return CXTemplateArgumentKind_Expression;
|
||||
case TemplateArgument::Pack:
|
||||
return CXTemplateArgumentKind_Pack;
|
||||
}
|
||||
|
||||
return CXTemplateArgumentKind_Invalid;
|
||||
@ -1397,16 +1440,14 @@ public:
|
||||
return MakeCXCursorInvalid(CXCursor_NoDeclFound);
|
||||
}
|
||||
static inline unsigned getHashValue(const CXCursor &cursor) {
|
||||
return llvm::DenseMapInfo<std::pair<const void *, const void *> >
|
||||
::getHashValue(std::make_pair(cursor.data[0], cursor.data[1]));
|
||||
return llvm::DenseMapInfo<std::pair<const void *, const void *>>::
|
||||
getHashValue(std::make_pair(cursor.data[0], cursor.data[1]));
|
||||
}
|
||||
static inline bool isEqual(const CXCursor &x, const CXCursor &y) {
|
||||
return x.kind == y.kind &&
|
||||
x.data[0] == y.data[0] &&
|
||||
x.data[1] == y.data[1];
|
||||
return x.kind == y.kind && x.data[0] == y.data[0] && x.data[1] == y.data[1];
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace llvm
|
||||
|
||||
CXCursorSet clang_createCXCursorSet() {
|
||||
return packCXCursorSet(new CXCursorSet_Impl());
|
||||
@ -1445,13 +1486,11 @@ CXCompletionString clang_getCursorCompletionString(CXCursor cursor) {
|
||||
if (const NamedDecl *namedDecl = dyn_cast_or_null<NamedDecl>(decl)) {
|
||||
ASTUnit *unit = getCursorASTUnit(cursor);
|
||||
CodeCompletionResult Result(namedDecl, CCP_Declaration);
|
||||
CodeCompletionString *String
|
||||
= Result.CreateCodeCompletionString(unit->getASTContext(),
|
||||
unit->getPreprocessor(),
|
||||
CodeCompletionString *String = Result.CreateCodeCompletionString(
|
||||
unit->getASTContext(), unit->getPreprocessor(),
|
||||
CodeCompletionContext::CCC_Other,
|
||||
unit->getCodeCompletionTUInfo().getAllocator(),
|
||||
unit->getCodeCompletionTUInfo(),
|
||||
true);
|
||||
unit->getCodeCompletionTUInfo(), true);
|
||||
return String;
|
||||
}
|
||||
} else if (kind == CXCursor_MacroDefinition) {
|
||||
@ -1479,12 +1518,13 @@ namespace {
|
||||
|
||||
~OverridenCursorsPool() {
|
||||
for (std::vector<CursorVec *>::iterator I = AllCursors.begin(),
|
||||
E = AllCursors.end(); I != E; ++I) {
|
||||
E = AllCursors.end();
|
||||
I != E; ++I) {
|
||||
delete *I;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void *cxcursor::createOverridenCXCursorsPool() {
|
||||
return new OverridenCursorsPool();
|
||||
@ -1494,8 +1534,7 @@ void cxcursor::disposeOverridenCXCursorsPool(void *pool) {
|
||||
delete static_cast<OverridenCursorsPool *>(pool);
|
||||
}
|
||||
|
||||
void clang_getOverriddenCursors(CXCursor cursor,
|
||||
CXCursor **overridden,
|
||||
void clang_getOverriddenCursors(CXCursor cursor, CXCursor **overridden,
|
||||
unsigned *num_overridden) {
|
||||
if (overridden)
|
||||
*overridden = nullptr;
|
||||
@ -1518,8 +1557,7 @@ void clang_getOverriddenCursors(CXCursor cursor,
|
||||
if (!pool.AvailableCursors.empty()) {
|
||||
Vec = pool.AvailableCursors.back();
|
||||
pool.AvailableCursors.pop_back();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Vec = new OverridenCursorsPool::CursorVec();
|
||||
pool.AllCursors.push_back(Vec);
|
||||
}
|
||||
@ -1600,8 +1638,8 @@ int clang_Cursor_isDynamicCall(CXCursor C) {
|
||||
ME = dyn_cast_or_null<MemberExpr>(CE->getCallee());
|
||||
|
||||
if (ME) {
|
||||
if (const CXXMethodDecl *
|
||||
MD = dyn_cast_or_null<CXXMethodDecl>(ME->getMemberDecl()))
|
||||
if (const CXXMethodDecl *MD =
|
||||
dyn_cast_or_null<CXXMethodDecl>(ME->getMemberDecl()))
|
||||
return MD->isVirtual() &&
|
||||
ME->performsVirtualDispatch(
|
||||
cxcursor::getCursorContext(C).getLangOpts());
|
||||
|
@ -59,8 +59,7 @@ CXCursor MakeCXCursorInvalid(CXCursorKind K, CXTranslationUnit TU = nullptr);
|
||||
|
||||
/// Create an Objective-C superclass reference at the given location.
|
||||
CXCursor MakeCursorObjCSuperClassRef(ObjCInterfaceDecl *Super,
|
||||
SourceLocation Loc,
|
||||
CXTranslationUnit TU);
|
||||
SourceLocation Loc, CXTranslationUnit TU);
|
||||
|
||||
/// Unpack an ObjCSuperClassRef cursor into the interface it references
|
||||
/// and optionally the location where the reference occurred.
|
||||
@ -69,8 +68,7 @@ std::pair<const ObjCInterfaceDecl *, SourceLocation>
|
||||
|
||||
/// Create an Objective-C protocol reference at the given location.
|
||||
CXCursor MakeCursorObjCProtocolRef(const ObjCProtocolDecl *Proto,
|
||||
SourceLocation Loc,
|
||||
CXTranslationUnit TU);
|
||||
SourceLocation Loc, CXTranslationUnit TU);
|
||||
|
||||
/// Unpack an ObjCProtocolRef cursor into the protocol it references
|
||||
/// and optionally the location where the reference occurred.
|
||||
@ -79,8 +77,7 @@ std::pair<const ObjCProtocolDecl *, SourceLocation>
|
||||
|
||||
/// Create an Objective-C class reference at the given location.
|
||||
CXCursor MakeCursorObjCClassRef(const ObjCInterfaceDecl *Class,
|
||||
SourceLocation Loc,
|
||||
CXTranslationUnit TU);
|
||||
SourceLocation Loc, CXTranslationUnit TU);
|
||||
|
||||
/// Unpack an ObjCClassRef cursor into the class it references
|
||||
/// and optionally the location where the reference occurred.
|
||||
@ -284,14 +281,13 @@ bool getDeclCursorUSR(const Decl *D, SmallVectorImpl<char> &Buf);
|
||||
|
||||
bool operator==(CXCursor X, CXCursor Y);
|
||||
|
||||
inline bool operator!=(CXCursor X, CXCursor Y) {
|
||||
return !(X == Y);
|
||||
}
|
||||
inline bool operator!=(CXCursor X, CXCursor Y) { return !(X == Y); }
|
||||
|
||||
/// Return true if the cursor represents a declaration that is the
|
||||
/// first in a declaration group.
|
||||
bool isFirstInDeclGroup(CXCursor C);
|
||||
|
||||
}} // end namespace: clang::cxcursor
|
||||
} // namespace cxcursor
|
||||
} // namespace clang
|
||||
|
||||
#endif
|
||||
|
@ -23,14 +23,23 @@ namespace cxcursor {
|
||||
|
||||
class VisitorJob {
|
||||
public:
|
||||
enum Kind { DeclVisitKind, StmtVisitKind, MemberExprPartsKind,
|
||||
TypeLocVisitKind, OverloadExprPartsKind,
|
||||
DeclRefExprPartsKind, LabelRefVisitKind,
|
||||
enum Kind {
|
||||
DeclVisitKind,
|
||||
StmtVisitKind,
|
||||
MemberExprPartsKind,
|
||||
TypeLocVisitKind,
|
||||
OverloadExprPartsKind,
|
||||
DeclRefExprPartsKind,
|
||||
LabelRefVisitKind,
|
||||
ExplicitTemplateArgsVisitKind,
|
||||
NestedNameSpecifierLocVisitKind,
|
||||
DeclarationNameInfoVisitKind,
|
||||
MemberRefVisitKind, SizeOfPackExprPartsKind,
|
||||
LambdaExprPartsKind, PostChildrenVisitKind };
|
||||
MemberRefVisitKind,
|
||||
SizeOfPackExprPartsKind,
|
||||
LambdaExprPartsKind,
|
||||
PostChildrenVisitKind
|
||||
};
|
||||
|
||||
protected:
|
||||
const void *data[3];
|
||||
CXCursor parent;
|
||||
@ -42,6 +51,7 @@ protected:
|
||||
data[1] = d2;
|
||||
data[2] = d3;
|
||||
}
|
||||
|
||||
public:
|
||||
Kind getKind() const { return K; }
|
||||
const CXCursor &getParent() const { return parent; }
|
||||
@ -51,8 +61,7 @@ typedef SmallVector<VisitorJob, 10> VisitorWorkList;
|
||||
|
||||
// Cursor visitor.
|
||||
class CursorVisitor : public DeclVisitor<CursorVisitor, bool>,
|
||||
public TypeLocVisitor<CursorVisitor, bool>
|
||||
{
|
||||
public TypeLocVisitor<CursorVisitor, bool> {
|
||||
public:
|
||||
/// Callback called after child nodes of a cursor have been visited.
|
||||
/// Return true to break visitation or false to continue.
|
||||
@ -123,10 +132,8 @@ private:
|
||||
CXCursor OldParent;
|
||||
|
||||
public:
|
||||
SetParentRAII(CXCursor &Parent, const Decl *&StmtParent,
|
||||
CXCursor NewParent)
|
||||
: Parent(Parent), StmtParent(StmtParent), OldParent(Parent)
|
||||
{
|
||||
SetParentRAII(CXCursor &Parent, const Decl *&StmtParent, CXCursor NewParent)
|
||||
: Parent(Parent), StmtParent(StmtParent), OldParent(Parent) {
|
||||
Parent = NewParent;
|
||||
if (clang_isDeclaration(Parent.kind))
|
||||
StmtParent = getCursorDecl(Parent);
|
||||
@ -141,21 +148,17 @@ private:
|
||||
|
||||
public:
|
||||
CursorVisitor(CXTranslationUnit TU, CXCursorVisitor Visitor,
|
||||
CXClientData ClientData,
|
||||
bool VisitPreprocessorLast,
|
||||
CXClientData ClientData, bool VisitPreprocessorLast,
|
||||
bool VisitIncludedPreprocessingEntries = false,
|
||||
SourceRange RegionOfInterest = SourceRange(),
|
||||
bool VisitDeclsOnly = false,
|
||||
PostChildrenVisitorTy PostChildrenVisitor = nullptr)
|
||||
: TU(TU), AU(cxtu::getASTUnit(TU)),
|
||||
Visitor(Visitor), PostChildrenVisitor(PostChildrenVisitor),
|
||||
ClientData(ClientData),
|
||||
: TU(TU), AU(cxtu::getASTUnit(TU)), Visitor(Visitor),
|
||||
PostChildrenVisitor(PostChildrenVisitor), ClientData(ClientData),
|
||||
VisitPreprocessorLast(VisitPreprocessorLast),
|
||||
VisitIncludedEntities(VisitIncludedPreprocessingEntries),
|
||||
RegionOfInterest(RegionOfInterest),
|
||||
VisitDeclsOnly(VisitDeclsOnly),
|
||||
DI_current(nullptr), FileDI_current(nullptr)
|
||||
{
|
||||
RegionOfInterest(RegionOfInterest), VisitDeclsOnly(VisitDeclsOnly),
|
||||
DI_current(nullptr), FileDI_current(nullptr) {
|
||||
Parent.kind = CXCursor_NoDeclFound;
|
||||
Parent.data[0] = nullptr;
|
||||
Parent.data[1] = nullptr;
|
||||
@ -165,8 +168,9 @@ public:
|
||||
|
||||
~CursorVisitor() {
|
||||
// Free the pre-allocated worklists for data-recursion.
|
||||
for (SmallVectorImpl<VisitorWorkList*>::iterator
|
||||
I = WorkListCache.begin(), E = WorkListCache.end(); I != E; ++I) {
|
||||
for (SmallVectorImpl<VisitorWorkList *>::iterator I = WorkListCache.begin(),
|
||||
E = WorkListCache.end();
|
||||
I != E; ++I) {
|
||||
delete *I;
|
||||
}
|
||||
}
|
||||
@ -182,9 +186,7 @@ public:
|
||||
|
||||
bool visitPreprocessedEntitiesInRegion();
|
||||
|
||||
bool shouldVisitIncludedEntities() const {
|
||||
return VisitIncludedEntities;
|
||||
}
|
||||
bool shouldVisitIncludedEntities() const { return VisitIncludedEntities; }
|
||||
|
||||
template <typename InputIterator>
|
||||
bool visitPreprocessedEntities(InputIterator First, InputIterator Last,
|
||||
@ -252,8 +254,7 @@ public:
|
||||
|
||||
// Type visitors
|
||||
#define ABSTRACT_TYPELOC(CLASS, PARENT)
|
||||
#define TYPELOC(CLASS, PARENT) \
|
||||
bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc);
|
||||
#define TYPELOC(CLASS, PARENT) bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc);
|
||||
#include "clang/AST/TypeLocNodes.def"
|
||||
|
||||
bool VisitTagTypeLoc(TagTypeLoc TL);
|
||||
@ -270,8 +271,7 @@ private:
|
||||
Optional<bool> handleDeclForVisitation(const Decl *D);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace cxcursor
|
||||
} // namespace clang
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user