<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 31 October 2014 17:50, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: dblaikie<br>
Date: Fri Oct 31 19:50:34 2014<br>
New Revision: 221031<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=221031&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=221031&view=rev</a><br>
Log:<br>
Add DwarfCompileUnit::getSkeleton that returns DwarfCompileUnit* to avoid having to cast from DwarfUnit* on every call.<br>
<br>
Modified:<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=221031&r1=221030&r2=221031&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=221031&r1=221030&r2=221031&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Fri Oct 31 19:50:34 2014<br>
@@ -42,6 +42,10 @@ public:<br>
   DwarfCompileUnit(unsigned UID, DICompileUnit Node, AsmPrinter *A,<br>
                    DwarfDebug *DW, DwarfFile *DWU);<br>
<br>
+  DwarfCompileUnit *getSkeleton() const {<br>
+    return static_cast<DwarfCompileUnit *>(Skeleton);<br>
+  }<br>
+<br>
   void initStmtList(MCSymbol *DwarfLineSectionSym);<br>
<br>
   /// Apply the DW_AT_stmt_list from this compile unit to the specified DIE.<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=221031&r1=221030&r2=221031&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=221031&r1=221030&r2=221031&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Oct 31 19:50:34 2014<br>
@@ -550,8 +550,7 @@ void DwarfDebug::finalizeModuleInfo() {<br>
     if (TheU->getUnitDie().getTag() == dwarf::DW_TAG_compile_unit) {<br>
       // If we're splitting the dwarf out now that we've got the entire<br>
       // CU then add the dwo id to it.<br>
-      DwarfCompileUnit *SkCU =<br>
-          static_cast<DwarfCompileUnit *>(TheU->getSkeleton());<br>
+      DwarfCompileUnit *SkCU = TheU->getSkeleton();<br></blockquote><div><br></div><div><p class=""><font face="courier new, monospace"><b>lib/CodeGen/AsmPrinter/DwarfDebug.cpp:553:25: <font color="#ff0000">error:</font> cannot initialize a variable of type 'llvm::DwarfCompileUnit *' with an rvalue of type 'llvm::DwarfUnit *'</b><br>      DwarfCompileUnit *SkCU = TheU->getSkeleton();<br><font color="#00ff00">                        ^      ~~~~~~~~~~~~~~~~~~~<br></font>1 error generated. <br></font></p><p class="">David, please take a look?</p></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
       if (useSplitDwarf()) {<br>
         // Emit a unique identifier for this CU.<br>
         uint64_t ID = DIEHash(Asm).computeCUSignature(TheU->getUnitDie());<br>
@@ -1580,7 +1579,7 @@ void DwarfDebug::emitDebugPubSection(<br>
     if (Globals.empty())<br>
       continue;<br>
<br>
-    if (auto Skeleton = static_cast<DwarfCompileUnit *>(TheU->getSkeleton()))<br>
+    if (auto Skeleton = TheU->getSkeleton())<br>
       TheU = Skeleton;<br>
     unsigned ID = TheU->getUniqueID();<br>
<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>