aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
diff options
context:
space:
mode:
authorChen Zheng <czhengsz@cn.ibm.com>2021-05-07 07:00:11 +0000
committerChen Zheng <czhengsz@cn.ibm.com>2021-05-07 07:24:09 +0000
commit9deb7eeaf76c3285b72ce75d30fcade63b96e2dc (patch)
treec13792bd816eb2e0460f7dd5792184e2dc217270 /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
parent1ccebb18ef9f4110e555209261d73dbec393e364 (diff)
downloadllvm-9deb7eeaf76c3285b72ce75d30fcade63b96e2dc.zip
llvm-9deb7eeaf76c3285b72ce75d30fcade63b96e2dc.tar.gz
llvm-9deb7eeaf76c3285b72ce75d30fcade63b96e2dc.tar.bz2
[Debug-Info][NFC] add a wrapper for Die.addValue
Add a new wrapper function addAttribute() for Die.addValue() function, so we can do some attributes control in one single interface. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D101125
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index ac7a316..faa14dc 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -83,7 +83,7 @@ void DwarfCompileUnit::addLabelAddress(DIE &Die, dwarf::Attribute Attribute,
if (!Base || Base == Label) {
unsigned idx = DD->getAddressPool().getIndex(Label);
- Die.addValue(DIEValueAllocator, Attribute,
+ addAttribute(Die, Attribute,
DD->getDwarfVersion() >= 5 ? dwarf::DW_FORM_addrx
: dwarf::DW_FORM_GNU_addr_index,
DIEInteger(idx));
@@ -100,7 +100,7 @@ void DwarfCompileUnit::addLabelAddress(DIE &Die, dwarf::Attribute Attribute,
addPoolOpAddress(*Loc, Label);
addBlock(Die, Attribute, dwarf::DW_FORM_exprloc, Loc);
} else
- Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_LLVM_addrx_offset,
+ addAttribute(Die, Attribute, dwarf::DW_FORM_LLVM_addrx_offset,
new (DIEValueAllocator) DIEAddrOffset(
DD->getAddressPool().getIndex(Base), Label, Base));
}
@@ -112,11 +112,9 @@ void DwarfCompileUnit::addLocalLabelAddress(DIE &Die,
DD->addArangeLabel(SymbolCU(this, Label));
if (Label)
- Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_addr,
- DIELabel(Label));
+ addAttribute(Die, Attribute, dwarf::DW_FORM_addr, DIELabel(Label));
else
- Die.addValue(DIEValueAllocator, Attribute, dwarf::DW_FORM_addr,
- DIEInteger(0));
+ addAttribute(Die, Attribute, dwarf::DW_FORM_addr, DIEInteger(0));
}
unsigned DwarfCompileUnit::getOrCreateSourceID(const DIFile *File) {
@@ -1472,7 +1470,7 @@ void DwarfCompileUnit::addLocationList(DIE &Die, dwarf::Attribute Attribute,
dwarf::Form Form = (DD->getDwarfVersion() >= 5)
? dwarf::DW_FORM_loclistx
: DD->getDwarfSectionOffsetForm();
- Die.addValue(DIEValueAllocator, Attribute, Form, DIELocList(Index));
+ addAttribute(Die, Attribute, Form, DIELocList(Index));
}
void DwarfCompileUnit::applyVariableAttributes(const DbgVariable &Var,
@@ -1504,7 +1502,7 @@ void DwarfCompileUnit::applyLabelAttributes(const DbgLabel &Label,
/// Add a Dwarf expression attribute data and value.
void DwarfCompileUnit::addExpr(DIELoc &Die, dwarf::Form Form,
const MCExpr *Expr) {
- Die.addValue(DIEValueAllocator, (dwarf::Attribute)0, Form, DIEExpr(Expr));
+ addAttribute(Die, (dwarf::Attribute)0, Form, DIEExpr(Expr));
}
void DwarfCompileUnit::applySubprogramAttributesToDefinition(
@@ -1538,7 +1536,7 @@ void DwarfCompileUnit::addAddrTableBase() {
}
void DwarfCompileUnit::addBaseTypeRef(DIEValueList &Die, int64_t Idx) {
- Die.addValue(DIEValueAllocator, (dwarf::Attribute)0, dwarf::DW_FORM_udata,
+ addAttribute(Die, (dwarf::Attribute)0, dwarf::DW_FORM_udata,
new (DIEValueAllocator) DIEBaseTypeRef(this, Idx));
}