From: Argyrios Kyrtzidis Date: Tue, 9 Feb 2016 19:07:21 +0000 (+0000) Subject: [libclang] indexing: handle 'TopLevelDeclInObjCContainers' at the point where they... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49385e8bd5312704cc9ef8a24bd713cc3463529c;p=platform%2Fupstream%2Fllvm.git [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. llvm-svn: 260254 --- diff --git a/clang/tools/libclang/IndexDecl.cpp b/clang/tools/libclang/IndexDecl.cpp index c8cf1d3..aa97129 100644 --- a/clang/tools/libclang/IndexDecl.cpp +++ b/clang/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/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp index d6e35b0..4929d62 100644 --- a/clang/tools/libclang/Indexing.cpp +++ b/clang/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/clang/tools/libclang/IndexingContext.h b/clang/tools/libclang/IndexingContext.h index 2b1355a..d1d62c9 100644 --- a/clang/tools/libclang/IndexingContext.h +++ b/clang/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);