From 0ab547c284285e8abc31b30ded2226eb78c2af3b Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Thu, 31 Mar 2011 19:29:18 +0000 Subject: [PATCH] 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 --- lib/Serialization/ChainedIncludesSource.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Serialization/ChainedIncludesSource.cpp b/lib/Serialization/ChainedIncludesSource.cpp index 56174c1629..aba1eae3d3 100644 --- a/lib/Serialization/ChainedIncludesSource.cpp +++ b/lib/Serialization/ChainedIncludesSource.cpp @@ -94,6 +94,8 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) { Clang->createFileManager(); Clang->createSourceManager(Clang->getFileManager()); Clang->createPreprocessor(); + Clang->getDiagnosticClient().BeginSourceFile(Clang->getLangOpts(), + &Clang->getPreprocessor()); Clang->createASTContext(); llvm::SmallVector serialAST; @@ -136,6 +138,7 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) { ParseAST(Clang->getSema()); OS.flush(); + Clang->getDiagnosticClient().EndSourceFile(); serialBufs.push_back( llvm::MemoryBuffer::getMemBufferCopy(llvm::StringRef(serialAST.data(), serialAST.size()))); -- 2.40.0