[llvm] r194893 - DwarfCompileUnit: Add type safety by using DICompileUnit rather than raw MDNode* for the CU metadata node
David Blaikie
dblaikie at gmail.com
Fri Nov 15 15:52:02 PST 2013
Author: dblaikie
Date: Fri Nov 15 17:52:02 2013
New Revision: 194893
URL: http://llvm.org/viewvc/llvm-project?rev=194893&view=rev
Log:
DwarfCompileUnit: Add type safety by using DICompileUnit rather than raw MDNode* for the CU metadata node
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=194893&r1=194892&r2=194893&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Nov 15 17:52:02 2013
@@ -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.
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=194893&r1=194892&r2=194893&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Fri Nov 15 17:52:02 2013
@@ -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; }
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=194893&r1=194892&r2=194893&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Nov 15 17:52:02 2013
@@ -718,14 +718,13 @@ unsigned DwarfDebug::getOrCreateSourceID
// 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::constructCompil
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());
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=194893&r1=194892&r2=194893&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri Nov 15 17:52:02 2013
@@ -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);
More information about the llvm-commits
mailing list