When writing a PCH file, keep track of all of the non-static,
non-inline external definitions (and tentative definitions) that are
found at the top level. The corresponding declarations are stored in a
record in the PCH file, so that they can be provided to the
ASTConsumer (via HandleTopLevelDecl) when the PCH file is read.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69005 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/ParseAST.cpp b/lib/Sema/ParseAST.cpp
index 4bcb478..bb5acb0 100644
--- a/lib/Sema/ParseAST.cpp
+++ b/lib/Sema/ParseAST.cpp
@@ -14,6 +14,7 @@
#include <llvm/ADT/OwningPtr.h>
#include "clang/Sema/ParseAST.h"
#include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/Stmt.h"
#include "Sema.h"
#include "clang/Parse/Parser.h"
@@ -44,6 +45,9 @@
Consumer->Initialize(Ctx);
+ if (Ctx.getExternalSource())
+ Ctx.getExternalSource()->StartTranslationUnit(Consumer);
+
Parser::DeclGroupPtrTy ADecl;
while (!P.ParseTopLevelDecl(ADecl)) { // Not end of file.