aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-08-04 18:56:47 +0000
committerDouglas Gregor <dgregor@apple.com>2011-08-04 18:56:47 +0000
commit272b6bc6a6c8fc04f951ad850df68c44d137f513 (patch)
tree84fcaff82022819fba1d81dfb01819f72e67033f /lib/Serialization/ASTWriter.cpp
parent3b2257ca054aa0b7d0150a294f184e9349cda433 (diff)
Introduce local -> global mapping for preprocessed entity IDs. This is
the last of the ID/offset/index mappings that I know of. Unfortunately, the "gap" method of testing doesn't work here due to the way the preprocessing record performs iteration. We'll do more testing once multi-AST loading is possible. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136902 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r--lib/Serialization/ASTWriter.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 8d2fb9b2b7..f23a0cdce9 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -1796,8 +1796,10 @@ void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
InclusionAbbrev = Stream.EmitAbbrev(Abbrev);
}
- unsigned IndexBase = Chain ? PPRec.getNumLoadedPreprocessedEntities() : 0;
- unsigned NextPreprocessorEntityID = IndexBase + 1;
+ unsigned FirstPreprocessorEntityID
+ = (Chain ? PPRec.getNumLoadedPreprocessedEntities() : 0)
+ + NUM_PREDEF_PP_ENTITY_IDS;
+ unsigned NextPreprocessorEntityID = FirstPreprocessorEntityID;
RecordData Record;
uint64_t BitsInChain = Chain? Chain->TotalModulesSizeInBits : 0;
for (PreprocessingRecord::iterator E = PPRec.begin(Chain),
@@ -1879,6 +1881,7 @@ void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
BitCodeAbbrev *Abbrev = new BitCodeAbbrev();
Abbrev->Add(BitCodeAbbrevOp(MACRO_DEFINITION_OFFSETS));
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // # of records
+ Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // first pp entity
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // # of macro defs
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // first macro def
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
@@ -1887,6 +1890,7 @@ void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
Record.clear();
Record.push_back(MACRO_DEFINITION_OFFSETS);
Record.push_back(NumPreprocessingRecords);
+ Record.push_back(FirstPreprocessorEntityID - NUM_PREDEF_PP_ENTITY_IDS);
Record.push_back(MacroDefinitionOffsets.size());
Record.push_back(FirstMacroID - NUM_PREDEF_MACRO_IDS);
Stream.EmitRecordWithBlob(MacroDefOffsetAbbrev, Record,