diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-22 07:24:51 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-22 07:24:51 +0000 |
commit | 2957e6f8c4c2e58a4b9cb639949fea801970fe36 (patch) | |
tree | 991c9f5ae0c3d296700de363b64ccea12abdb8d2 /include/clang-c | |
parent | b61968857fd2c6579b4dcd7bad65736e89d21185 (diff) |
[libclang] Indexing API: Support C++ symbols.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145058 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang-c')
-rw-r--r-- | include/clang-c/Index.h | 117 |
1 files changed, 106 insertions, 11 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index 8434ccf8cf..2745ac9bd0 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -3941,6 +3941,11 @@ void clang_findReferencesInFileWithBlock(CXCursor, CXFile, typedef void *CXIdxClientFile; /** + * \brief The client's data object that is associated with a semantic entity. + */ +typedef void *CXIdxClientEntity; + +/** * \brief The client's data object that is associated with a semantic container * of entities. */ @@ -4016,16 +4021,49 @@ typedef enum { CXIdxEntity_Enum = 13, CXIdxEntity_Struct = 14, CXIdxEntity_Union = 15, - CXIdxEntity_CXXClass = 16 + + CXIdxEntity_CXXClass = 16, + CXIdxEntity_CXXNamespace = 17, + CXIdxEntity_CXXNamespaceAlias = 18, + CXIdxEntity_CXXStaticVariable = 19, + CXIdxEntity_CXXStaticMethod = 20, + CXIdxEntity_CXXInstanceMethod = 21, + CXIdxEntity_CXXConstructor = 22, + CXIdxEntity_CXXDestructor = 23, + CXIdxEntity_CXXConversionFunction = 24, + CXIdxEntity_CXXTypeAlias = 25 } CXIdxEntityKind; +/** + * \brief Extra C++ template information for an entity. This can apply to: + * CXIdxEntity_Function + * CXIdxEntity_CXXClass + * CXIdxEntity_CXXStaticMethod + * CXIdxEntity_CXXInstanceMethod + * CXIdxEntity_CXXConstructor + * CXIdxEntity_CXXConversionFunction + * CXIdxEntity_CXXTypeAlias + */ +typedef enum { + CXIdxEntity_NonTemplate = 0, + CXIdxEntity_Template = 1, + CXIdxEntity_TemplatePartialSpecialization = 2, + CXIdxEntity_TemplateSpecialization = 3 +} CXIdxEntityCXXTemplateKind; + typedef struct { CXIdxEntityKind kind; + CXIdxEntityCXXTemplateKind templateKind; const char *name; const char *USR; + CXCursor cursor; } CXIdxEntityInfo; +typedef struct { + CXCursor cursor; +} CXIdxContainerInfo; + typedef enum { CXIdxAttr_Unexposed = 0, CXIdxAttr_IBAction = 1, @@ -4050,10 +4088,11 @@ typedef struct { const CXIdxEntityInfo *entityInfo; CXCursor cursor; CXIdxLoc loc; - CXIdxClientContainer container; + const CXIdxContainerInfo *container; int isRedeclaration; int isDefinition; int isContainer; + const CXIdxContainerInfo *declAsContainer; /** * \brief Whether the declaration exists in code or was created implicitly * by the compiler, e.g. implicit objc methods for properties. @@ -4063,10 +4102,6 @@ typedef struct { unsigned numAttributes; } CXIdxDeclInfo; -typedef struct { - CXIdxClientContainer *outContainer; -} CXIdxDeclOut; - typedef enum { CXIdxObjCContainer_ForwardRef = 0, CXIdxObjCContainer_Interface = 1, @@ -4108,6 +4143,12 @@ typedef struct { const CXIdxObjCProtocolRefListInfo *protocols; } CXIdxObjCInterfaceDeclInfo; +typedef struct { + const CXIdxDeclInfo *declInfo; + const CXIdxBaseClassInfo *const *bases; + unsigned numBases; +} CXIdxCXXClassDeclInfo; + /** * \brief Data for \see indexEntityReference callback. */ @@ -4150,7 +4191,7 @@ typedef struct { /** * \brief Container context of the reference. */ - CXIdxClientContainer container; + const CXIdxContainerInfo *container; CXIdxEntityRefKind kind; } CXIdxEntityRefInfo; @@ -4194,7 +4235,7 @@ typedef struct { void *reserved); void (*indexDeclaration)(CXClientData client_data, - const CXIdxDeclInfo *, const CXIdxDeclOut *); + const CXIdxDeclInfo *); /** * \brief Called to index a reference of an entity. @@ -4221,6 +4262,59 @@ clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *); CINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo * clang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *); +CINDEX_LINKAGE const CXIdxCXXClassDeclInfo * +clang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *); + +/** + * \brief For retrieving a custom CXIdxClientContainer attached to a + * container. + */ +CINDEX_LINKAGE CXIdxClientContainer +clang_index_getClientContainer(const CXIdxContainerInfo *); + +/** + * \brief For setting a custom CXIdxClientContainer attached to a + * container. + */ +CINDEX_LINKAGE void +clang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer); + +/** + * \brief For retrieving a custom CXIdxClientEntity attached to an entity. + */ +CINDEX_LINKAGE CXIdxClientEntity +clang_index_getClientEntity(const CXIdxEntityInfo *); + +/** + * \brief For setting a custom CXIdxClientEntity attached to an entity. + */ +CINDEX_LINKAGE void +clang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity); + +/** + * \brief An indexing action, to be applied to one or multiple translation units + * but not on concurrent threads. If there are threads doing indexing + * concurrently, they should use different CXIndexAction objects. + */ +typedef void *CXIndexAction; + +/** + * \brief An indexing action, to be applied to one or multiple translation units + * but not on concurrent threads. If there are threads doing indexing + * concurrently, they should use different CXIndexAction objects. + * + * \param CIdx The index object with which the index action will be associated. + */ +CINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx); + +/** + * \brief Destroy the given index action. + * + * The index action must not be destroyed until all of the translation units + * created within that index action have been destroyed. + */ +CINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction); + typedef enum { /** * \brief Used to indicate that no special indexing options are needed. @@ -4259,7 +4353,7 @@ typedef enum { * * The rest of the parameters are the same as \see clang_parseTranslationUnit. */ -CINDEX_LINKAGE int clang_indexSourceFile(CXIndex CIdx, +CINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks, unsigned index_callbacks_size, @@ -4288,11 +4382,12 @@ CINDEX_LINKAGE int clang_indexSourceFile(CXIndex CIdx, * \returns If there is a failure from which the there is no recovery, returns * non-zero, otherwise returns 0. */ -CINDEX_LINKAGE int clang_indexTranslationUnit(CXTranslationUnit, +CINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks, unsigned index_callbacks_size, - unsigned index_options); + unsigned index_options, + CXTranslationUnit); /** * \brief Retrieve the CXIdxFile, file, line, column, and offset represented by |