[cfe-commits] r148319 - in /cfe/trunk: include/clang/Frontend/ASTUnit.h lib/Frontend/ASTUnit.cpp tools/libclang/Indexing.cpp tools/libclang/IndexingContext.cpp tools/libclang/IndexingContext.h
Argyrios Kyrtzidis
akyrtzi at gmail.com
Tue Jan 17 10:48:07 PST 2012
Author: akirtzidis
Date: Tue Jan 17 12:48:07 2012
New Revision: 148319
URL: http://llvm.org/viewvc/llvm-project?rev=148319&view=rev
Log:
[libclang] Make sure Preprocessor is set in ASTUnit during indexing.
Modified:
cfe/trunk/include/clang/Frontend/ASTUnit.h
cfe/trunk/lib/Frontend/ASTUnit.cpp
cfe/trunk/tools/libclang/Indexing.cpp
cfe/trunk/tools/libclang/IndexingContext.cpp
cfe/trunk/tools/libclang/IndexingContext.h
Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=148319&r1=148318&r2=148319&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Tue Jan 17 12:48:07 2012
@@ -457,6 +457,7 @@
ASTContext &getASTContext() { return *Ctx; }
void setASTContext(ASTContext *ctx) { Ctx = ctx; }
+ void setPreprocessor(Preprocessor *pp);
bool hasSema() const { return TheSema; }
Sema &getSema() const {
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=148319&r1=148318&r2=148319&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Tue Jan 17 12:48:07 2012
@@ -262,6 +262,8 @@
}
}
+void ASTUnit::setPreprocessor(Preprocessor *pp) { PP = pp; }
+
/// \brief Determine the set of code-completion contexts in which this
/// declaration should be shown.
static unsigned getDeclShowContexts(NamedDecl *ND,
Modified: cfe/trunk/tools/libclang/Indexing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/Indexing.cpp?rev=148319&r1=148318&r2=148319&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/Indexing.cpp (original)
+++ cfe/trunk/tools/libclang/Indexing.cpp Tue Jan 17 12:48:07 2012
@@ -176,6 +176,7 @@
IndexCtx.setASTContext(CI.getASTContext());
Preprocessor &PP = CI.getPreprocessor();
PP.addPPCallbacks(new IndexPPCallbacks(PP, IndexCtx));
+ IndexCtx.setPreprocessor(PP);
return new IndexingConsumer(IndexCtx);
}
Modified: cfe/trunk/tools/libclang/IndexingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.cpp?rev=148319&r1=148318&r2=148319&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.cpp (original)
+++ cfe/trunk/tools/libclang/IndexingContext.cpp Tue Jan 17 12:48:07 2012
@@ -208,6 +208,10 @@
static_cast<ASTUnit*>(CXTU->TUData)->setASTContext(&ctx);
}
+void IndexingContext::setPreprocessor(Preprocessor &PP) {
+ static_cast<ASTUnit*>(CXTU->TUData)->setPreprocessor(&PP);
+}
+
bool IndexingContext::shouldAbort() {
if (!CB.abortQuery)
return false;
Modified: cfe/trunk/tools/libclang/IndexingContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.h?rev=148319&r1=148318&r2=148319&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.h (original)
+++ cfe/trunk/tools/libclang/IndexingContext.h Tue Jan 17 12:48:07 2012
@@ -319,6 +319,7 @@
ASTContext &getASTContext() const { return *Ctx; }
void setASTContext(ASTContext &ctx);
+ void setPreprocessor(Preprocessor &PP);
bool suppressRefs() const {
return IndexOptions & CXIndexOpt_SuppressRedundantRefs;
More information about the cfe-commits
mailing list