diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-03 20:20:07 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-03 20:20:07 +0000 |
commit | 6ca0b32227c21ba4bc66e8f1bdbf767b563567a8 (patch) | |
tree | b79234f943ab9f710a9375ab504a7ddf43da0a4c /lib/CodeGen/CGDecl.cpp | |
parent | fec54013fcd0eb72642741584ca04c1bc292bef8 (diff) |
ir-gen for destructor calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77991 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | lib/CodeGen/CGDecl.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 9fd571b816..347a0af696 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -432,6 +432,18 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { } } + // Handle CXX destruction of variables. + // FIXME - destruction of arrays NYI. + if (const RecordType *RT = Ty->getAs<RecordType>()) + if (CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) { + if (!ClassDecl->hasTrivialDestructor()) { + const CXXDestructorDecl *D = ClassDecl->getDestructor(getContext()); + assert(D && "EmitLocalBlockVarDecl - destructor is nul"); + CleanupScope scope(*this); + EmitCXXDestructorCall(D, Dtor_Complete, DeclPtr); + } + } + // Handle the cleanup attribute if (const CleanupAttr *CA = D.getAttr<CleanupAttr>()) { const FunctionDecl *FD = CA->getFunctionDecl(); |