mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
DwarfCompileUnit: Add type safety by using DICompileUnit rather than raw MDNode* for the CU metadata node
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194893 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
aedaa723c2
commit
942431fa71
@ -33,12 +33,12 @@
|
||||
using namespace llvm;
|
||||
|
||||
/// CompileUnit - Compile unit constructor.
|
||||
CompileUnit::CompileUnit(unsigned UID, DIE *D, const MDNode *N, AsmPrinter *A,
|
||||
DwarfDebug *DW, DwarfUnits *DWU)
|
||||
: UniqueID(UID), Node(N), CUDie(D), Asm(A), DD(DW), DU(DWU), IndexTyDie(0),
|
||||
DebugInfoOffset(0) {
|
||||
CompileUnit::CompileUnit(unsigned UID, DIE *D, DICompileUnit Node,
|
||||
AsmPrinter *A, DwarfDebug *DW, DwarfUnits *DWU)
|
||||
: UniqueID(UID), Node(Node), CUDie(D), Asm(A), DD(DW), DU(DWU),
|
||||
IndexTyDie(0), DebugInfoOffset(0) {
|
||||
DIEIntegerOne = new (DIEValueAllocator) DIEInteger(1);
|
||||
insertDIE(DIDescriptor(N), D);
|
||||
insertDIE(Node, D);
|
||||
}
|
||||
|
||||
/// ~CompileUnit - Destructor for compile unit.
|
||||
|
@ -40,7 +40,7 @@ class CompileUnit {
|
||||
unsigned UniqueID;
|
||||
|
||||
/// Node - MDNode for the compile unit.
|
||||
const MDNode *Node;
|
||||
DICompileUnit Node;
|
||||
|
||||
/// CUDie - Compile unit debug information entry.
|
||||
///
|
||||
@ -94,13 +94,13 @@ class CompileUnit {
|
||||
DIEInteger *DIEIntegerOne;
|
||||
|
||||
public:
|
||||
CompileUnit(unsigned UID, DIE *D, const MDNode *N, AsmPrinter *A,
|
||||
CompileUnit(unsigned UID, DIE *D, DICompileUnit CU, AsmPrinter *A,
|
||||
DwarfDebug *DW, DwarfUnits *DWU);
|
||||
~CompileUnit();
|
||||
|
||||
// Accessors.
|
||||
unsigned getUniqueID() const { return UniqueID; }
|
||||
uint16_t getLanguage() const { return DICompileUnit(Node).getLanguage(); }
|
||||
uint16_t getLanguage() const { return Node.getLanguage(); }
|
||||
const MDNode *getNode() const { return Node; }
|
||||
DIE *getCUDie() const { return CUDie.get(); }
|
||||
const StringMap<DIE *> &getGlobalNames() const { return GlobalNames; }
|
||||
|
@ -718,14 +718,13 @@ unsigned DwarfDebug::getOrCreateSourceID(StringRef FileName,
|
||||
|
||||
// Create new CompileUnit for the given metadata node with tag
|
||||
// DW_TAG_compile_unit.
|
||||
CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
|
||||
DICompileUnit DIUnit(N);
|
||||
CompileUnit *DwarfDebug::constructCompileUnit(DICompileUnit DIUnit) {
|
||||
StringRef FN = DIUnit.getFilename();
|
||||
CompilationDir = DIUnit.getDirectory();
|
||||
|
||||
DIE *Die = new DIE(dwarf::DW_TAG_compile_unit);
|
||||
CompileUnit *NewCU =
|
||||
new CompileUnit(GlobalCUIndexCount++, Die, N, Asm, this, &InfoHolder);
|
||||
CompileUnit *NewCU = new CompileUnit(GlobalCUIndexCount++, Die, DIUnit, Asm,
|
||||
this, &InfoHolder);
|
||||
|
||||
FileIDCUMap[NewCU->getUniqueID()] = 0;
|
||||
// Call this to emit a .file directive if it wasn't emitted for the source
|
||||
@ -818,7 +817,7 @@ CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
|
||||
|
||||
InfoHolder.addUnit(NewCU);
|
||||
|
||||
CUMap.insert(std::make_pair(N, NewCU));
|
||||
CUMap.insert(std::make_pair(DIUnit, NewCU));
|
||||
CUDieMap.insert(std::make_pair(Die, NewCU));
|
||||
return NewCU;
|
||||
}
|
||||
@ -2951,8 +2950,9 @@ void DwarfDebug::emitDebugMacInfo() {
|
||||
CompileUnit *DwarfDebug::constructSkeletonCU(const CompileUnit *CU) {
|
||||
|
||||
DIE *Die = new DIE(dwarf::DW_TAG_compile_unit);
|
||||
CompileUnit *NewCU = new CompileUnit(CU->getUniqueID(), Die, CU->getNode(),
|
||||
Asm, this, &SkeletonHolder);
|
||||
CompileUnit *NewCU =
|
||||
new CompileUnit(CU->getUniqueID(), Die, DICompileUnit(CU->getNode()), Asm,
|
||||
this, &SkeletonHolder);
|
||||
|
||||
NewCU->addLocalString(Die, dwarf::DW_AT_GNU_dwo_name,
|
||||
DICompileUnit(CU->getNode()).getSplitDebugFilename());
|
||||
|
@ -604,7 +604,7 @@ private:
|
||||
|
||||
/// \brief Create new CompileUnit for the given metadata node with tag
|
||||
/// DW_TAG_compile_unit.
|
||||
CompileUnit *constructCompileUnit(const MDNode *N);
|
||||
CompileUnit *constructCompileUnit(DICompileUnit DIUnit);
|
||||
|
||||
/// \brief Construct subprogram DIE.
|
||||
void constructSubprogramDIE(CompileUnit *TheCU, const MDNode *N);
|
||||
|
Loading…
x
Reference in New Issue
Block a user