Skip to content
Snippets Groups Projects
Commit b8317310 authored by Rafael Espindola's avatar Rafael Espindola
Browse files

Allow dllexport alias to base destructors.

We used to avoid these, but it looks like we did so just because we were
not handling dllexport alias correctly.

Dario Domizioli fixed that, so allow these aliases.

Based on a patch by Dario Domizioli!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219206 91177308-0d34-0410-b5e6-96231b3b80d8
parent 9861783c
No related branches found
No related tags found
No related merge requests found
......@@ -44,10 +44,6 @@ bool CodeGenModule::TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) {
if (!D->hasTrivialBody())
return true;
// For exported destructors, we need a full definition.
if (D->hasAttr<DLLExportAttr>())
return true;
const CXXRecordDecl *Class = D->getParent();
// If we need to manipulate a VTT parameter, give up.
......@@ -191,7 +187,7 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl,
}
// Finally, set up the alias with its proper name and attributes.
SetCommonAttributes(cast<NamedDecl>(AliasDecl.getDecl()), Alias);
setAliasAttributes(cast<NamedDecl>(AliasDecl.getDecl()), Alias);
return false;
}
......
// RUN: %clang_cc1 -triple i686-windows-msvc -emit-llvm -std=c++1y -O0 -o - %s | FileCheck --check-prefix=MSC --check-prefix=M32 %s
// RUN: %clang_cc1 -triple i686-windows-msvc -emit-llvm -std=c++1y -O1 -mconstructor-aliases -disable-llvm-optzns -o - %s | FileCheck --check-prefix=MSC --check-prefix=M32 %s
// RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -std=c++1y -O0 -o - %s | FileCheck --check-prefix=MSC --check-prefix=M64 %s
// RUN: %clang_cc1 -triple i686-windows-gnu -emit-llvm -std=c++1y -O0 -o - %s | FileCheck --check-prefix=GNU --check-prefix=G32 %s
// RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm -std=c++1y -O0 -o - %s | FileCheck --check-prefix=GNU --check-prefix=G64 %s
// RUN: %clang_cc1 -triple i686-pc-win32 -O1 -mconstructor-aliases -std=c++1y -emit-llvm -o - %s | FileCheck %s --check-prefix=MSC --check-prefix=M32
// RUN: %clang_cc1 -triple i686-pc-win32 -O1 -mconstructor-aliases -disable-llvm-optzns -std=c++1y -emit-llvm -o - %s | FileCheck %s --check-prefix=MSC --check-prefix=M32
// Helper structs to make templates more expressive.
struct ImplicitInst_Exported {};
......@@ -542,13 +542,14 @@ struct __declspec(dllexport) Z { virtual ~Z() {} };
// The user-defined dtor does get exported:
// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??1Z@@UAE@XZ"
namespace DontUseDtorAlias {
namespace UseDtorAlias {
struct __declspec(dllexport) A { ~A(); };
struct __declspec(dllexport) B : A { ~B(); };
A::~A() { }
B::~B() { }
// Emit a real definition of B's constructor; don't alias it to A's.
// M32-DAG: define dllexport x86_thiscallcc void @"\01??1B@DontUseDtorAlias@@QAE@XZ"
// Emit a alias definition of B's constructor.
// M32-DAG: @"\01??1B@UseDtorAlias@@QAE@XZ" = dllexport alias {{.*}} @"\01??1A@UseDtorAlias@@QAE@XZ"
}
struct __declspec(dllexport) DefaultedCtorsDtors {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment