diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2019-07-18 11:55:33 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2019-07-18 11:55:33 +0000 |
commit | 4f8dc16fcdb6851c91b520d0ee595f5193ef51ef (patch) | |
tree | 001336fbdb293ef73980ee4ef4a0e4f324d288ef /clang/lib/CodeGen/CGDecl.cpp | |
parent | 8f5b44aead89a56c6fbf85ccfda03ae1e82ac431 (diff) | |
download | bcm5719-llvm-4f8dc16fcdb6851c91b520d0ee595f5193ef51ef.tar.gz bcm5719-llvm-4f8dc16fcdb6851c91b520d0ee595f5193ef51ef.zip |
Revert r366422: [OpenCL] Improve destructor support in C++ for OpenCL
Reason: this commit causes crashes in the clang compiler when building
LLVM Support with libc++, see https://bugs.llvm.org/show_bug.cgi?id=42665
for details.
llvm-svn: 366429
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 6ad43cefc4d..19a9e75cc5a 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -480,12 +480,11 @@ namespace { template <class Derived> struct DestroyNRVOVariable : EHScopeStack::Cleanup { - DestroyNRVOVariable(Address addr, QualType type, llvm::Value *NRVOFlag) - : NRVOFlag(NRVOFlag), Loc(addr), Ty(type) {} + DestroyNRVOVariable(Address addr, llvm::Value *NRVOFlag) + : NRVOFlag(NRVOFlag), Loc(addr) {} llvm::Value *NRVOFlag; Address Loc; - QualType Ty; void Emit(CodeGenFunction &CGF, Flags flags) override { // Along the exceptions path we always execute the dtor. @@ -512,24 +511,26 @@ namespace { struct DestroyNRVOVariableCXX final : DestroyNRVOVariable<DestroyNRVOVariableCXX> { - DestroyNRVOVariableCXX(Address addr, QualType type, - const CXXDestructorDecl *Dtor, llvm::Value *NRVOFlag) - : DestroyNRVOVariable<DestroyNRVOVariableCXX>(addr, type, NRVOFlag), - Dtor(Dtor) {} + DestroyNRVOVariableCXX(Address addr, const CXXDestructorDecl *Dtor, + llvm::Value *NRVOFlag) + : DestroyNRVOVariable<DestroyNRVOVariableCXX>(addr, NRVOFlag), + Dtor(Dtor) {} const CXXDestructorDecl *Dtor; void emitDestructorCall(CodeGenFunction &CGF) { CGF.EmitCXXDestructorCall(Dtor, Dtor_Complete, /*ForVirtualBase=*/false, - /*Delegating=*/false, Loc, Ty); + /*Delegating=*/false, Loc); } }; struct DestroyNRVOVariableC final : DestroyNRVOVariable<DestroyNRVOVariableC> { DestroyNRVOVariableC(Address addr, llvm::Value *NRVOFlag, QualType Ty) - : DestroyNRVOVariable<DestroyNRVOVariableC>(addr, Ty, NRVOFlag) {} + : DestroyNRVOVariable<DestroyNRVOVariableC>(addr, NRVOFlag), Ty(Ty) {} + + QualType Ty; void emitDestructorCall(CodeGenFunction &CGF) { CGF.destroyNonTrivialCStruct(CGF, Loc, Ty); @@ -1939,7 +1940,7 @@ void CodeGenFunction::emitAutoVarTypeCleanup( if (emission.NRVOFlag) { assert(!type->isArrayType()); CXXDestructorDecl *dtor = type->getAsCXXRecordDecl()->getDestructor(); - EHStack.pushCleanup<DestroyNRVOVariableCXX>(cleanupKind, addr, type, dtor, + EHStack.pushCleanup<DestroyNRVOVariableCXX>(cleanupKind, addr, dtor, emission.NRVOFlag); return; } |