summaryrefslogtreecommitdiffstats
path: root/clang/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
commit2f555fc41552c2ffb5d5163e16c512afaeddf4a6 (patch)
treead0013c6e1e5fb58e3ab85afca386b2f79841c30 /clang/lib/Serialization/ASTWriter.cpp
parentb456866b7bcf2b55e6c3fccb144f674c4439a081 (diff)
downloadbcm5719-llvm-2f555fc41552c2ffb5d5163e16c512afaeddf4a6.tar.gz
bcm5719-llvm-2f555fc41552c2ffb5d5163e16c512afaeddf4a6.zip
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. llvm-svn: 136902
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 8d2fb9b2b77..f23a0cdce9a 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/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,
OpenPOWER on IntegriCloud