<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 14, 2013 at 2:33 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: echristo<br>
Date: Tue May 14 16:33:10 2013<br>
New Revision: 181835<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=181835&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=181835&view=rev</a><br>
Log:<br>
Make getCompileUnit non-const and return the current DIE if it<br>
happens to be a compile unit. Noticed on inspection and tested<br>
via calling on a newly created compile unit. No functional change.<br></blockquote><div><br></div><div style>Any idea if this is a necessary/reachable codepath? (seems subtle enough that it'd be nice to have an actual example of that)<br>
Otherwise perhaps it'd be sufficient to just assert that you don't ask a CompileUnit for its CompileUnit?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Modified:<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=181835&r1=181834&r2=181835&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=181835&r1=181834&r2=181835&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Tue May 14 16:33:10 2013<br>
@@ -114,8 +114,8 @@ DIE::~DIE() {<br>
<br>
 /// Climb up the parent chain to get the compile unit DIE to which this DIE<br>
 /// belongs.<br>
-DIE *DIE::getCompileUnit() const {<br>
-  DIE *p = getParent();<br>
+DIE *DIE::getCompileUnit() {<br>
+  DIE *p = this;<br>
   while (p) {<br>
     if (p->getTag() == dwarf::DW_TAG_compile_unit)<br>
       return p;<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=181835&r1=181834&r2=181835&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=181835&r1=181834&r2=181835&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h Tue May 14 16:33:10 2013<br>
@@ -153,7 +153,7 @@ namespace llvm {<br>
     DIE *getParent() const { return Parent; }<br>
     /// Climb up the parent chain to get the compile unit DIE this DIE belongs<br>
     /// to.<br>
-    DIE *getCompileUnit() const;<br>
+    DIE *getCompileUnit();<br>
     void setTag(unsigned Tag) { Abbrev.setTag(Tag); }<br>
     void setOffset(unsigned O) { Offset = O; }<br>
     void setSize(unsigned S) { Size = S; }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>