[PATCH] Fix ctor/dtor aliases losing 'dllexport'

Reid Kleckner rnk at google.com
Tue Sep 16 11:09:52 PDT 2014


At a high-level, can you factor this out into something like
CodeGenModule::setAliasAttributes?

+// RUN: %clang -target x86_64-windows-gnu %s -S -emit-llvm -o - |
FileCheck %s

Don't use the clang driver (%clang) in codegen tests. Use %clang_cc1. This
means you will need to pass -mconstructor-aliases.

On Tue, Sep 16, 2014 at 10:42 AM, Dario Domizioli <dario.domizioli at gmail.com
> wrote:

> Hello Clang,
>
> I have noticed that when the compiler emits aliases for simple
> constructors and destructors it does not transfer the 'dllexport' storage
> class attribute to the alias.
> Because in the source code there is only "the constructor" and the user
> cannot differentiate between the C1 and C2 portions of it, if one portion
> is dllexport'ed then the other must be too. At the moment however C1 is
> aliased to C2, and the alias does not have 'dllexport'. This can cause link
> errors. The same is true for the destructor (and its D1 and D2 portions).
>
> The attached patch fixed the issue, although I am not 100% sure that my
> change is in the right place.
> Rafael's refactor in r217847 means that the same code has to exist in two
> places: TryEmitDefinitionAsAlias() in CGCXX.cpp and
> emitConstructorDestructorAlias() in ItaniumCXXABI.cpp.
> Maybe there's a better place where to put the change...
>
> Also, my test assumes that C1 is aliased to C2 (and D1 to D2), and I have
> checked it's true with the provided triple which exercises the Itanium ABI
> code, but I cannot seem to get the "x86_64-windows-msvc" triple to create
> aliases for C1 and D1, so I don't have coverage for the code in
> TryEmitDefinitionAsAlias.
> Can anybody provide advice on that? Or should I just fix the issue in the
> Itanium ABI and worry about the msvc ABI later? It would seem a shame not
> to fix both cases...
>
> Cheers,
>     Dario Domizioli
>     SN Systems - Sony Computer Entertainment Group
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140916/894afecf/attachment.html>


More information about the cfe-commits mailing list