diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-09-27 22:18:47 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-09-27 22:18:47 +0000 |
commit | 9609b4f1a8385b87744560d87092ddd3b1cf1598 (patch) | |
tree | ae0b578341349d3de21389686fa11765c25ae636 /clang/lib/Serialization/ASTWriter.cpp | |
parent | a1ce1f80cfb09e75b32d1a34d323a9cddcec744c (diff) | |
download | bcm5719-llvm-9609b4f1a8385b87744560d87092ddd3b1cf1598.tar.gz bcm5719-llvm-9609b4f1a8385b87744560d87092ddd3b1cf1598.zip |
When chaining PCHs, only write PPRecords that don't come from PCH, and give them the correct IDs. Fixes a crash in XCode.
llvm-svn: 114913
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 24ec7ea4b7c..61ba5ab71ba 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -1334,12 +1334,14 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { // If the preprocessor has a preprocessing record, emit it. unsigned NumPreprocessingRecords = 0; if (PPRec) { - for (PreprocessingRecord::iterator E = PPRec->begin(), EEnd = PPRec->end(); + unsigned IndexBase = PPRec->getNumPreallocatedEntities(); + for (PreprocessingRecord::iterator E = PPRec->begin(Chain), + EEnd = PPRec->end(Chain); E != EEnd; ++E) { Record.clear(); if (MacroInstantiation *MI = dyn_cast<MacroInstantiation>(*E)) { - Record.push_back(NumPreprocessingRecords++); + Record.push_back(IndexBase + NumPreprocessingRecords++); AddSourceLocation(MI->getSourceRange().getBegin(), Record); AddSourceLocation(MI->getSourceRange().getEnd(), Record); AddIdentifierRef(MI->getName(), Record); @@ -1359,7 +1361,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { } else MacroDefinitionOffsets.push_back(Stream.GetCurrentBitNo()); - Record.push_back(NumPreprocessingRecords++); + Record.push_back(IndexBase + NumPreprocessingRecords++); Record.push_back(ID); AddSourceLocation(MD->getSourceRange().getBegin(), Record); AddSourceLocation(MD->getSourceRange().getEnd(), Record); |