Make getCompileUnit non-const and return the current DIE if it

happens to be a compile unit. Noticed on inspection and tested
via calling on a newly created compile unit. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181835 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2013-05-14 21:33:10 +00:00
parent 95ab326674
commit 4d7f2ce938
2 changed files with 3 additions and 3 deletions

View File

@ -114,8 +114,8 @@ DIE::~DIE() {
/// Climb up the parent chain to get the compile unit DIE to which this DIE /// Climb up the parent chain to get the compile unit DIE to which this DIE
/// belongs. /// belongs.
DIE *DIE::getCompileUnit() const { DIE *DIE::getCompileUnit() {
DIE *p = getParent(); DIE *p = this;
while (p) { while (p) {
if (p->getTag() == dwarf::DW_TAG_compile_unit) if (p->getTag() == dwarf::DW_TAG_compile_unit)
return p; return p;

View File

@ -153,7 +153,7 @@ namespace llvm {
DIE *getParent() const { return Parent; } DIE *getParent() const { return Parent; }
/// Climb up the parent chain to get the compile unit DIE this DIE belongs /// Climb up the parent chain to get the compile unit DIE this DIE belongs
/// to. /// to.
DIE *getCompileUnit() const; DIE *getCompileUnit();
void setTag(unsigned Tag) { Abbrev.setTag(Tag); } void setTag(unsigned Tag) { Abbrev.setTag(Tag); }
void setOffset(unsigned O) { Offset = O; } void setOffset(unsigned O) { Offset = O; }
void setSize(unsigned S) { Size = S; } void setSize(unsigned S) { Size = S; }