diff options
author | Derek Schuff <dschuff@google.com> | 2016-05-10 17:44:50 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2016-05-10 17:44:50 +0000 |
commit | 2136eed8699a42d0176ae70f03665912d397c89a (patch) | |
tree | 3824099bd5f1fea35b6280af390e209a9184237e /clang/lib/CodeGen/CGDeclCXX.cpp | |
parent | 060fd220932100462411c582e8866f55b55f7a09 (diff) | |
download | bcm5719-llvm-2136eed8699a42d0176ae70f03665912d397c89a.tar.gz bcm5719-llvm-2136eed8699a42d0176ae70f03665912d397c89a.zip |
Clarify condition, remove redundant check
llvm-svn: 269087
Diffstat (limited to 'clang/lib/CodeGen/CGDeclCXX.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDeclCXX.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 967e57893b2..65954bde373 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -87,15 +87,17 @@ static void EmitDeclDestroy(CodeGenFunction &CGF, const VarDecl &D, llvm::Constant *argument; // 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. + // that can be directly registered with __cxa_atexit. 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)) { + // If __cxa_atexit is disabled via a flag, a different helper function is + // generated elsewhere which uses atexit instead, and it takes the destructor + // directly. + bool UsingExternalHelper = !CGM.getCodeGenOpts().CXAAtExit; + if (Record && + (CanRegisterDestructor || UsingExternalHelper)) { assert(!Record->hasTrivialDestructor()); CXXDestructorDecl *dtor = Record->getDestructor(); |