summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/Indexing.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-10-03 21:05:51 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-10-03 21:05:51 +0000
commitf484b139dbc7a0e303657da51585d29ca2c9a007 (patch)
tree5471e9351faa52d12ebbb9f7bf8df09b2660bf92 /clang/tools/libclang/Indexing.cpp
parent184b14428e6580c97cf60b94777fa0db4727ab63 (diff)
downloadbcm5719-llvm-f484b139dbc7a0e303657da51585d29ca2c9a007.tar.gz
bcm5719-llvm-f484b139dbc7a0e303657da51585d29ca2c9a007.zip
[libclang] When indexing, invoke the importedASTFile for PCH files as well.
llvm-svn: 165161
Diffstat (limited to 'clang/tools/libclang/Indexing.cpp')
-rw-r--r--clang/tools/libclang/Indexing.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp
index 6cf3a637acf..0b12d82d30a 100644
--- a/clang/tools/libclang/Indexing.cpp
+++ b/clang/tools/libclang/Indexing.cpp
@@ -197,13 +197,20 @@ public:
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
StringRef InFile) {
+ PreprocessorOptions &PPOpts = CI.getPreprocessorOpts();
+
// We usually disable the preprocessing record for indexing even if the
// original preprocessing options had it enabled. Now that the indexing
// Preprocessor has been created (without a preprocessing record), re-enable
// the option in case modules are enabled, so that the detailed record
// option can be propagated when the module file is generated.
if (CI.getLangOpts().Modules && EnablePPDetailedRecordForModules)
- CI.getPreprocessorOpts().DetailedRecord = true;
+ PPOpts.DetailedRecord = true;
+
+ if (!PPOpts.ImplicitPCHInclude.empty()) {
+ IndexCtx.importedPCH(
+ CI.getFileManager().getFile(PPOpts.ImplicitPCHInclude));
+ }
IndexCtx.setASTContext(CI.getASTContext());
Preprocessor &PP = CI.getPreprocessor();
@@ -536,6 +543,9 @@ static void clang_indexTranslationUnit_Impl(void *UserData) {
ASTUnit::ConcurrencyCheck Check(*Unit);
+ if (const FileEntry *PCHFile = Unit->getPCHFile())
+ IndexCtx->importedPCH(PCHFile);
+
FileManager &FileMgr = Unit->getFileManager();
if (Unit->getOriginalSourceFileName().empty())
OpenPOWER on IntegriCloud