Make getCompileUnit non-const and return the current DIE if it
authorEric Christopher <echristo@gmail.com>
Tue, 14 May 2013 21:33:10 +0000 (21:33 +0000)
committerEric Christopher <echristo@gmail.com>
Tue, 14 May 2013 21:33:10 +0000 (21:33 +0000)
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

lib/CodeGen/AsmPrinter/DIE.cpp
lib/CodeGen/AsmPrinter/DIE.h

index 673867ada1a24a3e4199a054dd3940fce0a9dca1..cc0cb56e8b366400b127af0b1941f6b08b6c9174 100644 (file)
@@ -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;
index d8fa1f5a0e71426ba6d84dc70180d9806cc7a296..550d87312833b9c19188b8f6ee16bfcb1c0e7e84 100644 (file)
@@ -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; }