r269086 - Clean up condition, add ARM to test
Derek Schuff via cfe-commits
cfe-commits at lists.llvm.org
Tue May 10 10:44:49 PDT 2016
Author: dschuff
Date: Tue May 10 12:44:48 2016
New Revision: 269086
URL: http://llvm.org/viewvc/llvm-project?rev=269086&view=rev
Log:
Clean up condition, add ARM to test
Modified:
cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
cfe/trunk/test/CodeGenCXX/static-destructor.cpp
Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=269086&r1=269085&r2=269086&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Tue May 10 12:44:48 2016
@@ -89,14 +89,15 @@ static void EmitDeclDestroy(CodeGenFunct
// Special-case non-array C++ destructors, if they have the right signature
// that can be directly registered with __cxa_atexit. If __cxa_atexit is
// disabled via a flag, a different helper function is generated anyway.
- const CXXRecordDecl *record = nullptr;
- if (dtorKind == QualType::DK_cxx_destructor &&
- (record = type->getAsCXXRecordDecl()) &&
- (!CGM.getCXXABI().HasThisReturn(
- GlobalDecl(record->getDestructor(), Dtor_Complete)) ||
- !CGM.getCodeGenOpts().CXAAtExit)) {
- assert(!record->hasTrivialDestructor());
- CXXDestructorDecl *dtor = record->getDestructor();
+ const CXXRecordDecl *Record = type->getAsCXXRecordDecl();
+ bool CanRegisterDestructor = Record &&
+ !CGM.getCXXABI().HasThisReturn(GlobalDecl(
+ Record->getDestructor(), Dtor_Complete));
+
+ if (dtorKind == QualType::DK_cxx_destructor && Record &&
+ (CanRegisterDestructor || !CGM.getCodeGenOpts().CXAAtExit)) {
+ assert(!Record->hasTrivialDestructor());
+ CXXDestructorDecl *dtor = Record->getDestructor();
function = CGM.getAddrOfCXXStructor(dtor, StructorType::Complete);
argument = llvm::ConstantExpr::getBitCast(
Modified: cfe/trunk/test/CodeGenCXX/static-destructor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/static-destructor.cpp?rev=269086&r1=269085&r2=269086&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/static-destructor.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/static-destructor.cpp Tue May 10 12:44:48 2016
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 %s -triple=x86_64-pc-linux -emit-llvm -o - | FileCheck --check-prefix=X86 %s
// RUN: %clang_cc1 %s -triple=wasm32 -emit-llvm -o - | FileCheck --check-prefix=WASM %s
+// RUN: %clang_cc1 %s -triple=armv7-apple-darwin9 -emit-llvm -o - | FileCheck --check-prefix=WASM %s
// Test that destructors are not passed directly to __cxa_atexit when their
// signatures do not match the type of its first argument.
More information about the cfe-commits
mailing list