aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/GeneratePCH.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-11-30 06:16:57 +0000
committerDouglas Gregor <dgregor@apple.com>2010-11-30 06:16:57 +0000
commit89d9980bbc2e4a4ac86673e6ec16fb9f5babb63b (patch)
treeb60c5afbdb4f5fd6f12cf38e98ebb6c2746cc163 /lib/Serialization/GeneratePCH.cpp
parentbdc4b366e80c125184a3b3c56fa4619cb4ac9e45 (diff)
When using a precompiled preamble with detailed preprocessing records,
trap the serialized preprocessing records (macro definitions, macro instantiations, macro definitions) from the generation of the precompiled preamble, then replay those when walking the list of preprocessed entities. This eliminates a bug where clang_getCursor() wasn't able to find preprocessed-entity cursors in the preamble. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/GeneratePCH.cpp')
-rw-r--r--lib/Serialization/GeneratePCH.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Serialization/GeneratePCH.cpp b/lib/Serialization/GeneratePCH.cpp
index 4f6f5cae42..3b4f869c00 100644
--- a/lib/Serialization/GeneratePCH.cpp
+++ b/lib/Serialization/GeneratePCH.cpp
@@ -32,7 +32,6 @@ PCHGenerator::PCHGenerator(const Preprocessor &PP,
llvm::raw_ostream *OS)
: PP(PP), isysroot(isysroot), Out(OS), SemaPtr(0),
StatCalls(0), Stream(Buffer), Writer(Stream), Chaining(Chaining) {
-
// Install a stat() listener to keep track of all of the stat()
// calls.
StatCalls = new MemorizeStatCalls();
@@ -46,6 +45,9 @@ void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) {
if (PP.getDiagnostics().hasErrorOccurred())
return;
+ // Set up the serialization listener.
+ Writer.SetSerializationListener(GetASTSerializationListener());
+
// Emit the PCH file
assert(SemaPtr && "No Sema?");
Writer.WriteAST(*SemaPtr, StatCalls, isysroot);
@@ -66,6 +68,10 @@ ASTMutationListener *PCHGenerator::GetASTMutationListener() {
return 0;
}
+ASTSerializationListener *PCHGenerator::GetASTSerializationListener() {
+ return 0;
+}
+
ASTDeserializationListener *PCHGenerator::GetASTDeserializationListener() {
return &Writer;
}