From 3e429e7cc4180127fab09a6817baaf7aede36c33 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sat, 12 Nov 2011 02:16:30 +0000 Subject: [libclang] Further simplify the indexing API. That stuff can be added later on if we need them. Also add some const goodness. llvm-svn: 144446 --- clang/tools/libclang/IndexingContext.h | 62 ++++++++++++++-------------------- 1 file changed, 26 insertions(+), 36 deletions(-) (limited to 'clang/tools/libclang/IndexingContext.h') diff --git a/clang/tools/libclang/IndexingContext.h b/clang/tools/libclang/IndexingContext.h index 8d5f56609f0..b367b72b3a3 100644 --- a/clang/tools/libclang/IndexingContext.h +++ b/clang/tools/libclang/IndexingContext.h @@ -10,7 +10,7 @@ #include "Index_Internal.h" #include "CXCursor.h" -#include "clang/AST/Decl.h" +#include "clang/AST/DeclObjC.h" #include "clang/AST/DeclGroup.h" #include "llvm/ADT/DenseMap.h" @@ -26,16 +26,20 @@ struct DeclInfo : public CXIdxDeclInfo { CXIdxEntityInfo CXEntInfo; }; -struct TagDeclInfo : public DeclInfo { - CXIdxTagDeclInfo CXTagDeclInfo; -}; - struct ObjCContainerDeclInfo : public DeclInfo { - CXIdxObjCContainerDeclInfo CXObjCContDeclInfo; + CXIdxObjCContainerDeclInfo ObjCContDeclInfo; }; struct ObjCCategoryDeclInfo : public ObjCContainerDeclInfo { - CXIdxObjCCategoryDeclInfo CXObjCCatDeclInfo; + CXIdxObjCCategoryDeclInfo ObjCCatDeclInfo; +}; + +struct ObjCInterfaceDeclInfo : public ObjCCategoryDeclInfo { + CXIdxObjCInterfaceDeclInfo ObjCInterDeclInfo; +}; + +struct ObjCProtocolDeclInfo : public ObjCCategoryDeclInfo { + CXIdxObjCProtocolDeclInfo ObjCProtoDeclInfo; }; class IndexingContext { @@ -46,12 +50,8 @@ class IndexingContext { CXTranslationUnit CXTU; typedef llvm::DenseMap FileMapTy; - typedef llvm::DenseMap EntityMapTy; - typedef llvm::DenseMap MacroMapTy; typedef llvm::DenseMap ContainerMapTy; FileMapTy FileMap; - EntityMapTy EntityMap; - MacroMapTy MacroMap; ContainerMapTy ContainerMap; SmallVector TUDeclsInObjCContainer; @@ -87,6 +87,19 @@ class IndexingContext { SmallVectorImpl &getBuffer() { return Scratch; } }; + struct ObjCProtocolListInfo { + SmallVector ProtInfos; + SmallVector ProtEntities; + SmallVector Prots; + + CXIdxObjCProtocolRefInfo **getProtocolRefs() { return Prots.data(); } + unsigned getNumProtocols() { return (unsigned)Prots.size(); } + + ObjCProtocolListInfo(const ObjCProtocolList &ProtList, + IndexingContext &IdxCtx, + IndexingContext::StrAdapter &SA); + }; + public: IndexingContext(CXClientData clientData, IndexerCallbacks &indexCallbacks, unsigned indexOptions, CXTranslationUnit cxTU) @@ -103,19 +116,7 @@ public: StringRef filename, const FileEntry *File, bool isImport, bool isAngled); - void ppMacroDefined(SourceLocation Loc, StringRef Name, - SourceLocation DefBegin, unsigned Length, - const void *OpaqueMacro); - - void ppMacroUndefined(SourceLocation Loc, StringRef Name, - const void *OpaqueMacro); - - void ppMacroExpanded(SourceLocation Loc, StringRef Name, - const void *OpaqueMacro); - - void invokeStartedTranslationUnit(); - - void invokeFinishedTranslationUnit(); + void startedTranslationUnit(); void indexDecl(const Decl *D); @@ -148,8 +149,6 @@ public: void handleObjCClass(const ObjCClassDecl *D); void handleObjCInterface(const ObjCInterfaceDecl *D); void handleObjCImplementation(const ObjCImplementationDecl *D); - - void defineObjCInterface(const ObjCInterfaceDecl *D); void handleObjCForwardProtocol(const ObjCProtocolDecl *D, SourceLocation Loc, @@ -169,11 +168,6 @@ public: const DeclContext *DC, const Expr *E = 0, CXIdxEntityRefKind Kind = CXIdxEntityRef_Direct); - - void startContainer(const NamedDecl *D, bool isStmtBody = false, - const DeclContext *DC = 0); - - void endContainer(const DeclContext *DC); bool isNotFromSourceFile(SourceLocation Loc) const; @@ -190,7 +184,7 @@ public: private: void handleDecl(const NamedDecl *D, SourceLocation Loc, CXCursor Cursor, - bool isRedeclaration, bool isDefinition, + bool isRedeclaration, bool isDefinition, bool isContainer, DeclInfo &DInfo); void handleObjCContainer(const ObjCContainerDecl *D, @@ -200,12 +194,8 @@ private: bool isImplementation, ObjCContainerDeclInfo &ContDInfo); - void addEntityInMap(const NamedDecl *D, CXIdxClientEntity entity); - void addContainerInMap(const DeclContext *DC, CXIdxClientContainer container); - CXIdxClientEntity getClientEntity(const NamedDecl *D); - const NamedDecl *getEntityDecl(const NamedDecl *D) const; CXIdxClientContainer getIndexContainer(const NamedDecl *D) const { -- cgit v1.2.3