Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 0c0b34e

Browse files
committed
Clarify condition, remove redundant check
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269087 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 2d60064 commit 0c0b34e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/CodeGen/CGDeclCXX.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,17 @@ static void EmitDeclDestroy(CodeGenFunction &CGF, const VarDecl &D,
8787
llvm::Constant *argument;
8888

8989
// Special-case non-array C++ destructors, if they have the right signature
90-
// that can be directly registered with __cxa_atexit. If __cxa_atexit is
91-
// disabled via a flag, a different helper function is generated anyway.
90+
// that can be directly registered with __cxa_atexit.
9291
const CXXRecordDecl *Record = type->getAsCXXRecordDecl();
9392
bool CanRegisterDestructor = Record &&
9493
!CGM.getCXXABI().HasThisReturn(GlobalDecl(
9594
Record->getDestructor(), Dtor_Complete));
96-
97-
if (dtorKind == QualType::DK_cxx_destructor && Record &&
98-
(CanRegisterDestructor || !CGM.getCodeGenOpts().CXAAtExit)) {
95+
// If __cxa_atexit is disabled via a flag, a different helper function is
96+
// generated elsewhere which uses atexit instead, and it takes the destructor
97+
// directly.
98+
bool UsingExternalHelper = !CGM.getCodeGenOpts().CXAAtExit;
99+
if (Record &&
100+
(CanRegisterDestructor || UsingExternalHelper)) {
99101
assert(!Record->hasTrivialDestructor());
100102
CXXDestructorDecl *dtor = Record->getDestructor();
101103

0 commit comments

Comments
 (0)