[PATCH] Don't dllimport/export destructor variants implemented by thunks.

Hans Wennborg hans at chromium.org
Tue May 27 15:57:39 PDT 2014


================
Comment at: lib/CodeGen/CodeGenModule.cpp:1396-1397
@@ -1395,1 +1395,4 @@
 
+  if (const auto *Dtor = dyn_cast_or_null<CXXDestructorDecl>(D)) {
+    if (getCXXABI().useThunkForDtorVariant(Dtor, GD.getDtorType())) {
+      // Don't dllexport/import destructor thunks.
----------------
Reid Kleckner wrote:
> This belongs after the call to setLinkageAndVisibilityForGV() in CodeGenModule::SetFunctionAttributes(), to keep all the dllstorage class code closer together.
Done.

================
Comment at: lib/CodeGen/CodeGenModule.cpp:1925
@@ -1917,3 +1924,3 @@
     const DeclaratorDecl *D, GVALinkage Linkage, bool IsConstantVariable,
     bool UseThunkForDtorVariant) {
   if (Linkage == GVA_Internal)
----------------
Reid Kleckner wrote:
> I don't like how this hyper-specific bool got threaded all the way into getLLVMLinkageForDeclarator in r207451.  I think with this change we can handle dtor thunks as a special case in CodeGenModule::getFunctionLinkage() with something like:
> 
>   if (isa<CXXDestructorDecl>(D) &&
>       getCXXABI().useThunkForDtorVariant(cast<CXXDestructorDecl>(D),
>                                          GD.getDtorType())) {
>     return Linkage == GVA_Internal ? llvm::GlobalValue::InternalLinkage
>                                    : llvm::GlobalValue::LinkOnceODRLinkage;
>   }
> 
> I don't think having the 'weak' attribute on a dtor should affect the linkage of its thunks.
Done.

http://reviews.llvm.org/D3930






More information about the cfe-commits mailing list