From f3e7af6d22d16e0d49c262b5fcf70e1a7821455b Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 9 Feb 2016 19:07:21 +0000 Subject: [PATCH] [libclang] indexing: handle 'TopLevelDeclInObjCContainers' at the point where they are reported. It isn't much benefit and doesn't worth the complexity to try to handle them after the container is encountered. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260254 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/libclang/IndexDecl.cpp | 16 ---------------- tools/libclang/Indexing.cpp | 5 ++--- tools/libclang/IndexingContext.h | 7 ------- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp index c8cf1d3621..aa97129c23 100644 --- a/tools/libclang/IndexDecl.cpp +++ b/tools/libclang/IndexDecl.cpp @@ -136,7 +136,6 @@ public: IndexCtx.handleObjCInterface(D); if (D->isThisDeclarationADefinition()) { - IndexCtx.indexTUDeclsInObjCContainer(); IndexCtx.indexDeclContext(D); } return true; @@ -146,7 +145,6 @@ public: IndexCtx.handleObjCProtocol(D); if (D->isThisDeclarationADefinition()) { - IndexCtx.indexTUDeclsInObjCContainer(); IndexCtx.indexDeclContext(D); } return true; @@ -162,8 +160,6 @@ public: IndexCtx.handleObjCImplementation(D); - IndexCtx.indexTUDeclsInObjCContainer(); - // Index the ivars first to make sure the synthesized ivars are indexed // before indexing the methods that can reference them. for (const auto *IvarI : D->ivars()) @@ -178,8 +174,6 @@ public: bool VisitObjCCategoryDecl(const ObjCCategoryDecl *D) { IndexCtx.handleObjCCategory(D); - - IndexCtx.indexTUDeclsInObjCContainer(); IndexCtx.indexDeclContext(D); return true; } @@ -190,8 +184,6 @@ public: return true; IndexCtx.handleObjCCategoryImpl(D); - - IndexCtx.indexTUDeclsInObjCContainer(); IndexCtx.indexDeclContext(D); return true; } @@ -347,11 +339,3 @@ void IndexingContext::indexDeclGroupRef(DeclGroupRef DG) { for (DeclGroupRef::iterator I = DG.begin(), E = DG.end(); I != E; ++I) indexTopLevelDecl(*I); } - -void IndexingContext::indexTUDeclsInObjCContainer() { - while (!TUDeclsInObjCContainer.empty()) { - DeclGroupRef DG = TUDeclsInObjCContainer.front(); - TUDeclsInObjCContainer.pop_front(); - indexDeclGroupRef(DG); - } -} diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp index d6e35b0019..4929d6244e 100644 --- a/tools/libclang/Indexing.cpp +++ b/tools/libclang/Indexing.cpp @@ -327,9 +327,8 @@ public: /// \brief Handle the specified top-level declaration that occurred inside /// and ObjC container. - void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override { - // They will be handled after the interface is seen first. - IndexCtx.addTUDeclInObjCContainer(D); + void HandleTopLevelDeclInObjCContainer(DeclGroupRef DG) override { + IndexCtx.indexDeclGroupRef(DG); } /// \brief This is called by the AST reader when deserializing things. diff --git a/tools/libclang/IndexingContext.h b/tools/libclang/IndexingContext.h index 2b1355ad32..d1d62c90d4 100644 --- a/tools/libclang/IndexingContext.h +++ b/tools/libclang/IndexingContext.h @@ -292,8 +292,6 @@ class IndexingContext { typedef std::pair RefFileOccurrence; llvm::DenseSet RefFileOccurrences; - std::deque TUDeclsInObjCContainer; - llvm::BumpPtrAllocator StrScratch; unsigned StrAdapterCount; friend class ScratchAlloc; @@ -446,13 +444,8 @@ public: bool isNotFromSourceFile(SourceLocation Loc) const; void indexTopLevelDecl(const Decl *D); - void indexTUDeclsInObjCContainer(); void indexDeclGroupRef(DeclGroupRef DG); - void addTUDeclInObjCContainer(DeclGroupRef DG) { - TUDeclsInObjCContainer.push_back(DG); - } - void translateLoc(SourceLocation Loc, CXIdxClientFile *indexFile, CXFile *file, unsigned *line, unsigned *column, unsigned *offset); -- 2.40.0