[llvm] r207701 - Fix the clang-cl self-host build by defining ~DwarfDebug out of line

David Blaikie dblaikie at gmail.com
Wed Apr 30 14:10:42 PDT 2014


On Wed, Apr 30, 2014 at 1:34 PM, Reid Kleckner <reid at kleckner.net> wrote:
> Author: rnk
> Date: Wed Apr 30 15:34:31 2014
> New Revision: 207701
>
> URL: http://llvm.org/viewvc/llvm-project?rev=207701&view=rev
> Log:
> Fix the clang-cl self-host build by defining ~DwarfDebug out of line
>
> DwarfDebug.h has a SmallVector member containing a unique_ptr of an
> incomplete type.  MSVC doesn't have key functions, so the vtable and
> dtor are emitted in AsmPrinter.cpp, where DwarfDebug's ctor is called.
> AsmPrinter.cpp include DwarfUnit.h and doesn't get a complete definition
> of DwarfTypeUnit.  We could fix the problem by including DwarfUnit.h in
> DwarfDebug.h, but that would increase header bloat.  Instead, define
> ~DwarfDebug out of line.

Yep - that's the right approach, for my money - I've done this in a
few places already and will continue to do so. I'm not sure if we
should comment each dtor to explain why there's apparently a default
dtor out of line like this. Otherwise I can imagine myself, a week or
month from now, trying to put it back in the header (especially if
this is only an MSVC break... I'd probably move it, not get a build
error, and commit it)

>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=207701&r1=207700&r2=207701&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Apr 30 15:34:31 2014
> @@ -218,6 +218,9 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo
>    }
>  }
>
> +// Define out of line so we don't have to include DwarfUnit.h in DwarfDebug.h.
> +DwarfDebug::~DwarfDebug() { }
> +
>  // Switch to the specified MCSection and emit an assembler
>  // temporary label to it if SymbolStem is specified.
>  static MCSymbol *emitSectionSym(AsmPrinter *Asm, const MCSection *Section,
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=207701&r1=207700&r2=207701&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Apr 30 15:34:31 2014
> @@ -557,6 +557,8 @@ public:
>    //
>    DwarfDebug(AsmPrinter *A, Module *M);
>
> +  ~DwarfDebug() override;
> +
>    void insertDIE(const MDNode *TypeMD, DIE *Die) {
>      MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
>    }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list