/// indexed by the C++ base specifier set ID (-1).
const uint32_t *CXXBaseSpecifiersOffsets;
- /// \brief Base base specifier ID for base specifiers local to this module.
- serialization::CXXBaseSpecifiersID BaseCXXBaseSpecifiersID;
-
// === Types ===
/// \brief The number of types in this AST file.
/// added to the global preprocessing entitiy ID to produce a local ID.
GlobalPreprocessedEntityMapType GlobalPreprocessedEntityMap;
- typedef ContinuousRangeMap<serialization::CXXBaseSpecifiersID, Module *, 4>
- GlobalCXXBaseSpecifiersMapType;
-
- /// \brief Mapping from global CXX base specifier IDs to the module in which
- /// the CXX base specifier resides along with the offset that should be added
- /// to the global CXX base specifer ID to produce a local ID.
- GlobalCXXBaseSpecifiersMapType GlobalCXXBaseSpecifiersMap;
-
/// \name CodeGen-relevant special data
/// \brief Fields containing data that is relevant to CodeGen.
//@{
void LoadedDecl(unsigned Index, Decl *D);
Decl *ReadDeclRecord(serialization::DeclID ID);
RecordLocation DeclCursorForID(serialization::DeclID ID);
+
RecordLocation getLocalBitOffset(uint64_t GlobalOffset);
+ uint64_t getGlobalBitOffset(Module &M, uint32_t LocalOffset);
void PassInterestingDeclsToConsumer();
return cast_or_null<T>(GetDecl(ReadDeclID(F, R, I)));
}
- /// \brief Resolve a CXXBaseSpecifiers ID into an offset into the chain
- /// of loaded AST files.
- uint64_t GetCXXBaseSpecifiersOffset(serialization::CXXBaseSpecifiersID ID);
+ /// \brief Read a CXXBaseSpecifiers ID form the given record and
+ /// return its global bit offset.
+ uint64_t readCXXBaseSpecifiers(Module &M, const RecordData &Record,
+ unsigned &Idx);
virtual CXXBaseSpecifier *GetExternalCXXBaseSpecifiers(uint64_t Offset);
uint32_t MacroDefinitionIDOffset = io::ReadUnalignedLE32(Data);
uint32_t SelectorIDOffset = io::ReadUnalignedLE32(Data);
uint32_t DeclIDOffset = io::ReadUnalignedLE32(Data);
- uint32_t CXXBaseSpecifiersIDOffset = io::ReadUnalignedLE32(Data);
uint32_t TypeIndexOffset = io::ReadUnalignedLE32(Data);
// Source location offset is mapped to OM->SLocEntryBaseOffset.
DeclRemap.insert(std::make_pair(DeclIDOffset,
OM->BaseDeclID - DeclIDOffset));
- (void)CXXBaseSpecifiersIDOffset;
-
TypeRemap.insert(std::make_pair(TypeIndexOffset,
OM->BaseTypeIndex - TypeIndexOffset));
}
F.LocalNumCXXBaseSpecifiers = Record[0];
F.CXXBaseSpecifiersOffsets = (const uint32_t *)BlobStart;
- F.BaseCXXBaseSpecifiersID = getTotalNumCXXBaseSpecifiers();
- GlobalCXXBaseSpecifiersMap.insert(
- std::make_pair(getTotalNumCXXBaseSpecifiers() + 1, &F));
-
NumCXXBaseSpecifiersLoaded += F.LocalNumCXXBaseSpecifiers;
break;
}
return GetDecl(ID);
}
-uint64_t
-ASTReader::GetCXXBaseSpecifiersOffset(serialization::CXXBaseSpecifiersID ID) {
- if (ID == 0)
+uint64_t ASTReader::readCXXBaseSpecifiers(Module &M, const RecordData &Record,
+ unsigned &Idx){
+ if (Idx >= Record.size())
return 0;
-
- GlobalCXXBaseSpecifiersMapType::iterator I =
- GlobalCXXBaseSpecifiersMap.find(ID);
-
- assert (I != GlobalCXXBaseSpecifiersMap.end() &&
- "Corrupted global CXX base specifiers map");
- Module *M = I->second;
- return M->CXXBaseSpecifiersOffsets[ID - 1 - M->BaseCXXBaseSpecifiersID] +
- M->GlobalBitOffset;
+ unsigned LocalID = Record[Idx++];
+ return getGlobalBitOffset(M, M.CXXBaseSpecifiersOffsets[LocalID - 1]);
}
CXXBaseSpecifier *ASTReader::GetExternalCXXBaseSpecifiers(uint64_t Offset) {
dumpModuleIDMap("Global source location entry map", GlobalSLocEntryMap);
dumpModuleIDMap("Global type map", GlobalTypeMap);
dumpModuleIDMap("Global declaration map", GlobalDeclMap);
- dumpModuleIDMap("Global C++ base specifiers map", GlobalCXXBaseSpecifiersMap);
dumpModuleIDMap("Global identifier map", GlobalIdentifierMap);
dumpModuleIDMap("Global selector map", GlobalSelectorMap);
dumpModuleIDMap("Global macro definition map", GlobalMacroDefinitionMap);
SelectorLookupTableData(0), SelectorLookupTable(0), LocalNumDecls(0),
DeclOffsets(0), BaseDeclID(0),
LocalNumCXXBaseSpecifiers(0), CXXBaseSpecifiersOffsets(0),
- BaseCXXBaseSpecifiersID(0),
LocalNumTypes(0), TypeOffsets(0), BaseTypeIndex(0), StatCache(0),
NumPreallocatedPreprocessingEntities(0)
{}
Data.NumBases = Record[Idx++];
if (Data.NumBases)
- Data.Bases = Reader.GetCXXBaseSpecifiersOffset(Record[Idx++]);
+ Data.Bases = Reader.readCXXBaseSpecifiers(F, Record, Idx);
Data.NumVBases = Record[Idx++];
if (Data.NumVBases)
- Data.VBases = Reader.GetCXXBaseSpecifiersOffset(Record[Idx++]);
+ Data.VBases = Reader.readCXXBaseSpecifiers(F, Record, Idx);
Reader.ReadUnresolvedSet(F, Data.Conversions, Record, Idx);
Reader.ReadUnresolvedSet(F, Data.VisibleConversions, Record, Idx);
return RecordLocation(I->second, GlobalOffset - I->second->GlobalBitOffset);
}
+uint64_t ASTReader::getGlobalBitOffset(Module &M, uint32_t LocalOffset) {
+ return LocalOffset + M.GlobalBitOffset;
+}
+
void ASTDeclReader::attachPreviousDecl(Decl *D, Decl *previous) {
assert(D && previous);
if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
unsigned BaseSpecifierOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
- // Write the selector offsets table.
+ // Write the base specifier offsets table.
Record.clear();
Record.push_back(CXX_BASE_SPECIFIER_OFFSETS);
Record.push_back(CXXBaseSpecifiersOffsets.size());
CollectedStmts(&StmtsToEmit),
NumStatements(0), NumMacros(0), NumLexicalDeclContexts(0),
NumVisibleDeclContexts(0),
- FirstCXXBaseSpecifiersID(1), NextCXXBaseSpecifiersID(1),
+ NextCXXBaseSpecifiersID(1),
DeclParmVarAbbrev(0), DeclContextLexicalAbbrev(0),
DeclContextVisibleLookupAbbrev(0), UpdateVisibleAbbrev(0),
DeclRefExprAbbrev(0), CharacterLiteralAbbrev(0),
io::Emit32(Out, (*M)->BaseMacroDefinitionID);
io::Emit32(Out, (*M)->BaseSelectorID);
io::Emit32(Out, (*M)->BaseDeclID);
- io::Emit32(Out, (*M)->BaseCXXBaseSpecifiersID);
io::Emit32(Out, (*M)->BaseTypeIndex);
}
}
Record.clear();
// Record the offset of this base-specifier set.
- unsigned Index = CXXBaseSpecifiersToWrite[I].ID - FirstCXXBaseSpecifiersID;
+ unsigned Index = CXXBaseSpecifiersToWrite[I].ID - 1;
if (Index == CXXBaseSpecifiersOffsets.size())
CXXBaseSpecifiersOffsets.push_back(Stream.GetCurrentBitNo());
else {
FirstIdentID == NextIdentID &&
FirstSelectorID == NextSelectorID &&
FirstMacroID == NextMacroID &&
- FirstCXXBaseSpecifiersID == NextCXXBaseSpecifiersID &&
"Setting chain after writing has started.");
Chain = Reader;
FirstIdentID += Chain->getTotalNumIdentifiers();
FirstSelectorID += Chain->getTotalNumSelectors();
FirstMacroID += Chain->getTotalNumMacroDefinitions();
- FirstCXXBaseSpecifiersID += Chain->getTotalNumCXXBaseSpecifiers();
NextDeclID = FirstDeclID;
NextTypeID = FirstTypeID;
NextIdentID = FirstIdentID;
NextSelectorID = FirstSelectorID;
NextMacroID = FirstMacroID;
- NextCXXBaseSpecifiersID = FirstCXXBaseSpecifiersID;
}
void ASTWriter::IdentifierRead(IdentID ID, IdentifierInfo *II) {