[cfe-commits] r79197 - /cfe/trunk/lib/CodeGen/CGExpr.cpp
Anders Carlsson
andersca at mac.com
Sun Aug 16 10:54:29 PDT 2009
Author: andersca
Date: Sun Aug 16 12:54:29 2009
New Revision: 79197
URL: http://llvm.org/viewvc/llvm-project?rev=79197&view=rev
Log:
Only do this for initializers of course.
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=79197&r1=79196&r2=79197&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Sun Aug 16 12:54:29 2009
@@ -93,15 +93,17 @@
Val = EmitAnyExprToTemp(E, /*IsAggLocVolatile=*/false,
IsInitializer);
- // We might have to destroy the temporary variable.
- if (const RecordType *RT = E->getType()->getAs<RecordType>()) {
- if (CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
- if (!ClassDecl->hasTrivialDestructor()) {
- const CXXDestructorDecl *Dtor =
- ClassDecl->getDestructor(getContext());
+ if (IsInitializer) {
+ // We might have to destroy the temporary variable.
+ if (const RecordType *RT = E->getType()->getAs<RecordType>()) {
+ if (CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
+ if (!ClassDecl->hasTrivialDestructor()) {
+ const CXXDestructorDecl *Dtor =
+ ClassDecl->getDestructor(getContext());
- CleanupScope scope(*this);
- EmitCXXDestructorCall(Dtor, Dtor_Complete, Val.getAggregateAddr());
+ CleanupScope scope(*this);
+ EmitCXXDestructorCall(Dtor, Dtor_Complete, Val.getAggregateAddr());
+ }
}
}
}
More information about the cfe-commits
mailing list