From 8fd7ab07ca26f8de0f9562c5751f4dad84c92b1b Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Tue, 14 May 2013 21:33:10 +0000 Subject: 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. llvm-svn: 181835 --- llvm/lib/CodeGen/AsmPrinter/DIE.cpp | 4 ++-- llvm/lib/CodeGen/AsmPrinter/DIE.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp index 673867ada1a..cc0cb56e8b3 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp @@ -114,8 +114,8 @@ DIE::~DIE() { /// Climb up the parent chain to get the compile unit DIE to which this DIE /// belongs. -DIE *DIE::getCompileUnit() const { - DIE *p = getParent(); +DIE *DIE::getCompileUnit() { + DIE *p = this; while (p) { if (p->getTag() == dwarf::DW_TAG_compile_unit) return p; diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.h b/llvm/lib/CodeGen/AsmPrinter/DIE.h index d8fa1f5a0e7..550d8731283 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DIE.h +++ b/llvm/lib/CodeGen/AsmPrinter/DIE.h @@ -153,7 +153,7 @@ namespace llvm { DIE *getParent() const { return Parent; } /// Climb up the parent chain to get the compile unit DIE this DIE belongs /// to. - DIE *getCompileUnit() const; + DIE *getCompileUnit(); void setTag(unsigned Tag) { Abbrev.setTag(Tag); } void setOffset(unsigned O) { Offset = O; } void setSize(unsigned S) { Size = S; } -- cgit v1.2.3