Improve die_object::has_attr implementation
This commit is contained in:
parent
d9eadf981d
commit
2c4f271e23
@ -149,18 +149,9 @@ namespace libdwarf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool has_attr(Dwarf_Half dw_attrnum) const {
|
bool has_attr(Dwarf_Half dw_attrnum) const {
|
||||||
Dwarf_Attribute attr;
|
Dwarf_Bool present = false;
|
||||||
int ret = dwarf_attr(die, dw_attrnum, &attr, nullptr);
|
CPPTRACE_VERIFY(dwarf_hasattr(die, dw_attrnum, &present, nullptr) == DW_DLV_OK);
|
||||||
if(ret == DW_DLV_NO_ENTRY) {
|
return present;
|
||||||
return false;
|
|
||||||
} else if(ret == DW_DLV_OK) {
|
|
||||||
// TODO: Better impl that doesn't require allocation....?
|
|
||||||
dwarf_dealloc_attribute(attr);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Error\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dwarf_Half get_tag() const {
|
Dwarf_Half get_tag() const {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user