summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-04-25 18:26:14 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-04-25 18:26:14 +0000
commitf6e00376e7dc6d84f53efaf7cef9089021fac609 (patch)
tree942e16934e4286d00162f9f9e46c8b104f7c7774 /lib/CodeGen
parentdb8c1ae04e65e249c8276944245fe31df607a806 (diff)
downloadllvm-f6e00376e7dc6d84f53efaf7cef9089021fac609.tar.gz
llvm-f6e00376e7dc6d84f53efaf7cef9089021fac609.tar.bz2
llvm-f6e00376e7dc6d84f53efaf7cef9089021fac609.tar.xz
DwarfUnit: Suddently, DIE references, everywhere.
This'll make changing to unique_ptr ownership of DIEs easier since the usages will now have '*' on them making them textually compatible between unique_ptr and raw pointer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207253 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp88
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.h10
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfUnit.cpp423
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfUnit.h88
4 files changed, 300 insertions, 309 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index a44fd3de3e..9b4ffa8e52 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -323,7 +323,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit &SPCU,
if (DIE *AbsSPDIE = AbstractSPDies.lookup(SP)) {
// Pick up abstract subprogram DIE.
SPDie = SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, *SPCU.getUnitDie());
- SPCU.addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin, AbsSPDIE);
+ SPCU.addDIEEntry(*SPDie, dwarf::DW_AT_abstract_origin, AbsSPDIE);
} else {
DISubprogram SPDecl = SP.getFunctionDeclaration();
if (!SPDecl.isSubprogram()) {
@@ -335,7 +335,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit &SPCU,
DIScope SPContext = resolve(SP.getContext());
if (SP.isDefinition() && !SPContext.isCompileUnit() &&
!SPContext.isFile() && !isSubprogramContext(SPContext)) {
- SPCU.addFlag(SPDie, dwarf::DW_AT_declaration);
+ SPCU.addFlag(*SPDie, dwarf::DW_AT_declaration);
// Add arguments.
DICompositeType SPTy = SP.getType();
@@ -346,16 +346,16 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit &SPCU,
DIE *SPDeclDie = SPDie;
SPDie =
SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, *SPCU.getUnitDie());
- SPCU.addDIEEntry(SPDie, dwarf::DW_AT_specification, SPDeclDie);
+ SPCU.addDIEEntry(*SPDie, dwarf::DW_AT_specification, SPDeclDie);
}
}
}
- attachLowHighPC(SPCU, SPDie, FunctionBeginSym, FunctionEndSym);
+ attachLowHighPC(SPCU, *SPDie, FunctionBeginSym, FunctionEndSym);
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
MachineLocation Location(RI->getFrameRegister(*Asm->MF));
- SPCU.addAddress(SPDie, dwarf::DW_AT_frame_base, Location);
+ SPCU.addAddress(*SPDie, dwarf::DW_AT_frame_base, Location);
// Add name to the name table, we do this here because we're guaranteed
// to have concrete versions of our DW_TAG_subprogram nodes.
@@ -385,7 +385,7 @@ bool DwarfDebug::isLexicalScopeDIENull(LexicalScope *Scope) {
return !End;
}
-static void addSectionLabel(AsmPrinter &Asm, DwarfUnit &U, DIE *D,
+static void addSectionLabel(AsmPrinter &Asm, DwarfUnit &U, DIE &D,
dwarf::Attribute A, const MCSymbol *L,
const MCSymbol *Sec) {
if (Asm.MAI->doesDwarfUseRelocationsAcrossSections())
@@ -394,7 +394,7 @@ static void addSectionLabel(AsmPrinter &Asm, DwarfUnit &U, DIE *D,
U.addSectionDelta(D, A, L, Sec);
}
-void DwarfDebug::addScopeRangeList(DwarfCompileUnit &TheCU, DIE *ScopeDIE,
+void DwarfDebug::addScopeRangeList(DwarfCompileUnit &TheCU, DIE &ScopeDIE,
const SmallVectorImpl<InsnRange> &Range) {
// Emit offset in .debug_range as a relocatable label. emitDIE will handle
// emitting it appropriately.
@@ -434,7 +434,7 @@ DIE *DwarfDebug::constructLexicalScopeDIE(DwarfCompileUnit &TheCU,
// If we have multiple ranges, emit them into the range section.
if (ScopeRanges.size() > 1) {
- addScopeRangeList(TheCU, ScopeDIE, ScopeRanges);
+ addScopeRangeList(TheCU, *ScopeDIE, ScopeRanges);
return ScopeDIE;
}
@@ -447,7 +447,7 @@ DIE *DwarfDebug::constructLexicalScopeDIE(DwarfCompileUnit &TheCU,
assert(Start->isDefined() && "Invalid starting label for an inlined scope!");
assert(End->isDefined() && "Invalid end label for an inlined scope!");
- attachLowHighPC(TheCU, ScopeDIE, Start, End);
+ attachLowHighPC(TheCU, *ScopeDIE, Start, End);
return ScopeDIE;
}
@@ -471,11 +471,11 @@ DIE *DwarfDebug::constructInlinedScopeDIE(DwarfCompileUnit &TheCU,
}
DIE *ScopeDIE = new DIE(dwarf::DW_TAG_inlined_subroutine);
- TheCU.addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin, OriginDIE);
+ TheCU.addDIEEntry(*ScopeDIE, dwarf::DW_AT_abstract_origin, OriginDIE);
// If we have multiple ranges, emit them into the range section.
if (ScopeRanges.size() > 1)
- addScopeRangeList(TheCU, ScopeDIE, ScopeRanges);
+ addScopeRangeList(TheCU, *ScopeDIE, ScopeRanges);
else {
SmallVectorImpl<InsnRange>::const_iterator RI = ScopeRanges.begin();
MCSymbol *StartLabel = getLabelBeforeInsn(RI->first);
@@ -488,16 +488,16 @@ DIE *DwarfDebug::constructInlinedScopeDIE(DwarfCompileUnit &TheCU,
"Invalid starting label for an inlined scope!");
assert(EndLabel->isDefined() && "Invalid end label for an inlined scope!");
- attachLowHighPC(TheCU, ScopeDIE, StartLabel, EndLabel);
+ attachLowHighPC(TheCU, *ScopeDIE, StartLabel, EndLabel);
}
InlinedSubprogramDIEs.insert(OriginDIE);
// Add the call site information to the DIE.
DILocation DL(Scope->getInlinedAt());
- TheCU.addUInt(ScopeDIE, dwarf::DW_AT_call_file, None,
+ TheCU.addUInt(*ScopeDIE, dwarf::DW_AT_call_file, None,
TheCU.getOrCreateSourceID(DL.getFilename(), DL.getDirectory()));
- TheCU.addUInt(ScopeDIE, dwarf::DW_AT_call_line, None, DL.getLineNumber());
+ TheCU.addUInt(*ScopeDIE, dwarf::DW_AT_call_line, None, DL.getLineNumber());
// Add name to the name table, we do this here because we're guaranteed
// to have concrete versions of our DW_TAG_inlined_subprogram nodes.
@@ -614,12 +614,12 @@ DIE *DwarfDebug::constructScopeDIE(DwarfCompileUnit &TheCU,
ScopeDIE->addChild(I);
if (DS.isSubprogram() && ObjectPointer != nullptr)
- TheCU.addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, ObjectPointer);
+ TheCU.addDIEEntry(*ScopeDIE, dwarf::DW_AT_object_pointer, ObjectPointer);
return ScopeDIE;
}
-void DwarfDebug::addGnuPubAttributes(DwarfUnit &U, DIE *D) const {
+void DwarfDebug::addGnuPubAttributes(DwarfUnit &U, DIE &D) const {
if (!GenerateGnuPubSections)
return;
@@ -646,10 +646,10 @@ DwarfCompileUnit &DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
Asm->OutStreamer.getContext().setMCLineTableCompilationDir(
NewCU.getUniqueID(), CompilationDir);
- NewCU.addString(Die, dwarf::DW_AT_producer, DIUnit.getProducer());
- NewCU.addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
+ NewCU.addString(*Die, dwarf::DW_AT_producer, DIUnit.getProducer());
+ NewCU.addUInt(*Die, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
DIUnit.getLanguage());
- NewCU.addString(Die, dwarf::DW_AT_name, FN);
+ NewCU.addString(*Die, dwarf::DW_AT_name, FN);
if (!useSplitDwarf()) {
NewCU.initStmtList(DwarfLineSectionSym);
@@ -657,20 +657,20 @@ DwarfCompileUnit &DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
// If we're using split dwarf the compilation dir is going to be in the
// skeleton CU and so we don't need to duplicate it here.
if (!CompilationDir.empty())
- NewCU.addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
+ NewCU.addString(*Die, dwarf::DW_AT_comp_dir, CompilationDir);
- addGnuPubAttributes(NewCU, Die);
+ addGnuPubAttributes(NewCU, *Die);
}
if (DIUnit.isOptimized())
- NewCU.addFlag(Die, dwarf::DW_AT_APPLE_optimized);
+ NewCU.addFlag(*Die, dwarf::DW_AT_APPLE_optimized);
StringRef Flags = DIUnit.getFlags();
if (!Flags.empty())
- NewCU.addString(Die, dwarf::DW_AT_APPLE_flags, Flags);
+ NewCU.addString(*Die, dwarf::DW_AT_APPLE_flags, Flags);
if (unsigned RVer = DIUnit.getRunTimeVersion())
- NewCU.addUInt(Die, dwarf::DW_AT_APPLE_major_runtime_vers,
+ NewCU.addUInt(*Die, dwarf::DW_AT_APPLE_major_runtime_vers,
dwarf::DW_FORM_data1, RVer);
if (!FirstCU)
@@ -707,7 +707,7 @@ void DwarfDebug::constructSubprogramDIE(DwarfCompileUnit &TheCU,
// class type.
return;
- DIE *SubprogramDie = TheCU.getOrCreateSubprogramDIE(SP);
+ DIE &SubprogramDie = *TheCU.getOrCreateSubprogramDIE(SP);
// Expose as a global name.
TheCU.addGlobalName(SP.getName(), SubprogramDie, resolve(SP.getContext()));
@@ -734,7 +734,7 @@ void DwarfDebug::constructImportedEntityDIE(DwarfCompileUnit &TheCU,
assert(Module.Verify() &&
"Use one of the MDNode * overloads to handle invalid metadata");
assert(Context && "Should always have a context for an imported_module");
- DIE *IMDie = TheCU.createAndAddDIE(Module.getTag(), *Context, Module);
+ DIE &IMDie = *TheCU.createAndAddDIE(Module.getTag(), *Context, Module);
DIE *EntityDie;
DIDescriptor Entity = resolve(Module.getEntity());
if (Entity.isNameSpace())
@@ -819,11 +819,11 @@ void DwarfDebug::beginModule() {
void DwarfDebug::computeInlinedDIEs() {
// Attach DW_AT_inline attribute with inlined subprogram DIEs.
for (DIE *ISP : InlinedSubprogramDIEs)
- FirstCU->addUInt(ISP, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
+ FirstCU->addUInt(*ISP, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
for (const auto &AI : AbstractSPDies) {
- DIE *ISP = AI.second;
- if (InlinedSubprogramDIEs.count(ISP))
+ DIE &ISP = *AI.second;
+ if (InlinedSubprogramDIEs.count(&ISP))
continue;
FirstCU->addUInt(ISP, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
}
@@ -893,19 +893,19 @@ void DwarfDebug::finalizeModuleInfo() {
if (useSplitDwarf()) {
// Emit a unique identifier for this CU.
uint64_t ID = DIEHash(Asm).computeCUSignature(*TheU->getUnitDie());
- TheU->addUInt(TheU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
+ TheU->addUInt(*TheU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
dwarf::DW_FORM_data8, ID);
- SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
+ SkCU->addUInt(*SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
dwarf::DW_FORM_data8, ID);
// We don't keep track of which addresses are used in which CU so this
// is a bit pessimistic under LTO.
if (!AddrPool.isEmpty())
- addSectionLabel(*Asm, *SkCU, SkCU->getUnitDie(),
+ addSectionLabel(*Asm, *SkCU, *SkCU->getUnitDie(),
dwarf::DW_AT_GNU_addr_base, DwarfAddrSectionSym,
DwarfAddrSectionSym);
if (!TheU->getRangeLists().empty())
- addSectionLabel(*Asm, *SkCU, SkCU->getUnitDie(),
+ addSectionLabel(*Asm, *SkCU, *SkCU->getUnitDie(),
dwarf::DW_AT_GNU_ranges_base,
DwarfDebugRangeSectionSym, DwarfDebugRangeSectionSym);
}
@@ -921,7 +921,7 @@ void DwarfDebug::finalizeModuleInfo() {
unsigned NumRanges = TheU->getRanges().size();
if (NumRanges) {
if (NumRanges > 1) {
- addSectionLabel(*Asm, U, U.getUnitDie(), dwarf::DW_AT_ranges,
+ addSectionLabel(*Asm, U, *U.getUnitDie(), dwarf::DW_AT_ranges,
Asm->GetTempSymbol("cu_ranges", U.getUniqueID()),
DwarfDebugRangeSectionSym);
@@ -929,13 +929,13 @@ void DwarfDebug::finalizeModuleInfo() {
// DW_AT_ranges to specify the default base address for use in
// location lists (see Section 2.6.2) and range lists (see Section
// 2.17.3).
- U.addUInt(U.getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
+ U.addUInt(*U.getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
0);
} else {
RangeSpan &Range = TheU->getRanges().back();
- U.addLocalLabelAddress(U.getUnitDie(), dwarf::DW_AT_low_pc,
+ U.addLocalLabelAddress(*U.getUnitDie(), dwarf::DW_AT_low_pc,
Range.getStart());
- U.addLabelDelta(U.getUnitDie(), dwarf::DW_AT_high_pc, Range.getEnd(),
+ U.addLabelDelta(*U.getUnitDie(), dwarf::DW_AT_high_pc, Range.getEnd(),
Range.getStart());
}
}
@@ -1668,7 +1668,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
constructScopeDIE(TheCU, AScope);
}
- DIE *CurFnDIE = constructScopeDIE(TheCU, FnScope);
+ DIE &CurFnDIE = *constructScopeDIE(TheCU, FnScope);
if (!CurFn->getTarget().Options.DisableFramePointerElim(*CurFn))
TheCU.addFlag(CurFnDIE, dwarf::DW_AT_APPLE_omit_frame_ptr);
@@ -2384,7 +2384,7 @@ void DwarfDebug::emitDebugRanges() {
// DWARF5 Experimental Separate Dwarf emitters.
-void DwarfDebug::initSkeletonUnit(const DwarfUnit &U, DIE *Die,
+void DwarfDebug::initSkeletonUnit(const DwarfUnit &U, DIE &Die,
std::unique_ptr<DwarfUnit> NewU) {
NewU->addLocalString(Die, dwarf::DW_AT_GNU_dwo_name,
U.getCUNode().getSplitDebugFilename());
@@ -2411,7 +2411,7 @@ DwarfCompileUnit &DwarfDebug::constructSkeletonCU(const DwarfCompileUnit &CU) {
NewCU.initStmtList(DwarfLineSectionSym);
- initSkeletonUnit(CU, Die, std::move(OwnedUnit));
+ initSkeletonUnit(CU, *Die, std::move(OwnedUnit));
return NewCU;
}
@@ -2431,7 +2431,7 @@ DwarfTypeUnit &DwarfDebug::constructSkeletonTU(DwarfTypeUnit &TU) {
NewTU.initSection(
Asm->getObjFileLowering().getDwarfTypesSection(TU.getTypeSignature()));
- initSkeletonUnit(TU, Die, std::move(OwnedUnit));
+ initSkeletonUnit(TU, *Die, std::move(OwnedUnit));
return NewTU;
}
@@ -2479,7 +2479,7 @@ MCDwarfDwoLineTable *DwarfDebug::getDwoLineTable(const DwarfCompileUnit &CU) {
}
void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
- StringRef Identifier, DIE *RefDie,
+ StringRef Identifier, DIE &RefDie,
DICompositeType CTy) {
// Flag the type unit reference as a declaration so that if it contains
// members (implicit special members, static data member definitions, member
@@ -2501,7 +2501,7 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
TU = &NewTU;
InfoHolder.addUnit(std::move(OwnedUnit));
- NewTU.addUInt(UnitDie, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
+ NewTU.addUInt(*UnitDie, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
CU.getLanguage());
MD5 Hash;
@@ -2528,7 +2528,7 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
CU.addDIETypeSignature(RefDie, NewTU);
}
-void DwarfDebug::attachLowHighPC(DwarfCompileUnit &Unit, DIE *D,
+void DwarfDebug::attachLowHighPC(DwarfCompileUnit &Unit, DIE &D,
MCSymbol *Begin, MCSymbol *End) {
Unit.addLabelAddress(D, dwarf::DW_AT_low_pc, Begin);
if (DwarfVersion < 4)
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 839a8a0253..69c1b12d09 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -352,7 +352,7 @@ class DwarfDebug : public AsmPrinterHandler {
/// \brief A helper function to construct a RangeSpanList for a given
/// lexical scope.
- void addScopeRangeList(DwarfCompileUnit &TheCU, DIE *ScopeDIE,
+ void addScopeRangeList(DwarfCompileUnit &TheCU, DIE &ScopeDIE,
const SmallVectorImpl<InsnRange> &Range);
/// \brief Construct new DW_TAG_lexical_block for this scope and
@@ -453,7 +453,7 @@ class DwarfDebug : public AsmPrinterHandler {
/// DWARF 5 Experimental Split Dwarf Emitters
/// \brief Initialize common features of skeleton units.
- void initSkeletonUnit(const DwarfUnit &U, DIE *Die,
+ void initSkeletonUnit(const DwarfUnit &U, DIE &Die,
std::unique_ptr<DwarfUnit> NewU);
/// \brief Construct the split debug info compile unit for the debug info
@@ -478,7 +478,7 @@ class DwarfDebug : public AsmPrinterHandler {
/// Flags to let the linker know we have emitted new style pubnames. Only
/// emit it here if we don't have a skeleton CU for split dwarf.
- void addGnuPubAttributes(DwarfUnit &U, DIE *D) const;
+ void addGnuPubAttributes(DwarfUnit &U, DIE &D) const;
/// \brief Create new DwarfCompileUnit for the given metadata node with tag
/// DW_TAG_compile_unit.
@@ -535,7 +535,7 @@ class DwarfDebug : public AsmPrinterHandler {
/// \brief Return Label immediately following the instruction.
MCSymbol *getLabelAfterInsn(const MachineInstr *MI);
- void attachLowHighPC(DwarfCompileUnit &Unit, DIE *D, MCSymbol *Begin,
+ void attachLowHighPC(DwarfCompileUnit &Unit, DIE &D, MCSymbol *Begin,
MCSymbol *End);
public:
@@ -573,7 +573,7 @@ public:
/// \brief Add a DIE to the set of types that we're going to pull into
/// type units.
void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier,
- DIE *Die, DICompositeType CTy);
+ DIE &Die, DICompositeType CTy);
/// \brief Add a label so that arange data can be generated for it.
void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 47d2157e4c..b7bde972aa 100644
--- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -62,7 +62,7 @@ DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DIE *D, DwarfCompileUnit &CU,
: DwarfUnit(UID, D, CU.getCUNode(), A, DW, DWU), CU(CU),
SplitLineTable(SplitLineTable) {
if (SplitLineTable)
- addSectionOffset(UnitDie.get(), dwarf::DW_AT_stmt_list, 0);
+ addSectionOffset(*UnitDie, dwarf::DW_AT_stmt_list, 0);
}
/// ~Unit - Destructor for compile unit.
@@ -160,39 +160,39 @@ void DwarfUnit::insertDIE(DIDescriptor Desc, DIE *D) {
}
/// addFlag - Add a flag that is true.
-void DwarfUnit::addFlag(DIE *Die, dwarf::Attribute Attribute) {
+void DwarfUnit::addFlag(DIE &Die, dwarf::Attribute Attribute) {
if (DD->getDwarfVersion() >= 4)
- Die->addValue(Attribute, dwarf::DW_FORM_flag_present, DIEIntegerOne);
+ Die.addValue(Attribute, dwarf::DW_FORM_flag_present, DIEIntegerOne);
else
- Die->addValue(Attribute, dwarf::DW_FORM_flag, DIEIntegerOne);
+ Die.addValue(Attribute, dwarf::DW_FORM_flag, DIEIntegerOne);
}
/// addUInt - Add an unsigned integer attribute data and value.
///
-void DwarfUnit::addUInt(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addUInt(DIE &Die, dwarf::Attribute Attribute,
Optional<dwarf::Form> Form, uint64_t Integer) {
if (!Form)
Form = DIEInteger::BestForm(false, Integer);
DIEValue *Value = Integer == 1 ? DIEIntegerOne : new (DIEValueAllocator)
DIEInteger(Integer);
- Die->addValue(Attribute, *Form, Value);
+ Die.addValue(Attribute, *Form, Value);
}
-void DwarfUnit::addUInt(DIE *Block, dwarf::Form Form, uint64_t Integer) {
+void DwarfUnit::addUInt(DIE &Block, dwarf::Form Form, uint64_t Integer) {
addUInt(Block, (dwarf::Attribute)0, Form, Integer);
}
/// addSInt - Add an signed integer attribute data and value.
///
-void DwarfUnit::addSInt(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addSInt(DIE &Die, dwarf::Attribute Attribute,
Optional<dwarf::Form> Form, int64_t Integer) {
if (!Form)
Form = DIEInteger::BestForm(true, Integer);
DIEValue *Value = new (DIEValueAllocator) DIEInteger(Integer);
- Die->addValue(Attribute, *Form, Value);
+ Die.addValue(Attribute, *Form, Value);
}
-void DwarfUnit::addSInt(DIELoc *Die, Optional<dwarf::Form> Form,
+void DwarfUnit::addSInt(DIELoc &Die, Optional<dwarf::Form> Form,
int64_t Integer) {
addSInt(Die, (dwarf::Attribute)0, Form, Integer);
}
@@ -202,7 +202,7 @@ void DwarfUnit::addSInt(DIELoc *Die, Optional<dwarf::Form> Form,
/// more predictable sizes. In the case of split dwarf we emit an index
/// into another table which gets us the static offset into the string
/// table.
-void DwarfUnit::addString(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addString(DIE &Die, dwarf::Attribute Attribute,
StringRef String) {
if (!DD->useSplitDwarf())
@@ -211,12 +211,12 @@ void DwarfUnit::addString(DIE *Die, dwarf::Attribute Attribute,
unsigned idx = DU->getStringPoolIndex(String);
DIEValue *Value = new (DIEValueAllocator) DIEInteger(idx);
DIEValue *Str = new (DIEValueAllocator) DIEString(Value, String);
- Die->addValue(Attribute, dwarf::DW_FORM_GNU_str_index, Str);
+ Die.addValue(Attribute, dwarf::DW_FORM_GNU_str_index, Str);
}
/// addLocalString - Add a string attribute data and value. This is guaranteed
/// to be in the local string pool instead of indirected.
-void DwarfUnit::addLocalString(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addLocalString(DIE &Die, dwarf::Attribute Attribute,
StringRef String) {
MCSymbol *Symb = DU->getStringPoolEntry(String);
DIEValue *Value;
@@ -227,41 +227,41 @@ void DwarfUnit::addLocalString(DIE *Die, dwarf::Attribute Attribute,
Value = new (DIEValueAllocator) DIEDelta(Symb, StringPool);
}
DIEValue *Str = new (DIEValueAllocator) DIEString(Value, String);
- Die->addValue(Attribute, dwarf::DW_FORM_strp, Str);
+ Die.addValue(Attribute, dwarf::DW_FORM_strp, Str);
}
/// addExpr - Add a Dwarf expression attribute data and value.
///
-void DwarfUnit::addExpr(DIELoc *Die, dwarf::Form Form, const MCExpr *Expr) {
+void DwarfUnit::addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr) {
DIEValue *Value = new (DIEValueAllocator) DIEExpr(Expr);
- Die->addValue((dwarf::Attribute)0, Form, Value);
+ Die.addValue((dwarf::Attribute)0, Form, Value);
}
/// addLocationList - Add a Dwarf loclistptr attribute data and value.
///
-void DwarfUnit::addLocationList(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addLocationList(DIE &Die, dwarf::Attribute Attribute,
unsigned Index) {
DIEValue *Value = new (DIEValueAllocator) DIELocList(Index);
dwarf::Form Form = DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset
: dwarf::DW_FORM_data4;
- Die->addValue(Attribute, Form, Value);
+ Die.addValue(Attribute, Form, Value);
}
/// addLabel - Add a Dwarf label attribute data and value.
///
-void DwarfUnit::addLabel(DIE *Die, dwarf::Attribute Attribute, dwarf::Form Form,
+void DwarfUnit::addLabel(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form,
const MCSymbol *Label) {
DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
- Die->addValue(Attribute, Form, Value);
+ Die.addValue(Attribute, Form, Value);
}
-void DwarfUnit::addLabel(DIELoc *Die, dwarf::Form Form, const MCSymbol *Label) {
+void DwarfUnit::addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label) {
addLabel(Die, (dwarf::Attribute)0, Form, Label);
}
/// addSectionLabel - Add a Dwarf section label attribute data and value.
///
-void DwarfUnit::addSectionLabel(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addSectionLabel(DIE &Die, dwarf::Attribute Attribute,
const MCSymbol *Label) {
if (DD->getDwarfVersion() >= 4)
addLabel(Die, Attribute, dwarf::DW_FORM_sec_offset, Label);
@@ -271,7 +271,7 @@ void DwarfUnit::addSectionLabel(DIE *Die, dwarf::Attribute Attribute,
/// addSectionOffset - Add an offset into a section attribute data and value.
///
-void DwarfUnit::addSectionOffset(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addSectionOffset(DIE &Die, dwarf::Attribute Attribute,
uint64_t Integer) {
if (DD->getDwarfVersion() >= 4)
addUInt(Die, Attribute, dwarf::DW_FORM_sec_offset, Integer);
@@ -282,7 +282,7 @@ void DwarfUnit::addSectionOffset(DIE *Die, dwarf::Attribute Attribute,
/// addLabelAddress - Add a dwarf label attribute data and value using
/// DW_FORM_addr or DW_FORM_GNU_addr_index.
///
-void DwarfCompileUnit::addLabelAddress(DIE *Die, dwarf::Attribute Attribute,
+void DwarfCompileUnit::addLabelAddress(DIE &Die, dwarf::Attribute Attribute,
const MCSymbol *Label) {
if (!DD->useSplitDwarf())
@@ -293,22 +293,18 @@ void DwarfCompileUnit::addLabelAddress(DIE *Die, dwarf::Attribute Attribute,
unsigned idx = DD->getAddressPool().getIndex(Label);
DIEValue *Value = new (DIEValueAllocator) DIEInteger(idx);
- Die->addValue(Attribute, dwarf::DW_FORM_GNU_addr_index, Value);
+ Die.addValue(Attribute, dwarf::DW_FORM_GNU_addr_index, Value);
}
-void DwarfCompileUnit::addLocalLabelAddress(DIE *Die,
+void DwarfCompileUnit::addLocalLabelAddress(DIE &Die,
dwarf::Attribute Attribute,
const MCSymbol *Label) {
if (Label)
DD->addArangeLabel(SymbolCU(this, Label));
- if (Label) {
- DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
- Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
- } else {
- DIEValue *Value = new (DIEValueAllocator) DIEInteger(0);
- Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
- }
+ Die.addValue(Attribute, dwarf::DW_FORM_addr,
+ Label ? (DIEValue *)new (DIEValueAllocator) DIELabel(Label)
+ : new (DIEValueAllocator) DIEInteger(0));
}
unsigned DwarfCompileUnit::getOrCreateSourceID(StringRef FileName, StringRef DirName) {
@@ -330,7 +326,7 @@ unsigned DwarfTypeUnit::getOrCreateSourceID(StringRef FileName, StringRef DirNam
/// addOpAddress - Add a dwarf op address data and value using the
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
///
-void DwarfUnit::addOpAddress(DIELoc *Die, const MCSymbol *Sym) {
+void DwarfUnit::addOpAddress(DIELoc &Die, const MCSymbol *Sym) {
if (!DD->useSplitDwarf()) {
addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);
addLabel(Die, dwarf::DW_FORM_udata, Sym);
@@ -343,44 +339,43 @@ void DwarfUnit::addOpAddress(DIELoc *Die, const MCSymbol *Sym) {
/// addSectionDelta - Add a section label delta attribute data and value.
///
-void DwarfUnit::addSectionDelta(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addSectionDelta(DIE &Die, dwarf::Attribute Attribute,
const MCSymbol *Hi, const MCSymbol *Lo) {
DIEValue *Value = new (DIEValueAllocator) DIEDelta(Hi, Lo);
- if (DD->getDwarfVersion() >= 4)
- Die->addValue(Attribute, dwarf::DW_FORM_sec_offset, Value);
- else
- Die->addValue(Attribute, dwarf::DW_FORM_data4, Value);
+ Die.addValue(Attribute, DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset
+ : dwarf::DW_FORM_data4,
+ Value);
}
-void DwarfUnit::addLabelDelta(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addLabelDelta(DIE &Die, dwarf::Attribute Attribute,
const MCSymbol *Hi, const MCSymbol *Lo) {
DIEValue *Value = new (DIEValueAllocator) DIEDelta(Hi, Lo);
- Die->addValue(Attribute, dwarf::DW_FORM_data4, Value);
+ Die.addValue(Attribute, dwarf::DW_FORM_data4, Value);
}
/// addDIEEntry - Add a DIE attribute data and value.
///
-void DwarfUnit::addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIE *Entry) {
+void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE *Entry) {
addDIEEntry(Die, Attribute, createDIEEntry(Entry));
}
-void DwarfUnit::addDIETypeSignature(DIE *Die, const DwarfTypeUnit &Type) {
- Die->addValue(dwarf::DW_AT_signature, dwarf::DW_FORM_ref_sig8,
- new (DIEValueAllocator) DIETypeSignature(Type));
+void DwarfUnit::addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type) {
+ Die.addValue(dwarf::DW_AT_signature, dwarf::DW_FORM_ref_sig8,
+ new (DIEValueAllocator) DIETypeSignature(Type));
}
-void DwarfUnit::addDIEEntry(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute,
DIEEntry *Entry) {
- const DIE *DieCU = Die->getUnitOrNull();
+ const DIE *DieCU = Die.getUnitOrNull();
const DIE *EntryCU = Entry->getEntry()->getUnitOrNull();
if (!DieCU)
// We assume that Die belongs to this CU, if it is not linked to any CU yet.
DieCU = getUnitDie();
if (!EntryCU)
EntryCU = getUnitDie();
- Die->addValue(Attribute, EntryCU == DieCU ? dwarf::DW_FORM_ref4
- : dwarf::DW_FORM_ref_addr,
- Entry);
+ Die.addValue(Attribute,
+ EntryCU == DieCU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr,
+ Entry);
}
/// Create a DIE with the given Tag, add the DIE to its parent, and
@@ -397,22 +392,22 @@ DIE *DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, DIDescriptor N) {
/// addBlock - Add block data.
///
-void DwarfUnit::addBlock(DIE *Die, dwarf::Attribute Attribute, DIELoc *Loc) {
+void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc) {
Loc->ComputeSize(Asm);
DIELocs.push_back(Loc); // Memoize so we can call the destructor later on.
- Die->addValue(Attribute, Loc->BestForm(DD->getDwarfVersion()), Loc);
+ Die.addValue(Attribute, Loc->BestForm(DD->getDwarfVersion()), Loc);
}
-void DwarfUnit::addBlock(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute,
DIEBlock *Block) {
Block->ComputeSize(Asm);
DIEBlocks.push_back(Block); // Memoize so we can call the destructor later on.
- Die->addValue(Attribute, Block->BestForm(), Block);
+ Die.addValue(Attribute, Block->BestForm(), Block);
}
/// addSourceLine - Add location information to specified debug information
/// entry.
-void DwarfUnit::addSourceLine(DIE *Die, unsigned Line, StringRef File,
+void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, StringRef File,
StringRef Directory) {
if (Line == 0)
return;
@@ -425,7 +420,7 @@ void DwarfUnit::addSourceLine(DIE *Die, unsigned Line, StringRef File,
/// addSourceLine - Add location information to specified debug information
/// entry.
-void DwarfUnit::addSourceLine(DIE *Die, DIVariable V) {
+void DwarfUnit::addSourceLine(DIE &Die, DIVariable V) {
assert(V.isVariable());
addSourceLine(Die, V.getLineNumber(), V.getContext().getFilename(),
@@ -434,7 +429,7 @@ void DwarfUnit::addSourceLine(DIE *Die, DIVariable V) {
/// addSourceLine - Add location information to specified debug information
/// entry.
-void DwarfUnit::addSourceLine(DIE *Die, DIGlobalVariable G) {
+void DwarfUnit::addSourceLine(DIE &Die, DIGlobalVariable G) {
assert(G.isGlobalVariable());
addSourceLine(Die, G.getLineNumber(), G.getFilename(), G.getDirectory());
@@ -442,7 +437,7 @@ void DwarfUnit::addSourceLine(DIE *Die, DIGlobalVariable G) {
/// addSourceLine - Add location information to specified debug information
/// entry.
-void DwarfUnit::addSourceLine(DIE *Die, DISubprogram SP) {
+void DwarfUnit::addSourceLine(DIE &Die, DISubprogram SP) {
assert(SP.isSubprogram());
addSourceLine(Die, SP.getLineNumber(), SP.getFilename(), SP.getDirectory());
@@ -450,7 +445,7 @@ void DwarfUnit::addSourceLine(DIE *Die, DISubprogram SP) {
/// addSourceLine - Add location information to specified debug information
/// entry.
-void DwarfUnit::addSourceLine(DIE *Die, DIType Ty) {
+void DwarfUnit::addSourceLine(DIE &Die, DIType Ty) {
assert(Ty.isType());
addSourceLine(Die, Ty.getLineNumber(), Ty.getFilename(), Ty.getDirectory());
@@ -458,7 +453,7 @@ void DwarfUnit::addSourceLine(DIE *Die, DIType Ty) {
/// addSourceLine - Add location information to specified debug information
/// entry.
-void DwarfUnit::addSourceLine(DIE *Die, DIObjCProperty Ty) {
+void DwarfUnit::addSourceLine(DIE &Die, DIObjCProperty Ty) {
assert(Ty.isObjCProperty());
DIFile File = Ty.getFile();
@@ -468,7 +463,7 @@ void DwarfUnit::addSourceLine(DIE *Die, DIObjCProperty Ty) {
/// addSourceLine - Add location information to specified debug information
/// entry.
-void DwarfUnit::addSourceLine(DIE *Die, DINameSpace NS) {
+void DwarfUnit::addSourceLine(DIE &Die, DINameSpace NS) {
assert(NS.Verify());
addSourceLine(Die, NS.getLineNumber(), NS.getFilename(), NS.getDirectory());
@@ -476,7 +471,7 @@ void DwarfUnit::addSourceLine(DIE *Die, DINameSpace NS) {
/// addVariableAddress - Add DW_AT_location attribute for a
/// DbgVariable based on provided MachineLocation.
-void DwarfUnit::addVariableAddress(const DbgVariable &DV, DIE *Die,
+void DwarfUnit::addVariableAddress(const DbgVariable &DV, DIE &Die,
MachineLocation Location) {
if (DV.variableHasComplexAddress())
addComplexAddress(DV, Die, dwarf::DW_AT_location, Location);
@@ -488,7 +483,7 @@ void DwarfUnit::addVariableAddress(const DbgVariable &DV, DIE *Die,
}
/// addRegisterOp - Add register operand.
-void DwarfUnit::addRegisterOp(DIELoc *TheDie, unsigned Reg) {
+void DwarfUnit::addRegisterOp(DIELoc &TheDie, unsigned Reg) {
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
int DWReg = RI->getDwarfRegNum(Reg, false);
bool isSubRegister = DWReg < 0;
@@ -533,7 +528,7 @@ void DwarfUnit::addRegisterOp(DIELoc *TheDie, unsigned Reg) {
}
/// addRegisterOffset - Add register offset.
-void DwarfUnit::addRegisterOffset(DIELoc *TheDie, unsigned Reg,
+void DwarfUnit::addRegisterOffset(DIELoc &TheDie, unsigned Reg,
int64_t Offset) {
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
unsigned DWReg = RI->getDwarfRegNum(Reg, false);
@@ -552,16 +547,16 @@ void DwarfUnit::addRegisterOffset(DIELoc *TheDie, unsigned Reg,
/// addAddress - Add an address attribute to a die based on the location
/// provided.
-void DwarfUnit::addAddress(DIE *Die, dwarf::Attribute Attribute,
+void DwarfUnit::addAddress(DIE &Die, dwarf::Attribute Attribute,
const MachineLocation &Location, bool Indirect) {
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
if (Location.isReg() && !Indirect)
- addRegisterOp(Loc, Location.getReg());
+ addRegisterOp(*Loc, Location.getReg());
else {
- addRegisterOffset(Loc, Location.getReg(), Location.getOffset());
+ addRegisterOffset(*Loc, Location.getReg(), Location.getOffset());
if (Indirect && !Location.isReg()) {
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
}
}
@@ -574,7 +569,7 @@ void DwarfUnit::addAddress(DIE *Die, dwarf::Attribute Attribute,
/// given the extra address information encoded in the DbgVariable, starting
/// from the starting location. Add the DWARF information to the die.
///
-void DwarfUnit::addComplexAddress(const DbgVariable &DV, DIE *Die,
+void DwarfUnit::addComplexAddress(const DbgVariable &DV, DIE &Die,
dwarf::Attribute Attribute,
const MachineLocation &Location) {
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
@@ -584,21 +579,21 @@ void DwarfUnit::addComplexAddress(const DbgVariable &DV, DIE *Die,
if (N >= 2 && DV.getAddrElement(0) == DIBuilder::OpPlus) {
// If first address element is OpPlus then emit
// DW_OP_breg + Offset instead of DW_OP_reg + Offset.
- addRegisterOffset(Loc, Location.getReg(), DV.getAddrElement(1));
+ addRegisterOffset(*Loc, Location.getReg(), DV.getAddrElement(1));
i = 2;
} else
- addRegisterOp(Loc, Location.getReg());
+ addRegisterOp(*Loc, Location.getReg());
} else
- addRegisterOffset(Loc, Location.getReg(), Location.getOffset());
+ addRegisterOffset(*Loc, Location.getReg(), Location.getOffset());
for (; i < N; ++i) {
uint64_t Element = DV.getAddrElement(i);
if (Element == DIBuilder::OpPlus) {
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
- addUInt(Loc, dwarf::DW_FORM_udata, DV.getAddrElement(++i));
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
+ addUInt(*Loc, dwarf::DW_FORM_udata, DV.getAddrElement(++i));
} else if (Element == DIBuilder::OpDeref) {
if (!Location.isReg())
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
} else
llvm_unreachable("unknown DIBuilder Opcode");
}
@@ -667,7 +662,7 @@ void DwarfUnit::addComplexAddress(const DbgVariable &DV, DIE *Die,
/// starting location. Add the DWARF information to the die. For
/// more information, read large comment just above here.
///
-void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE *Die,
+void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE &Die,
dwarf::Attribute Attribute,
const MachineLocation &Location) {
DIType Ty = DV.getType();
@@ -709,33 +704,33 @@ void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE *Die,
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
if (Location.isReg())
- addRegisterOp(Loc, Location.getReg());
+ addRegisterOp(*Loc, Location.getReg());
else
- addRegisterOffset(Loc, Location.getReg(), Location.getOffset());
+ addRegisterOffset(*Loc, Location.getReg(), Location.getOffset());
// If we started with a pointer to the __Block_byref... struct, then
// the first thing we need to do is dereference the pointer (DW_OP_deref).
if (isPointer)
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
// Next add the offset for the '__forwarding' field:
// DW_OP_plus_uconst ForwardingFieldOffset. Note there's no point in
// adding the offset if it's 0.
if (forwardingFieldOffset > 0) {
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
- addUInt(Loc, dwarf::DW_FORM_udata, forwardingFieldOffset);
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
+ addUInt(*Loc, dwarf::DW_FORM_udata, forwardingFieldOffset);
}
// Now dereference the __forwarding field to get to the real __Block_byref
// struct: DW_OP_deref.
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
// Now that we've got the real __Block_byref... struct, add the offset
// for the variable's field to get to the location of the actual variable:
// DW_OP_plus_uconst varFieldOffset. Again, don't add if it's 0.
if (varFieldOffset > 0) {
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
- addUInt(Loc, dwarf::DW_FORM_udata, varFieldOffset);
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
+ addUInt(*Loc, dwarf::DW_FORM_udata, varFieldOffset);
}
// Now attach the location information to the DIE.
@@ -803,7 +798,7 @@ static uint64_t getBaseTypeSize(DwarfDebug *DD, DIDerivedType Ty) {
}
/// addConstantValue - Add constant value entry in variable DIE.
-void DwarfUnit::addConstantValue(DIE *Die, const MachineOperand &MO,
+void DwarfUnit::addConstantValue(DIE &Die, const MachineOperand &MO,
DIType Ty) {
// FIXME: This is a bit conservative/simple - it emits negative values at
// their maximum bit width which is a bit unfortunate (& doesn't prefer
@@ -842,7 +837,7 @@ void DwarfUnit::addConstantValue(DIE *Die, const MachineOperand &MO,
}
/// addConstantFPValue - Add constant value entry in variable DIE.
-void DwarfUnit::addConstantFPValue(DIE *Die, const MachineOperand &MO) {
+void DwarfUnit::addConstantFPValue(DIE &Die, const MachineOperand &MO) {
assert(MO.isFPImm() && "Invalid machine operand!");
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
APFloat FPImm = MO.getFPImm()->getValueAPF();
@@ -859,25 +854,25 @@ void DwarfUnit::addConstantFPValue(DIE *Die, const MachineOperand &MO) {
// Output the constant to DWARF one byte at a time.
for (; Start != Stop; Start += Incr)
- addUInt(Block, dwarf::DW_FORM_data1, (unsigned char)0xFF & FltPtr[Start]);
+ addUInt(*Block, dwarf::DW_FORM_data1, (unsigned char)0xFF & FltPtr[Start]);
addBlock(Die, dwarf::DW_AT_const_value, Block);
}
/// addConstantFPValue - Add constant value entry in variable DIE.
-void DwarfUnit::addConstantFPValue(DIE *Die, const ConstantFP *CFP) {
+void DwarfUnit::addConstantFPValue(DIE &Die, const ConstantFP *CFP) {
// Pass this down to addConstantValue as an unsigned bag of bits.
addConstantValue(Die, CFP->getValueAPF().bitcastToAPInt(), true);
}
/// addConstantValue - Add constant value entry in variable DIE.
-void DwarfUnit::addConstantValue(DIE *Die, const ConstantInt *CI,
+void DwarfUnit::addConstantValue(DIE &Die, const ConstantInt *CI,
bool Unsigned) {
addConstantValue(Die, CI->getValue(), Unsigned);
}
// addConstantValue - Add constant value entry in variable DIE.
-void DwarfUnit::addConstantValue(DIE *Die, const APInt &Val, bool Unsigned) {
+void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, bool Unsigned) {
unsigned CIBitWidth = Val.getBitWidth();
if (CIBitWidth <= 64) {
// If we're a signed constant definitely use sdata.
@@ -926,7 +921,7 @@ void DwarfUnit::addConstantValue(DIE *Die, const APInt &Val, bool Unsigned) {
c = Ptr64[i / 8] >> (8 * (i & 7));
else
c = Ptr64[(NumBytes - 1 - i) / 8] >> (8 * ((NumBytes - 1 - i) & 7));
- addUInt(Block, dwarf::DW_FORM_data1, c);
+ addUInt(*Block, dwarf::DW_FORM_data1, c);
}
addBlock(Die, dwarf::DW_AT_const_value, Block);
@@ -997,32 +992,31 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
DIE *ContextDIE = getOrCreateContextDIE(Context);
assert(ContextDIE);
- DIE *TyDIE = getDIE(Ty);
- if (TyDIE)
+ if (DIE *TyDIE = getDIE(Ty))
return TyDIE;
// Create new type.
- TyDIE = createAndAddDIE(Ty.getTag(), *ContextDIE, Ty);
+ DIE &TyDIE = *createAndAddDIE(Ty.getTag(), *ContextDIE, Ty);
- updateAcceleratorTables(Context, Ty, TyDIE);
+ updateAcceleratorTables(Context, Ty, &TyDIE);
if (Ty.isBasicType())
- constructTypeDIE(*TyDIE, DIBasicType(Ty));
+ constructTypeDIE(TyDIE, DIBasicType(Ty));
else if (Ty.isCompositeType()) {
DICompositeType CTy(Ty);
if (GenerateDwarfTypeUnits && !Ty.isForwardDecl())
if (MDString *TypeId = CTy.getIdentifier()) {
DD->addDwarfTypeUnitType(getCU(), TypeId->getString(), TyDIE, CTy);
// Skip updating the accelerator tables since this is not the full type.
- return TyDIE;
+ return &TyDIE;
}
- constructTypeDIE(*TyDIE, CTy);
+ constructTypeDIE(TyDIE, CTy);
} else {
assert(Ty.isDerivedType() && "Unknown kind of DIType");
- constructTypeDIE(*TyDIE, DIDerivedType(Ty));
+ constructTypeDIE(TyDIE, DIDerivedType(Ty));
}
- return TyDIE;
+ return &TyDIE;
}
void DwarfUnit::updateAcceleratorTables(DIScope Context, DIType Ty,
@@ -1046,7 +1040,7 @@ void DwarfUnit::updateAcceleratorTables(DIScope Context, DIType Ty,
}
/// addType - Add a new type attribute to the specified entity.
-void DwarfUnit::addType(DIE *Entity, DIType Ty, dwarf::Attribute Attribute) {
+void DwarfUnit::addType(DIE &Entity, DIType Ty, dwarf::Attribute Attribute) {
assert(Ty && "Trying to add a type that doesn't exist?");
// Check for pre-existence.
@@ -1067,11 +1061,11 @@ void DwarfUnit::addType(DIE *Entity, DIType Ty, dwarf::Attribute Attribute) {
}
/// addGlobalName - Add a new global name to the compile unit.
-void DwarfUnit::addGlobalName(StringRef Name, DIE *Die, DIScope Context) {
+void DwarfUnit::addGlobalName(StringRef Name, DIE &Die, DIScope Context) {
if (getCUNode().getEmissionKind() == DIBuilder::LineTablesOnly)
return;
std::string FullName = getParentContextString(Context) + Name.str();
- GlobalNames[FullName] = Die;
+ GlobalNames[FullName] = &Die;
}
/// getParentContextString - Walks the metadata parent chain in a language
@@ -1120,17 +1114,17 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DIBasicType BTy) {
StringRef Name = BTy.getName();
// Add name if not anonymous or intermediate type.
if (!Name.empty())
- addString(&Buffer, dwarf::DW_AT_name, Name);
+ addString(Buffer, dwarf::DW_AT_name, Name);
// An unspecified type only has a name attribute.
if (BTy.getTag() == dwarf::DW_TAG_unspecified_type)
return;
- addUInt(&Buffer, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
+ addUInt(Buffer, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
BTy.getEncoding());
uint64_t Size = BTy.getSizeInBits() >> 3;
- addUInt(&Buffer, dwarf::DW_AT_byte_size, None, Size);
+ addUInt(Buffer, dwarf::DW_AT_byte_size, None, Size);
}
/// constructTypeDIE - Construct derived type die from DIDerivedType.
@@ -1143,22 +1137,22 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DIDerivedType DTy) {
// Map to main type, void will not have a type.
DIType FromTy = resolve(DTy.getTypeDerivedFrom());
if (FromTy)
- addType(&Buffer, FromTy);
+ addType(Buffer, FromTy);
// Add name if not anonymous or intermediate type.
if (!Name.empty())
- addString(&Buffer, dwarf::DW_AT_name, Name);
+ addString(Buffer, dwarf::DW_AT_name, Name);
// Add size if non-zero (derived types might be zero-sized.)
if (Size && Tag != dwarf::DW_TAG_pointer_type)
- addUInt(&Buffer, dwarf::DW_AT_byte_size, None, Size);
+ addUInt(Buffer, dwarf::DW_AT_byte_size, None, Size);
if (Tag == dwarf::DW_TAG_ptr_to_member_type)
- addDIEEntry(&Buffer, dwarf::DW_AT_containing_type,
+ addDIEEntry(Buffer, dwarf::DW_AT_containing_type,
getOrCreateTypeDIE(resolve(DTy.getClassType())));
// Add source line info if available and TyDesc is not a forward declaration.
if (!DTy.isForwardDecl())
- addSourceLine(&Buffer, DTy);
+ addSourceLine(Buffer, DTy);
}
/// constructSubprogramArguments - Construct function argument DIEs.
@@ -1170,9 +1164,9 @@ void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DIArray Args) {
createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer);
} else {
DIE *Arg = createAndAddDIE(dwarf::DW_TAG_formal_parameter, Buffer);
- addType(Arg, DIType(Ty));
+ addType(*Arg, DIType(Ty));
if (DIType(Ty).isArtificial())
- addFlag(Arg, dwarf::DW_AT_artificial);
+ addFlag(*Arg, dwarf::DW_AT_artificial);
}
}
}
@@ -1197,7 +1191,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
DIArray Elements = CTy.getTypeArray();
DIType RTy(Elements.getElement(0));
if (RTy)
- addType(&Buffer, RTy);
+ addType(Buffer, RTy);
bool isPrototyped = true;
if (Elements.getNumElements() == 2 &&
@@ -1212,13 +1206,13 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
if (isPrototyped &&
(Language == dwarf::DW_LANG_C89 || Language == dwarf::DW_LANG_C99 ||
Language == dwarf::DW_LANG_ObjC))
- addFlag(&Buffer, dwarf::DW_AT_prototyped);
+ addFlag(Buffer, dwarf::DW_AT_prototyped);
if (CTy.isLValueReference())
- addFlag(&Buffer, dwarf::DW_AT_reference);
+ addFlag(Buffer, dwarf::DW_AT_reference);
if (CTy.isRValueReference())
- addFlag(&Buffer, dwarf::DW_AT_rvalue_reference);
+ addFlag(Buffer, dwarf::DW_AT_rvalue_reference);
} break;
case dwarf::DW_TAG_structure_type:
case dwarf::DW_TAG_union_type:
@@ -1227,13 +1221,12 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
DIArray Elements = CTy.getTypeArray();
for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
DIDescriptor Element = Elements.getElement(i);
- DIE *ElemDie = nullptr;
if (Element.isSubprogram())
- ElemDie = getOrCreateSubprogramDIE(DISubprogram(Element));
+ getOrCreateSubprogramDIE(DISubprogram(Element));
else if (Element.isDerivedType()) {
DIDerivedType DDTy(Element);
if (DDTy.getTag() == dwarf::DW_TAG_friend) {
- ElemDie = createAndAddDIE(dwarf::DW_TAG_friend, Buffer);
+ DIE &ElemDie = *createAndAddDIE(dwarf::DW_TAG_friend, Buffer);
addType(ElemDie, resolve(DDTy.getTypeDerivedFrom()),
dwarf::DW_AT_friend);
} else if (DDTy.isStaticMember()) {
@@ -1243,7 +1236,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
}
} else if (Element.isObjCProperty()) {
DIObjCProperty Property(Element);
- ElemDie = createAndAddDIE(Property.getTag(), Buffer);
+ DIE &ElemDie = *createAndAddDIE(Property.getTag(), Buffer);
StringRef PropertyName = Property.getObjCPropertyName();
addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
if (Property.getType())
@@ -1274,7 +1267,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
DIEEntry *Entry = getDIEEntry(Element);
if (!Entry) {
- Entry = createDIEEntry(ElemDie);
+ Entry = createDIEEntry(&ElemDie);
insertDIEEntry(Element, Entry);
}
} else
@@ -1282,15 +1275,15 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
}
if (CTy.isAppleBlockExtension())
- addFlag(&Buffer, dwarf::DW_AT_APPLE_block);
+ addFlag(Buffer, dwarf::DW_AT_APPLE_block);
DICompositeType ContainingType(resolve(CTy.getContainingType()));
if (ContainingType)
- addDIEEntry(&Buffer, dwarf::DW_AT_containing_type,
+ addDIEEntry(Buffer, dwarf::DW_AT_containing_type,
getOrCreateTypeDIE(ContainingType));
if (CTy.isObjcClassComplete())
- addFlag(&Buffer, dwarf::DW_AT_APPLE_objc_complete_type);
+ addFlag(Buffer, dwarf::DW_AT_APPLE_objc_complete_type);
// Add template parameters to a class, structure or union types.
// FIXME: The support isn't in the metadata for this yet.
@@ -1306,7 +1299,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
// Add name if not anonymous or intermediate type.
if (!Name.empty())
- addString(&Buffer, dwarf::DW_AT_name, Name);
+ addString(Buffer, dwarf::DW_AT_name, Name);
if (Tag == dwarf::DW_TAG_enumeration_type ||
Tag == dwarf::DW_TAG_class_type || Tag == dwarf::DW_TAG_structure_type ||
@@ -1314,23 +1307,23 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
// Add size if non-zero (derived types might be zero-sized.)
// TODO: Do we care about size for enum forward declarations?
if (Size)
- addUInt(&Buffer, dwarf::DW_AT_byte_size, None, Size);
+ addUInt(Buffer, dwarf::DW_AT_byte_size, None, Size);
else if (!CTy.isForwardDecl())
// Add zero size if it is not a forward declaration.
- addUInt(&Buffer, dwarf::DW_AT_byte_size, None, 0);
+ addUInt(Buffer, dwarf::DW_AT_byte_size, None, 0);
// If we're a forward decl, say so.
if (CTy.isForwardDecl())
- addFlag(&Buffer, dwarf::DW_AT_declaration);
+ addFlag(Buffer, dwarf::DW_AT_declaration);
// Add source line info if available.
if (!CTy.isForwardDecl())
- addSourceLine(&Buffer, CTy);
+ addSourceLine(Buffer, CTy);
// No harm in adding the runtime language to the declaration.
unsigned RLang = CTy.getRunTimeLang();
if (RLang)
- addUInt(&Buffer, dwarf::DW_AT_APPLE_runtime_class, dwarf::DW_FORM_data1,
+ addUInt(Buffer, dwarf::DW_AT_APPLE_runtime_class, dwarf::DW_FORM_data1,
RLang);
}
}
@@ -1339,8 +1332,8 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
/// DITemplateTypeParameter.
void DwarfUnit::constructTemplateTypeParameterDIE(DIE &Buffer,
DITemplateTypeParameter TP) {
- DIE *ParamDIE =
- createAndAddDIE(dwarf::DW_TAG_template_type_parameter, Buffer);
+ DIE &ParamDIE =
+ *createAndAddDIE(dwarf::DW_TAG_template_type_parameter, Buffer);
// Add the type if it exists, it could be void and therefore no type.
if (TP.getType())
addType(ParamDIE, resolve(TP.getType()));
@@ -1353,7 +1346,7 @@ void DwarfUnit::constructTemplateTypeParameterDIE(DIE &Buffer,
void
DwarfUnit::constructTemplateValueParameterDIE(DIE &Buffer,
DITemplateValueParameter VP) {
- DIE *ParamDIE = createAndAddDIE(VP.getTag(), Buffer);
+ DIE &ParamDIE = *createAndAddDIE(VP.getTag(), Buffer);
// Add the type if there is one, template template and template parameter
// packs will not have a type.
@@ -1369,10 +1362,10 @@ DwarfUnit::constructTemplateValueParameterDIE(DIE &Buffer,
// For declaration non-type template parameters (such as global values and
// functions)
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
- addOpAddress(Loc, Asm->getSymbol(GV));
+ addOpAddress(*Loc, Asm->getSymbol(GV));
// Emit DW_OP_stack_value to use the address as the immediate value of the
// parameter, rather than a pointer to it.
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);
addBlock(ParamDIE, dwarf::DW_AT_location, Loc);
} else if (VP.getTag() == dwarf::DW_TAG_GNU_template_template_param) {
assert(isa<MDString>(Val));
@@ -1381,7 +1374,7 @@ DwarfUnit::constructTemplateValueParameterDIE(DIE &Buffer,
} else if (VP.getTag() == dwarf::DW_TAG_GNU_template_parameter_pack) {
assert(isa<MDNode>(Val));
DIArray A(cast<MDNode>(Val));
- addTemplateParams(*ParamDIE, A);
+ addTemplateParams(ParamDIE, A);
}
}
}
@@ -1392,19 +1385,18 @@ DIE *DwarfUnit::getOrCreateNameSpace(DINameSpace NS) {
// such construction creates the DIE.
DIE *ContextDIE = getOrCreateContextDIE(NS.getContext());
- DIE *NDie = getDIE(NS);
- if (NDie)
+ if (DIE *NDie = getDIE(NS))
return NDie;
- NDie = createAndAddDIE(dwarf::DW_TAG_namespace, *ContextDIE, NS);
+ DIE &NDie = *createAndAddDIE(dwarf::DW_TAG_namespace, *ContextDIE, NS);
if (!NS.getName().empty()) {
addString(NDie, dwarf::DW_AT_name, NS.getName());
- DD->addAccelNamespace(NS.getName(), NDie);
+ DD->addAccelNamespace(NS.getName(), &NDie);
addGlobalName(NS.getName(), NDie, NS.getContext());
} else
- DD->addAccelNamespace("(anonymous namespace)", NDie);
+ DD->addAccelNamespace("(anonymous namespace)", &NDie);
addSourceLine(NDie, NS);
- return NDie;
+ return &NDie;
}
/// getOrCreateSubprogramDIE - Create new DIE using SP.
@@ -1419,8 +1411,7 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
SP = DISubprogram(DD->resolve(SP.getRef()));
assert(SP.Verify());
- DIE *SPDie = getDIE(SP);
- if (SPDie)
+ if (DIE *SPDie = getDIE(SP))
return SPDie;
DISubprogram SPDecl = SP.getFunctionDeclaration();
@@ -1429,14 +1420,14 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
ContextDIE = UnitDie.get();
// DW_TAG_inlined_subroutine may refer to this DIE.
- SPDie = createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, SP);
+ DIE &SPDie = *createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, SP);
DIE *DeclDie = nullptr;
if (SPDecl.isSubprogram())
DeclDie = getOrCreateSubprogramDIE(SPDecl);
// Add function template parameters.
- addTemplateParams(*SPDie, SP.getTemplateParams());
+ addTemplateParams(SPDie, SP.getTemplateParams());
if (DeclDie)
// Refer function declaration directly.
@@ -1456,7 +1447,7 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
// If this DIE is going to refer declaration info using AT_specification
// then there is no need to add other attributes.
if (DeclDie)
- return SPDie;
+ return &SPDie;
// Constructors and operators for anonymous aggregates do not have names.
if (!SP.getName().empty())
@@ -1486,11 +1477,11 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
if (VK) {
addUInt(SPDie, dwarf::DW_AT_virtuality, dwarf::DW_FORM_data1, VK);
DIELoc *Block = getDIELoc();
- addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
- addUInt(Block, dwarf::DW_FORM_udata, SP.getVirtualIndex());
+ addUInt(*Block, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
+ addUInt(*Block, dwarf::DW_FORM_udata, SP.getVirtualIndex());
addBlock(SPDie, dwarf::DW_AT_vtable_elem_location, Block);
ContainingTypeMap.insert(
- std::make_pair(SPDie, resolve(SP.getContainingType())));
+ std::make_pair(&SPDie, resolve(SP.getContainingType())));
}
if (!SP.isDefinition()) {
@@ -1498,7 +1489,7 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
// Add arguments. Do not add arguments for subprogram definition. They will
// be handled while processing variables.
- constructSubprogramArguments(*SPDie, Args);
+ constructSubprogramArguments(SPDie, Args);
}
if (SP.isArtificial())
@@ -1533,7 +1524,7 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
if (SP.isExplicit())
addFlag(SPDie, dwarf::DW_AT_explicit);
- return SPDie;
+ return &SPDie;
}
// Return const expression if value is a GEP to access merged global
@@ -1597,15 +1588,15 @@ void DwarfCompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) {
VariableDIE = createAndAddDIE(GV.getTag(), *ContextDIE, GV);
// Add name and type.
- addString(VariableDIE, dwarf::DW_AT_name, GV.getDisplayName());
- addType(VariableDIE, GTy);
+ addString(*VariableDIE, dwarf::DW_AT_name, GV.getDisplayName());
+ addType(*VariableDIE, GTy);
// Add scoping info.
if (!GV.isLocalToUnit())
- addFlag(VariableDIE, dwarf::DW_AT_external);
+ addFlag(*VariableDIE, dwarf::DW_AT_external);
// Add line number info.
- addSourceLine(VariableDIE, GV);
+ addSourceLine(*VariableDIE, GV);
}
// Add location.
@@ -1624,22 +1615,22 @@ void DwarfCompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) {
// Based on GCC's support for TLS:
if (!DD->useSplitDwarf()) {
// 1) Start with a constNu of the appropriate pointer size
- addUInt(Loc, dwarf::DW_FORM_data1,
+ addUInt(*Loc, dwarf::DW_FORM_data1,
PointerSize == 4 ? dwarf::DW_OP_const4u : dwarf::DW_OP_const8u);
// 2) containing the (relocated) offset of the TLS variable
// within the module's TLS block.
- addExpr(Loc, dwarf::DW_FORM_udata,
+ addExpr(*Loc, dwarf::DW_FORM_udata,
Asm->getObjFileLowering().getDebugThreadLocalSymbol(Sym));
} else {
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_const_index);
- addUInt(Loc, dwarf::DW_FORM_udata,
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_const_index);
+ addUInt(*Loc, dwarf::DW_FORM_udata,
DD->getAddressPool().getIndex(Sym, /* TLS */ true));
}
// 3) followed by a custom OP to make the debugger do a TLS lookup.
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_push_tls_address);
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_push_tls_address);
} else {
DD->addArangeLabel(SymbolCU(this, Sym));
- addOpAddress(Loc, Sym);
+ addOpAddress(*Loc, Sym);
}
// Do not create specification DIE if context is either compile unit
// or a subprogram.
@@ -1647,13 +1638,13 @@ void DwarfCompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) {
!GVContext.isFile() && !DD->isSubprogramContext(GVContext)) {
// Create specification DIE.
VariableSpecDIE = createAndAddDIE(dwarf::DW_TAG_variable, *UnitDie);
- addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification, VariableDIE);
- addBlock(VariableSpecDIE, dwarf::DW_AT_location, Loc);
+ addDIEEntry(*VariableSpecDIE, dwarf::DW_AT_specification, VariableDIE);
+ addBlock(*VariableSpecDIE, dwarf::DW_AT_location, Loc);
// A static member's declaration is already flagged as such.
if (!SDMDecl.Verify())
- addFlag(VariableDIE, dwarf::DW_AT_declaration);
+ addFlag(*VariableDIE, dwarf::DW_AT_declaration);
} else {
- addBlock(VariableDIE, dwarf::DW_AT_location, Loc);
+ addBlock(*VariableDIE, dwarf::DW_AT_location, Loc);
}
// Add the linkage name.
StringRef LinkageName = GV.getLinkageName();
@@ -1661,8 +1652,8 @@ void DwarfCompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) {
// From DWARF4: DIEs to which DW_AT_linkage_name may apply include:
// TAG_common_block, TAG_constant, TAG_entry_point, TAG_subprogram and
// TAG_variable.
- addString(IsStaticMember && VariableSpecDIE ? VariableSpecDIE
- : VariableDIE,
+ addString(IsStaticMember && VariableSpecDIE ? *VariableSpecDIE
+ : *VariableDIE,
DD->getDwarfVersion() >= 4 ? dwarf::DW_AT_linkage_name
: dwarf::DW_AT_MIPS_linkage_name,
GlobalValue::getRealLinkageName(LinkageName));
@@ -1672,7 +1663,7 @@ void DwarfCompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) {
// emitting AT_const_value multiple times, we only add AT_const_value when
// it is not a static member.
if (!IsStaticMember)
- addConstantValue(VariableDIE, CI, isUnsignedDIType(DD, GTy));
+ addConstantValue(*VariableDIE, CI, isUnsignedDIType(DD, GTy));
} else if (const ConstantExpr *CE = getMergedGlobalExpr(GV->getOperand(11))) {
addToAccelTable = true;
// GV is a merged global.
@@ -1680,13 +1671,13 @@ void DwarfCompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) {
Value *Ptr = CE->getOperand(0);
MCSymbol *Sym = Asm->getSymbol(cast<GlobalValue>(Ptr));
DD->addArangeLabel(SymbolCU(this, Sym));
- addOpAddress(Loc, Sym);
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
+ addOpAddress(*Loc, Sym);
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
SmallVector<Value *, 3> Idx(CE->op_begin() + 1, CE->op_end());
- addUInt(Loc, dwarf::DW_FORM_udata,
+ addUInt(*Loc, dwarf::DW_FORM_udata,
Asm->getDataLayout().getIndexedOffset(Ptr->getType(), Idx));
- addUInt(Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
- addBlock(VariableDIE, dwarf::DW_AT_location, Loc);
+ addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
+ addBlock(*VariableDIE, dwarf::DW_AT_location, Loc);
}
if (addToAccelTable) {
@@ -1700,13 +1691,14 @@ void DwarfCompileUnit::createGlobalVariableDIE(DIGlobalVariable GV) {
}
if (!GV.isLocalToUnit())
- addGlobalName(GV.getName(), VariableSpecDIE ? VariableSpecDIE : VariableDIE,
+ addGlobalName(GV.getName(),
+ VariableSpecDIE ? *VariableSpecDIE : *VariableDIE,
GV.getContext());
}
/// constructSubrangeDIE - Construct subrange DIE from DISubrange.
void DwarfUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy) {
- DIE *DW_Subrange = createAndAddDIE(dwarf::DW_TAG_subrange_type, Buffer);
+ DIE &DW_Subrange = *createAndAddDIE(dwarf::DW_TAG_subrange_type, Buffer);
addDIEEntry(DW_Subrange, dwarf::DW_AT_type, IndexTy);
// The LowerBound value defines the lower bounds which is typically zero for
@@ -1732,10 +1724,10 @@ void DwarfUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy) {
/// constructArrayTypeDIE - Construct array type DIE from DICompositeType.
void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, DICompositeType CTy) {
if (CTy.isVector())
- addFlag(&Buffer, dwarf::DW_AT_GNU_vector);
+ addFlag(Buffer, dwarf::DW_AT_GNU_vector);
// Emit the element type.
- addType(&Buffer, resolve(CTy.getTypeDerivedFrom()));
+ addType(Buffer, resolve(CTy.getTypeDerivedFrom()));
// Get an anonymous type for index type.
// FIXME: This type should be passed down from the front end
@@ -1744,9 +1736,9 @@ void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, DICompositeType CTy) {
if (!IdxTy) {
// Construct an integer type to use for indexes.
IdxTy = createAndAddDIE(dwarf::DW_TAG_base_type, *UnitDie);
- addString(IdxTy, dwarf::DW_AT_name, "sizetype");
- addUInt(IdxTy, dwarf::DW_AT_byte_size, None, sizeof(int64_t));
- addUInt(IdxTy, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
+ addString(*IdxTy, dwarf::DW_AT_name, "sizetype");
+ addUInt(*IdxTy, dwarf::DW_AT_byte_size, None, sizeof(int64_t));
+ addUInt(*IdxTy, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
dwarf::DW_ATE_unsigned);
setIndexTyDie(IdxTy);
}
@@ -1768,7 +1760,7 @@ void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, DICompositeType CTy) {
for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
DIEnumerator Enum(Elements.getElement(i));
if (Enum.isEnumerator()) {
- DIE *Enumerator = createAndAddDIE(dwarf::DW_TAG_enumerator, Buffer);
+ DIE &Enumerator = *createAndAddDIE(dwarf::DW_TAG_enumerator, Buffer);
StringRef Name = Enum.getName();
addString(Enumerator, dwarf::DW_AT_name, Name);
int64_t Value = Enum.getEnumValue();
@@ -1778,8 +1770,8 @@ void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, DICompositeType CTy) {
}
DIType DTy = resolve(CTy.getTypeDerivedFrom());
if (DTy) {
- addType(&Buffer, DTy);
- addFlag(&Buffer, dwarf::DW_AT_enum_class);
+ addType(Buffer, DTy);
+ addFlag(Buffer, dwarf::DW_AT_enum_class);
}
}
@@ -1789,7 +1781,7 @@ void DwarfUnit::constructContainingTypeDIEs() {
for (DenseMap<DIE *, const MDNode *>::iterator CI = ContainingTypeMap.begin(),
CE = ContainingTypeMap.end();
CI != CE; ++CI) {
- DIE *SPDie = CI->first;
+ DIE &SPDie = *CI->first;
DIDescriptor D(CI->second);
if (!D)
continue;
@@ -1816,16 +1808,16 @@ DIE *DwarfUnit::constructVariableDIEImpl(const DbgVariable &DV,
DbgVariable *AbsVar = DV.getAbstractVariable();
DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : nullptr;
if (AbsDIE)
- addDIEEntry(VariableDie, dwarf::DW_AT_abstract_origin, AbsDIE);
+ addDIEEntry(*VariableDie, dwarf::DW_AT_abstract_origin, AbsDIE);
else {
if (!Name.empty())
- addString(VariableDie, dwarf::DW_AT_name, Name);
- addSourceLine(VariableDie, DV.getVariable());
- addType(VariableDie, DV.getType());
+ addString(*VariableDie, dwarf::DW_AT_name, Name);
+ addSourceLine(*VariableDie, DV.getVariable());
+ addType(*VariableDie, DV.getType());
}
if (DV.isArtificial())
- addFlag(VariableDie, dwarf::DW_AT_artificial);
+ addFlag(*VariableDie, dwarf::DW_AT_artificial);
if (isScopeAbstract)
return VariableDie;
@@ -1834,7 +1826,7 @@ DIE *DwarfUnit::constructVariableDIEImpl(const DbgVariable &DV,
unsigned Offset = DV.getDotDebugLocOffset();
if (Offset != ~0U) {
- addLocationList(VariableDie, dwarf::DW_AT_location, Offset);
+ addLocationList(*VariableDie, dwarf::DW_AT_location, Offset);
return VariableDie;
}
@@ -1847,15 +1839,15 @@ DIE *DwarfUnit::constructVariableDIEImpl(const DbgVariable &DV,
if (DVInsn->getOperand(1).isImm()) {
MachineLocation Location(RegOp.getReg(),
DVInsn->getOperand(1).getImm());
- addVariableAddress(DV, VariableDie, Location);
+ addVariableAddress(DV, *VariableDie, Location);
} else if (RegOp.getReg())
- addVariableAddress(DV, VariableDie, MachineLocation(RegOp.getReg()));
+ addVariableAddress(DV, *VariableDie, MachineLocation(RegOp.getReg()));
} else if (DVInsn->getOperand(0).isImm())
- addConstantValue(VariableDie, DVInsn->getOperand(0), DV.getType());
+ addConstantValue(*VariableDie, DVInsn->getOperand(0), DV.getType());
else if (DVInsn->getOperand(0).isFPImm())
- addConstantFPValue(VariableDie, DVInsn->getOperand(0));
+ addConstantFPValue(*VariableDie, DVInsn->getOperand(0));
else if (DVInsn->getOperand(0).isCImm())
- addConstantValue(VariableDie, DVInsn->getOperand(0).getCImm(),
+ addConstantValue(*VariableDie, DVInsn->getOperand(0).getCImm(),
isUnsignedDIType(DD, DV.getType()));
return VariableDie;
@@ -1868,7 +1860,7 @@ DIE *DwarfUnit::constructVariableDIEImpl(const DbgVariable &DV,
const TargetFrameLowering *TFI = Asm->TM.getFrameLowering();
int Offset = TFI->getFrameIndexReference(*Asm->MF, FI, FrameReg);
MachineLocation Location(FrameReg, Offset);
- addVariableAddress(DV, VariableDie, Location);
+ addVariableAddress(DV, *VariableDie, Location);
}
return VariableDie;
@@ -1876,7 +1868,7 @@ DIE *DwarfUnit::constructVariableDIEImpl(const DbgVariable &DV,
/// constructMemberDIE - Construct member DIE from DIDerivedType.
void DwarfUnit::constructMemberDIE(DIE &Buffer, DIDerivedType DT) {
- DIE *MemberDie = createAndAddDIE(DT.getTag(), Buffer);
+ DIE &MemberDie = *createAndAddDIE(DT.getTag(), Buffer);
StringRef Name = DT.getName();
if (!Name.empty())
addString(MemberDie, dwarf::DW_AT_name, Name);
@@ -1892,13 +1884,13 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, DIDerivedType DT) {
// BaseAddr = ObAddr + *((*ObAddr) - Offset)
DIELoc *VBaseLocationDie = new (DIEValueAllocator) DIELoc();
- addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_dup);
- addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
- addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
- addUInt(VBaseLocationDie, dwarf::DW_FORM_udata, DT.getOffsetInBits());
- addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_minus);
- addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
- addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
+ addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_dup);
+ addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
+ addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
+ addUInt(*VBaseLocationDie, dwarf::DW_FORM_udata, DT.getOffsetInBits());
+ addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_minus);
+ addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
+ addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
addBlock(MemberDie, dwarf::DW_AT_data_member_location, VBaseLocationDie);
} else {
@@ -1931,8 +1923,8 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, DIDerivedType DT) {
if (DD->getDwarfVersion() <= 2) {
DIELoc *MemLocationDie = new (DIEValueAllocator) DIELoc();
- addUInt(MemLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
- addUInt(MemLocationDie, dwarf::DW_FORM_udata, OffsetInBytes);
+ addUInt(*MemLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
+ addUInt(*MemLocationDie, dwarf::DW_FORM_udata, OffsetInBytes);
addBlock(MemberDie, dwarf::DW_AT_data_member_location, MemLocationDie);
} else
addUInt(MemberDie, dwarf::DW_AT_data_member_location, None,
@@ -1956,8 +1948,8 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, DIDerivedType DT) {
// Objective-C properties.
if (MDNode *PNode = DT.getObjCProperty())
if (DIEEntry *PropertyDie = getDIEEntry(PNode))
- MemberDie->addValue(dwarf::DW_AT_APPLE_property, dwarf::DW_FORM_ref4,
- PropertyDie);
+ MemberDie.addValue(dwarf::DW_AT_APPLE_property, dwarf::DW_FORM_ref4,
+ PropertyDie);
if (DT.isArtificial())
addFlag(MemberDie, dwarf::DW_AT_artificial);
@@ -1974,11 +1966,10 @@ DIE *DwarfUnit::getOrCreateStaticMemberDIE(DIDerivedType DT) {
assert(dwarf::isType(ContextDIE->getTag()) &&
"Static member should belong to a type.");
- DIE *StaticMemberDIE = getDIE(DT);
- if (StaticMemberDIE)
+ if (DIE *StaticMemberDIE = getDIE(DT))
return StaticMemberDIE;
- StaticMemberDIE = createAndAddDIE(DT.getTag(), *ContextDIE, DT);
+ DIE &StaticMemberDIE = *createAndAddDIE(DT.getTag(), *ContextDIE, DT);
DIType Ty = resolve(DT.getTypeDerivedFrom());
@@ -2005,7 +1996,7 @@ DIE *DwarfUnit::getOrCreateStaticMemberDIE(DIDerivedType DT) {
if (const ConstantFP *CFP = dyn_cast_or_null<ConstantFP>(DT.getConstant()))
addConstantFPValue(StaticMemberDIE, CFP);
- return StaticMemberDIE;
+ return &StaticMemberDIE;
}
void DwarfUnit::emitHeader(const MCSymbol *ASectionSym) const {
@@ -2058,9 +2049,9 @@ void DwarfCompileUnit::initStmtList(MCSymbol *DwarfLineSectionSym) {
// The line table entries are not always emitted in assembly, so it
// is not okay to use line_table_start here.
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
- addSectionLabel(UnitDie.get(), dwarf::DW_AT_stmt_list, LineTableStartSym);
+ addSectionLabel(*UnitDie, dwarf::DW_AT_stmt_list, LineTableStartSym);
else
- addSectionDelta(UnitDie.get(), dwarf::DW_AT_stmt_list, LineTableStartSym,
+ addSectionDelta(*UnitDie, dwarf::DW_AT_stmt_list, LineTableStartSym,
DwarfLineSectionSym);
}
diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.h b/lib/CodeGen/AsmPrinter/DwarfUnit.h
index 3974775aa8..7f485fe739 100644
--- a/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -247,10 +247,10 @@ public:
/// addGlobalName - Add a new global entity to the compile unit.
///
- void addGlobalName(StringRef Name, DIE *Die, DIScope Context);
+ void addGlobalName(StringRef Name, DIE &Die, DIScope Context);
/// addAccelNamespace - Add a new name to the namespace accelerator table.
- void addAccelNamespace(StringRef Name, const DIE *Die);
+ void addAccelNamespace(StringRef Name, const DIE &Die);
/// getDIE - Returns the debug information entry map slot for the
/// specified debug variable. We delegate the request to DwarfDebug
@@ -273,113 +273,113 @@ public:
void addDie(DIE *Buffer) { UnitDie->addChild(Buffer); }
/// addFlag - Add a flag that is true to the DIE.
- void addFlag(DIE *Die, dwarf::Attribute Attribute);
+ void addFlag(DIE &Die, dwarf::Attribute Attribute);
/// addUInt - Add an unsigned integer attribute data and value.
- void addUInt(DIE *Die, dwarf::Attribute Attribute, Optional<dwarf::Form> Form,
+ void addUInt(DIE &Die, dwarf::Attribute Attribute, Optional<dwarf::Form> Form,
uint64_t Integer);
- void addUInt(DIE *Block, dwarf::Form Form, uint64_t Integer);
+ void addUInt(DIE &Block, dwarf::Form Form, uint64_t Integer);
/// addSInt - Add an signed integer attribute data and value.
- void addSInt(DIE *Die, dwarf::Attribute Attribute, Optional<dwarf::Form> Form,
+ void addSInt(DIE &Die, dwarf::Attribute Attribute, Optional<dwarf::Form> Form,
int64_t Integer);
- void addSInt(DIELoc *Die, Optional<dwarf::Form> Form, int64_t Integer);
+ void addSInt(DIELoc &Die, Optional<dwarf::Form> Form, int64_t Integer);
/// addString - Add a string attribute data and value.
- void addString(DIE *Die, dwarf::Attribute Attribute, const StringRef Str);
+ void addString(DIE &Die, dwarf::Attribute Attribute, const StringRef Str);
/// addLocalString - Add a string attribute data and value.
- void addLocalString(DIE *Die, dwarf::Attribute Attribute,
+ void addLocalString(DIE &Die, dwarf::Attribute Attribute,
const StringRef Str);
/// addExpr - Add a Dwarf expression attribute data and value.
- void addExpr(DIELoc *Die, dwarf::Form Form, const MCExpr *Expr);
+ void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr);
/// addLabel - Add a Dwarf label attribute data and value.
- void addLabel(DIE *Die, dwarf::Attribute Attribute, dwarf::Form Form,
+ void addLabel(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form,
const MCSymbol *Label);
- void addLabel(DIELoc *Die, dwarf::Form Form, const MCSymbol *Label);
+ void addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label);
/// addLocationList - Add a Dwarf loclistptr attribute data and value.
- void addLocationList(DIE *Die, dwarf::Attribute Attribute, unsigned Index);
+ void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index);
/// addSectionLabel - Add a Dwarf section label attribute data and value.
///
- void addSectionLabel(DIE *Die, dwarf::Attribute Attribute,
+ void addSectionLabel(DIE &Die, dwarf::Attribute Attribute,
const MCSymbol *Label);
/// addSectionOffset - Add an offset into a section attribute data and value.
///
- void addSectionOffset(DIE *Die, dwarf::Attribute Attribute, uint64_t Integer);
+ void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer);
/// addOpAddress - Add a dwarf op address data and value using the
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
- void addOpAddress(DIELoc *Die, const MCSymbol *Label);
+ void addOpAddress(DIELoc &Die, const MCSymbol *Label);
/// addSectionDelta - Add a label delta attribute data and value.
- void addSectionDelta(DIE *Die, dwarf::Attribute Attribute, const MCSymbol *Hi,
+ void addSectionDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi,
const MCSymbol *Lo);
/// addLabelDelta - Add a label delta attribute data and value.
- void addLabelDelta(DIE *Die, dwarf::Attribute Attribute, const MCSymbol *Hi,
+ void addLabelDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi,
const MCSymbol *Lo);
/// addDIEEntry - Add a DIE attribute data and value.
- void addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIE *Entry);
+ void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE *Entry);
/// addDIEEntry - Add a DIE attribute data and value.
- void addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIEEntry *Entry);
+ void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIEEntry *Entry);
- void addDIETypeSignature(DIE *Die, const DwarfTypeUnit &Type);
+ void addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type);
/// addBlock - Add block data.
- void addBlock(DIE *Die, dwarf::Attribute Attribute, DIELoc *Block);
+ void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Block);
/// addBlock - Add block data.
- void addBlock(DIE *Die, dwarf::Attribute Attribute, DIEBlock *Block);
+ void addBlock(DIE &Die, dwarf::Attribute Attribute, DIEBlock *Block);
/// addSourceLine - Add location information to specified debug information
/// entry.
- void addSourceLine(DIE *Die, unsigned Line, StringRef File,
+ void addSourceLine(DIE &Die, unsigned Line, StringRef File,
StringRef Directory);
- void addSourceLine(DIE *Die, DIVariable V);
- void addSourceLine(DIE *Die, DIGlobalVariable G);
- void addSourceLine(DIE *Die, DISubprogram SP);
- void addSourceLine(DIE *Die, DIType Ty);
- void addSourceLine(DIE *Die, DINameSpace NS);
- void addSourceLine(DIE *Die, DIObjCProperty Ty);
+ void addSourceLine(DIE &Die, DIVariable V);
+ void addSourceLine(DIE &Die, DIGlobalVariable G);
+ void addSourceLine(DIE &Die, DISubprogram SP);
+ void addSourceLine(DIE &Die, DIType Ty);
+ void addSourceLine(DIE &Die, DINameSpace NS);
+ void addSourceLine(DIE &Die, DIObjCProperty Ty);
/// addAddress - Add an address attribute to a die based on the location
/// provided.
- void addAddress(DIE *Die, dwarf::Attribute Attribute,
+ void addAddress(DIE &Die, dwarf::Attribute Attribute,
const MachineLocation &Location, bool Indirect = false);
/// addConstantValue - Add constant value entry in variable DIE.
- void addConstantValue(DIE *Die, const MachineOperand &MO, DIType Ty);
- void addConstantValue(DIE *Die, const ConstantInt *CI, bool Unsigned);
- void addConstantValue(DIE *Die, const APInt &Val, bool Unsigned);
+ void addConstantValue(DIE &Die, const MachineOperand &MO, DIType Ty);
+ void addConstantValue(DIE &Die, const ConstantInt *CI, bool Unsigned);
+ void addConstantValue(DIE &Die, const APInt &Val, bool Unsigned);
/// addConstantFPValue - Add constant value entry in variable DIE.
- void addConstantFPValue(DIE *Die, const MachineOperand &MO);
- void addConstantFPValue(DIE *Die, const ConstantFP *CFP);
+ void addConstantFPValue(DIE &Die, const MachineOperand &MO);
+ void addConstantFPValue(DIE &Die, const ConstantFP *CFP);
/// addTemplateParams - Add template parameters in buffer.
void addTemplateParams(DIE &Buffer, DIArray TParams);
/// addRegisterOp - Add register operand.
- void addRegisterOp(DIELoc *TheDie, unsigned Reg);
+ void addRegisterOp(DIELoc &TheDie, unsigned Reg);
/// addRegisterOffset - Add register offset.
- void addRegisterOffset(DIELoc *TheDie, unsigned Reg, int64_t Offset);
+ void addRegisterOffset(DIELoc &TheDie, unsigned Reg, int64_t Offset);
/// addComplexAddress - Start with the address based on the location provided,
/// and generate the DWARF information necessary to find the actual variable
/// (navigating the extra location information encoded in the type) based on
/// the starting location. Add the DWARF information to the die.
- void addComplexAddress(const DbgVariable &DV, DIE *Die,
+ void addComplexAddress(const DbgVariable &DV, DIE &Die,
dwarf::Attribute Attribute,
const MachineLocation &Location);
@@ -389,19 +389,19 @@ public:
/// actual Block variable (navigating the Block struct) based on the
/// starting location. Add the DWARF information to the die. Obsolete,
/// please use addComplexAddress instead.
- void addBlockByrefAddress(const DbgVariable &DV, DIE *Die,
+ void addBlockByrefAddress(const DbgVariable &DV, DIE &Die,
dwarf::Attribute Attribute,
const MachineLocation &Location);
/// addVariableAddress - Add DW_AT_location attribute for a
/// DbgVariable based on provided MachineLocation.
- void addVariableAddress(const DbgVariable &DV, DIE *Die,
+ void addVariableAddress(const DbgVariable &DV, DIE &Die,
MachineLocation Location);
/// addType - Add a new type attribute to the specified entity. This takes
/// and attribute parameter because DW_AT_friend attributes are also
/// type references.
- void addType(DIE *Entity, DIType Ty,
+ void addType(DIE &Entity, DIType Ty,
dwarf::Attribute Attribute = dwarf::DW_AT_type);
/// getOrCreateNameSpace - Create a DIE for DINameSpace.
@@ -548,12 +548,12 @@ public:
/// addLabelAddress - Add a dwarf label attribute data and value using
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.
- void addLabelAddress(DIE *Die, dwarf::Attribute Attribute,
+ void addLabelAddress(DIE &Die, dwarf::Attribute Attribute,
const MCSymbol *Label);
/// addLocalLabelAddress - Add a dwarf label attribute data and value using
/// DW_FORM_addr only.
- void addLocalLabelAddress(DIE *Die, dwarf::Attribute Attribute,
+ void addLocalLabelAddress(DIE &Die, dwarf::Attribute Attribute,
const MCSymbol *Label);
DwarfCompileUnit &getCU() override { return *this; }