Tell the diagnostic client about starting and ending source files when automatically creating chained PCHs. This way, we don't get a crash whenever a diagnostic is emitted while processing the include.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128663 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Serialization/ChainedIncludesSource.cpp b/lib/Serialization/ChainedIncludesSource.cpp
index 56174c1..aba1eae3 100644
--- a/lib/Serialization/ChainedIncludesSource.cpp
+++ b/lib/Serialization/ChainedIncludesSource.cpp
@@ -94,6 +94,8 @@
Clang->createFileManager();
Clang->createSourceManager(Clang->getFileManager());
Clang->createPreprocessor();
+ Clang->getDiagnosticClient().BeginSourceFile(Clang->getLangOpts(),
+ &Clang->getPreprocessor());
Clang->createASTContext();
llvm::SmallVector<char, 256> serialAST;
@@ -136,6 +138,7 @@
ParseAST(Clang->getSema());
OS.flush();
+ Clang->getDiagnosticClient().EndSourceFile();
serialBufs.push_back(
llvm::MemoryBuffer::getMemBufferCopy(llvm::StringRef(serialAST.data(),
serialAST.size())));