[llvm] r221031 - Add DwarfCompileUnit::getSkeleton that returns DwarfCompileUnit* to avoid having to cast from DwarfUnit* on every call.

Nick Lewycky nlewycky at google.com
Fri Oct 31 18:26:58 PDT 2014


On 31 October 2014 17:50, David Blaikie <dblaikie at gmail.com> wrote:

> Author: dblaikie
> Date: Fri Oct 31 19:50:34 2014
> New Revision: 221031
>
> URL: http://llvm.org/viewvc/llvm-project?rev=221031&view=rev
> Log:
> Add DwarfCompileUnit::getSkeleton that returns DwarfCompileUnit* to avoid
> having to cast from DwarfUnit* on every call.
>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=221031&r1=221030&r2=221031&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Fri Oct 31
> 19:50:34 2014
> @@ -42,6 +42,10 @@ public:
>    DwarfCompileUnit(unsigned UID, DICompileUnit Node, AsmPrinter *A,
>                     DwarfDebug *DW, DwarfFile *DWU);
>
> +  DwarfCompileUnit *getSkeleton() const {
> +    return static_cast<DwarfCompileUnit *>(Skeleton);
> +  }
> +
>    void initStmtList(MCSymbol *DwarfLineSectionSym);
>
>    /// Apply the DW_AT_stmt_list from this compile unit to the specified
> DIE.
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=221031&r1=221030&r2=221031&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Oct 31 19:50:34
> 2014
> @@ -550,8 +550,7 @@ void DwarfDebug::finalizeModuleInfo() {
>      if (TheU->getUnitDie().getTag() == dwarf::DW_TAG_compile_unit) {
>        // If we're splitting the dwarf out now that we've got the entire
>        // CU then add the dwo id to it.
> -      DwarfCompileUnit *SkCU =
> -          static_cast<DwarfCompileUnit *>(TheU->getSkeleton());
> +      DwarfCompileUnit *SkCU = TheU->getSkeleton();
>

*lib/CodeGen/AsmPrinter/DwarfDebug.cpp:553:25: error: cannot initialize a
variable of type 'llvm::DwarfCompileUnit *' with an rvalue of type
'llvm::DwarfUnit *'*
      DwarfCompileUnit *SkCU = TheU->getSkeleton();
                        ^      ~~~~~~~~~~~~~~~~~~~
1 error generated.

David, please take a look?

>        if (useSplitDwarf()) {
>          // Emit a unique identifier for this CU.
>          uint64_t ID = DIEHash(Asm).computeCUSignature(TheU->getUnitDie());
> @@ -1580,7 +1579,7 @@ void DwarfDebug::emitDebugPubSection(
>      if (Globals.empty())
>        continue;
>
> -    if (auto Skeleton = static_cast<DwarfCompileUnit
> *>(TheU->getSkeleton()))
> +    if (auto Skeleton = TheU->getSkeleton())
>        TheU = Skeleton;
>      unsigned ID = TheU->getUniqueID();
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141031/a0ad640f/attachment.html>


More information about the llvm-commits mailing list