When we load the first module, make sure that we wire up the ASTConsumer to the newly-created ASTReader. This makes sure that CodeGen sees the declarations it is interested in
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139824 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 9087ab5..07d438b 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -756,6 +756,8 @@
getASTContext().setExternalSource(Source);
if (hasSema())
ModuleManager->InitializeSema(getSema());
+ if (hasASTConsumer())
+ ModuleManager->StartTranslationUnit(&getASTConsumer());
}
// Try to load the module we found.
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 30c4429..e4f9fa6 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -4092,6 +4092,7 @@
// passing to the consumer.
GetDecl(ExternalDefinitions[I]);
}
+ ExternalDefinitions.clear();
PassInterestingDeclsToConsumer();
}