DwarfAccelTable::~DwarfAccelTable() {}
-void DwarfAccelTable::AddName(StringRef Name, DIE *die, char Flags) {
+void DwarfAccelTable::AddName(StringRef Name, const DIE *die, char Flags) {
assert(Data.empty() && "Already finalized!");
// If the string is in the list already then add this die to the list
// otherwise add a new one.
// HashData[hash_data_count]
public:
struct HashDataContents {
- DIE *Die; // Offsets
+ const DIE *Die; // Offsets
char Flags; // Specific flags to output
- HashDataContents(DIE *D, char Flags) : Die(D), Flags(Flags) {}
+ HashDataContents(const DIE *D, char Flags) : Die(D), Flags(Flags) {}
#ifndef NDEBUG
void print(raw_ostream &O) const {
O << " Offset: " << Die->getOffset() << "\n";
public:
DwarfAccelTable(ArrayRef<DwarfAccelTable::Atom>);
~DwarfAccelTable();
- void AddName(StringRef, DIE *, char = 0);
+ void AddName(StringRef, const DIE *, char = 0);
void FinalizeTable(AsmPrinter *, StringRef);
void Emit(AsmPrinter *, MCSymbol *, DwarfUnits *);
#ifndef NDEBUG
assert(Ty.isDerivedType() && "Unknown kind of DIType");
constructTypeDIE(*TyDIE, DIDerivedType(Ty));
}
- // If this is a named finished type then include it in the list of types
- // for the accelerator tables.
+
+ updateAcceleratorTables(Ty, TyDIE);
+
+ return TyDIE;
+}
+
+void CompileUnit::updateAcceleratorTables(DIType Ty, const DIE *TyDIE) {
if (!Ty.getName().empty() && !Ty.isForwardDecl()) {
bool IsImplementation = 0;
if (Ty.isCompositeType()) {
unsigned Flags = IsImplementation ? dwarf::DW_FLAG_type_implementation : 0;
addAccelType(Ty.getName(), std::make_pair(TyDIE, Flags));
}
-
- return TyDIE;
}
/// addType - Add a new type attribute to the specified entity.
// DIE to the proper table while ensuring that the name that we're going
// to reference is in the string table. We do this since the names we
// add may not only be identical to the names in the DIE.
-void CompileUnit::addAccelName(StringRef Name, DIE *Die) {
+void CompileUnit::addAccelName(StringRef Name, const DIE *Die) {
DU->getStringPoolEntry(Name);
- std::vector<DIE *> &DIEs = AccelNames[Name];
+ std::vector<const DIE *> &DIEs = AccelNames[Name];
DIEs.push_back(Die);
}
-void CompileUnit::addAccelObjC(StringRef Name, DIE *Die) {
+void CompileUnit::addAccelObjC(StringRef Name, const DIE *Die) {
DU->getStringPoolEntry(Name);
- std::vector<DIE *> &DIEs = AccelObjC[Name];
+ std::vector<const DIE *> &DIEs = AccelObjC[Name];
DIEs.push_back(Die);
}
-void CompileUnit::addAccelNamespace(StringRef Name, DIE *Die) {
+void CompileUnit::addAccelNamespace(StringRef Name, const DIE *Die) {
DU->getStringPoolEntry(Name);
- std::vector<DIE *> &DIEs = AccelNamespace[Name];
+ std::vector<const DIE *> &DIEs = AccelNamespace[Name];
DIEs.push_back(Die);
}
-void CompileUnit::addAccelType(StringRef Name, std::pair<DIE *, unsigned> Die) {
+void CompileUnit::addAccelType(StringRef Name,
+ std::pair<const DIE *, unsigned> Die) {
DU->getStringPoolEntry(Name);
- std::vector<std::pair<DIE *, unsigned> > &DIEs = AccelTypes[Name];
+ std::vector<std::pair<const DIE *, unsigned> > &DIEs = AccelTypes[Name];
DIEs.push_back(Die);
}
/// AccelNames - A map of names for the name accelerator table.
///
- StringMap<std::vector<DIE *> > AccelNames;
- StringMap<std::vector<DIE *> > AccelObjC;
- StringMap<std::vector<DIE *> > AccelNamespace;
- StringMap<std::vector<std::pair<DIE *, unsigned> > > AccelTypes;
+ StringMap<std::vector<const DIE *> > AccelNames;
+ StringMap<std::vector<const DIE *> > AccelObjC;
+ StringMap<std::vector<const DIE *> > AccelNamespace;
+ StringMap<std::vector<std::pair<const DIE *, unsigned> > > AccelTypes;
/// DIEBlocks - A list of all the DIEBlocks in use.
std::vector<DIEBlock *> DIEBlocks;
const StringMap<DIE *> &getGlobalNames() const { return GlobalNames; }
const StringMap<DIE *> &getGlobalTypes() const { return GlobalTypes; }
- const StringMap<std::vector<DIE *> > &getAccelNames() const {
+ const StringMap<std::vector<const DIE *> > &getAccelNames() const {
return AccelNames;
}
- const StringMap<std::vector<DIE *> > &getAccelObjC() const {
+ const StringMap<std::vector<const DIE *> > &getAccelObjC() const {
return AccelObjC;
}
- const StringMap<std::vector<DIE *> > &getAccelNamespace() const {
+ const StringMap<std::vector<const DIE *> > &getAccelNamespace() const {
return AccelNamespace;
}
- const StringMap<std::vector<std::pair<DIE *, unsigned> > > &
+ const StringMap<std::vector<std::pair<const DIE *, unsigned> > > &
getAccelTypes() const {
return AccelTypes;
}
void addPubTypes(DISubprogram SP);
/// addAccelName - Add a new name to the name accelerator table.
- void addAccelName(StringRef Name, DIE *Die);
+ void addAccelName(StringRef Name, const DIE *Die);
/// addAccelObjC - Add a new name to the ObjC accelerator table.
- void addAccelObjC(StringRef Name, DIE *Die);
+ void addAccelObjC(StringRef Name, const DIE *Die);
/// addAccelNamespace - Add a new name to the namespace accelerator table.
- void addAccelNamespace(StringRef Name, DIE *Die);
+ void addAccelNamespace(StringRef Name, const DIE *Die);
/// addAccelType - Add a new type to the type accelerator table.
- void addAccelType(StringRef Name, std::pair<DIE *, unsigned> Die);
+ void addAccelType(StringRef Name, std::pair<const DIE *, unsigned> Die);
/// getDIE - Returns the debug information entry map slot for the
/// specified debug variable. We delegate the request to DwarfDebug
template <typename T> T resolve(DIRef<T> Ref) const {
return DD->resolve(Ref);
}
+
+ /// If this is a named finished type then include it in the list of types for
+ /// the accelerator tables.
+ void updateAcceleratorTables(DIType Ty, const DIE *TyDIE);
};
} // end llvm namespace
E = CUMap.end();
I != E; ++I) {
CompileUnit *TheCU = I->second;
- const StringMap<std::vector<DIE *> > &Names = TheCU->getAccelNames();
- for (StringMap<std::vector<DIE *> >::const_iterator GI = Names.begin(),
- GE = Names.end();
+ const StringMap<std::vector<const DIE *> > &Names = TheCU->getAccelNames();
+ for (StringMap<std::vector<const DIE *> >::const_iterator
+ GI = Names.begin(),
+ GE = Names.end();
GI != GE; ++GI) {
StringRef Name = GI->getKey();
- const std::vector<DIE *> &Entities = GI->second;
- for (std::vector<DIE *>::const_iterator DI = Entities.begin(),
- DE = Entities.end();
+ const std::vector<const DIE *> &Entities = GI->second;
+ for (std::vector<const DIE *>::const_iterator DI = Entities.begin(),
+ DE = Entities.end();
DI != DE; ++DI)
- AT.AddName(Name, (*DI));
+ AT.AddName(Name, *DI);
}
}
E = CUMap.end();
I != E; ++I) {
CompileUnit *TheCU = I->second;
- const StringMap<std::vector<DIE *> > &Names = TheCU->getAccelObjC();
- for (StringMap<std::vector<DIE *> >::const_iterator GI = Names.begin(),
- GE = Names.end();
+ const StringMap<std::vector<const DIE *> > &Names = TheCU->getAccelObjC();
+ for (StringMap<std::vector<const DIE *> >::const_iterator
+ GI = Names.begin(),
+ GE = Names.end();
GI != GE; ++GI) {
StringRef Name = GI->getKey();
- const std::vector<DIE *> &Entities = GI->second;
- for (std::vector<DIE *>::const_iterator DI = Entities.begin(),
- DE = Entities.end();
+ const std::vector<const DIE *> &Entities = GI->second;
+ for (std::vector<const DIE *>::const_iterator DI = Entities.begin(),
+ DE = Entities.end();
DI != DE; ++DI)
- AT.AddName(Name, (*DI));
+ AT.AddName(Name, *DI);
}
}
E = CUMap.end();
I != E; ++I) {
CompileUnit *TheCU = I->second;
- const StringMap<std::vector<DIE *> > &Names = TheCU->getAccelNamespace();
- for (StringMap<std::vector<DIE *> >::const_iterator GI = Names.begin(),
- GE = Names.end();
+ const StringMap<std::vector<const DIE *> > &Names =
+ TheCU->getAccelNamespace();
+ for (StringMap<std::vector<const DIE *> >::const_iterator
+ GI = Names.begin(),
+ GE = Names.end();
GI != GE; ++GI) {
StringRef Name = GI->getKey();
- const std::vector<DIE *> &Entities = GI->second;
- for (std::vector<DIE *>::const_iterator DI = Entities.begin(),
- DE = Entities.end();
+ const std::vector<const DIE *> &Entities = GI->second;
+ for (std::vector<const DIE *>::const_iterator DI = Entities.begin(),
+ DE = Entities.end();
DI != DE; ++DI)
- AT.AddName(Name, (*DI));
+ AT.AddName(Name, *DI);
}
}
E = CUMap.end();
I != E; ++I) {
CompileUnit *TheCU = I->second;
- const StringMap<std::vector<std::pair<DIE *, unsigned> > > &Names =
+ const StringMap<std::vector<std::pair<const DIE *, unsigned> > > &Names =
TheCU->getAccelTypes();
- for (StringMap<std::vector<std::pair<DIE *, unsigned> > >::const_iterator
+ for (StringMap<
+ std::vector<std::pair<const DIE *, unsigned> > >::const_iterator
GI = Names.begin(),
GE = Names.end();
GI != GE; ++GI) {
StringRef Name = GI->getKey();
- const std::vector<std::pair<DIE *, unsigned> > &Entities = GI->second;
- for (std::vector<std::pair<DIE *, unsigned> >::const_iterator
+ const std::vector<std::pair<const DIE *, unsigned> > &Entities =
+ GI->second;
+ for (std::vector<std::pair<const DIE *, unsigned> >::const_iterator
DI = Entities.begin(),
DE = Entities.end();
DI != DE; ++DI)
- AT.AddName(Name, (*DI).first, (*DI).second);
+ AT.AddName(Name, DI->first, DI->second);
}
}