1 Pull in r203007 from upstream clang trunk (by Rafael Espindola):
3 Don't produce an alias between destructors with different calling conventions.
7 Introduced here: http://svn.freebsd.org/changeset/base/262809
9 Index: tools/clang/lib/CodeGen/CGCXX.cpp
10 ===================================================================
11 --- tools/clang/lib/CodeGen/CGCXX.cpp
12 +++ tools/clang/lib/CodeGen/CGCXX.cpp
13 @@ -92,7 +92,13 @@ bool CodeGenModule::TryEmitBaseDestructorAsAlias(c
14 if (!ClassLayout.getBaseClassOffset(UniqueBase).isZero())
17 + // Give up if the calling conventions don't match. We could update the call,
18 + // but it is probably not worth it.
19 const CXXDestructorDecl *BaseD = UniqueBase->getDestructor();
20 + if (BaseD->getType()->getAs<FunctionType>()->getCallConv() !=
21 + D->getType()->getAs<FunctionType>()->getCallConv())
24 return TryEmitDefinitionAsAlias(GlobalDecl(D, Dtor_Base),
25 GlobalDecl(BaseD, Dtor_Base),
27 Index: tools/clang/test/CodeGenCXX/ctor-dtor-alias.cpp
28 ===================================================================
29 --- tools/clang/test/CodeGenCXX/ctor-dtor-alias.cpp
30 +++ tools/clang/test/CodeGenCXX/ctor-dtor-alias.cpp
32 -// RUN: %clang_cc1 %s -triple x86_64-linux -emit-llvm -o - -mconstructor-aliases -O1 -disable-llvm-optzns | FileCheck %s
33 -// RUN: %clang_cc1 %s -triple x86_64-linux -emit-llvm -o - -mconstructor-aliases | FileCheck --check-prefix=NOOPT %s
34 +// RUN: %clang_cc1 %s -triple i686-linux -emit-llvm -o - -mconstructor-aliases -O1 -disable-llvm-optzns | FileCheck %s
35 +// RUN: %clang_cc1 %s -triple i686-linux -emit-llvm -o - -mconstructor-aliases | FileCheck --check-prefix=NOOPT %s
37 // RUN: %clang_cc1 -cc1 -triple x86_64--netbsd -emit-llvm \
38 // RUN: -mconstructor-aliases -O2 %s -o - | FileCheck --check-prefix=CHECK-RAUW %s
39 @@ -133,6 +133,22 @@ namespace test8 {
45 + __attribute__((stdcall)) ~foo() {
49 +struct bar : public foo {};
52 + // Test that we produce a call to bar's destructor. We used to call foo's, but
53 + // it has a different calling conversion.
54 + // CHECK-DAG: call void @_ZN5test93barD2Ev
59 // CHECK-RAUW: @_ZTV1C = linkonce_odr unnamed_addr constant [4 x i8*] [{{[^@]*}}@_ZTI1C {{[^@]*}}@_ZN1CD2Ev {{[^@]*}}@_ZN1CD0Ev {{[^@]*}}]
60 // r194296 replaced C::~C with B::~B without emitting the later.