r260254 - [libclang] indexing: handle 'TopLevelDeclInObjCContainers' at the point where they are reported.
Argyrios Kyrtzidis via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 9 11:07:21 PST 2016
Author: akirtzidis
Date: Tue Feb 9 13:07:21 2016
New Revision: 260254
URL: http://llvm.org/viewvc/llvm-project?rev=260254&view=rev
Log:
[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.
Modified:
cfe/trunk/tools/libclang/IndexDecl.cpp
cfe/trunk/tools/libclang/Indexing.cpp
cfe/trunk/tools/libclang/IndexingContext.h
Modified: cfe/trunk/tools/libclang/IndexDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexDecl.cpp?rev=260254&r1=260253&r2=260254&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexDecl.cpp (original)
+++ cfe/trunk/tools/libclang/IndexDecl.cpp Tue Feb 9 13:07:21 2016
@@ -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(
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);
- }
-}
Modified: cfe/trunk/tools/libclang/Indexing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/Indexing.cpp?rev=260254&r1=260253&r2=260254&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/Indexing.cpp (original)
+++ cfe/trunk/tools/libclang/Indexing.cpp Tue Feb 9 13:07:21 2016
@@ -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.
Modified: cfe/trunk/tools/libclang/IndexingContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.h?rev=260254&r1=260253&r2=260254&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.h (original)
+++ cfe/trunk/tools/libclang/IndexingContext.h Tue Feb 9 13:07:21 2016
@@ -292,8 +292,6 @@ class IndexingContext {
typedef std::pair<const FileEntry *, const Decl *> RefFileOccurrence;
llvm::DenseSet<RefFileOccurrence> RefFileOccurrences;
- std::deque<DeclGroupRef> 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);
More information about the cfe-commits
mailing list