diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2009-12-20 22:29:11 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2009-12-20 22:29:11 +0000 |
| commit | 7dac3712a2dd59d8a892f7c042521fb346616d9f (patch) | |
| tree | d8d7d21dc17ac830d65ca11d38566cebdb55236b /clang/lib/Sema | |
| parent | 4afe9a35186a0c82f93e1f5271d11e32ec7331b1 (diff) | |
| download | bcm5719-llvm-7dac3712a2dd59d8a892f7c042521fb346616d9f.tar.gz bcm5719-llvm-7dac3712a2dd59d8a892f7c042521fb346616d9f.zip | |
Make sure we instantiate the destructor for variables initialized by
assignment.
llvm-svn: 91798
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index a80d62a4738..f087bcb95cf 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3658,6 +3658,15 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) { assert(Deleted && "Unrecorded tentative definition?"); Deleted=Deleted; } + if (getLangOptions().CPlusPlus) { + // Make sure we mark the destructor as used if necessary. + QualType InitType = VDecl->getType(); + if (const ArrayType *Array = Context.getAsArrayType(InitType)) + InitType = Context.getBaseElementType(Array); + if (InitType->isRecordType()) + FinalizeVarWithDestructor(VDecl, InitType); + } + return; } |

