[cfe-commits] r77985 - in /cfe/trunk/lib/Sema: Sema.h SemaDecl.cpp SemaDeclCXX.cpp SemaExprCXX.cpp
Fariborz Jahanian
fjahanian at apple.com
Mon Aug 3 12:13:34 PDT 2009
Author: fjahanian
Date: Mon Aug 3 14:13:25 2009
New Revision: 77985
URL: http://llvm.org/viewvc/llvm-project?rev=77985&view=rev
Log:
Minor renaming/refactoring. No change in functionality.
Modified:
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=77985&r1=77984&r2=77985&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Mon Aug 3 14:13:25 2009
@@ -1673,9 +1673,9 @@
QualType DeclInitType,
Expr **Exprs, unsigned NumExprs);
- /// MarkDestructorReferenced - Prepare for calling destructor on the
- /// constructed decl.
- void MarkDestructorReferenced(SourceLocation Loc, QualType DeclInitType);
+ /// FinalizeVarWithDestructor - Prepare for calling destructor on the
+ /// constructed variable.
+ void FinalizeVarWithDestructor(VarDecl *VD, QualType DeclInitType);
/// DefineImplicitDefaultConstructor - Checks for feasibility of
/// defining this constructor as the default constructor.
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=77985&r1=77984&r2=77985&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Aug 3 14:13:25 2009
@@ -3201,9 +3201,7 @@
else {
if (!RD->hasTrivialConstructor())
InitializeVarWithConstructor(Var, Constructor, InitType, 0, 0);
- // FIXME. Must do all that is needed to destroy the object
- // on scope exit. For now, just mark the destructor as used.
- MarkDestructorReferenced(Var->getLocation(), InitType);
+ FinalizeVarWithDestructor(Var, InitType);
}
}
}
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=77985&r1=77984&r2=77985&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Aug 3 14:13:25 2009
@@ -2371,14 +2371,14 @@
VD->setInit(Context, Temp);
}
-void Sema::MarkDestructorReferenced(SourceLocation Loc, QualType DeclInitType)
+void Sema::FinalizeVarWithDestructor(VarDecl *VD, QualType DeclInitType)
{
CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(
DeclInitType->getAs<RecordType>()->getDecl());
if (!ClassDecl->hasTrivialDestructor())
if (CXXDestructorDecl *Destructor =
const_cast<CXXDestructorDecl*>(ClassDecl->getDestructor(Context)))
- MarkDeclarationReferenced(Loc, Destructor);
+ MarkDeclarationReferenced(VD->getLocation(), Destructor);
}
/// AddCXXDirectInitializerToDecl - This action is called immediately after
@@ -2447,9 +2447,7 @@
VDecl->setCXXDirectInitializer(true);
InitializeVarWithConstructor(VDecl, Constructor, DeclInitType,
(Expr**)Exprs.release(), NumExprs);
- // FIXME. Must do all that is needed to destroy the object
- // on scope exit. For now, just mark the destructor as used.
- MarkDestructorReferenced(VDecl->getLocation(), DeclInitType);
+ FinalizeVarWithDestructor(VDecl, DeclInitType);
}
return;
}
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=77985&r1=77984&r2=77985&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Mon Aug 3 14:13:25 2009
@@ -1576,7 +1576,9 @@
CXXTemporary *Temp = CXXTemporary::Create(Context,
RD->getDestructor(Context));
ExprTemporaries.push_back(Temp);
- MarkDestructorReferenced(E->getExprLoc(), E->getType());
+ if (CXXDestructorDecl *Destructor =
+ const_cast<CXXDestructorDecl*>(RD->getDestructor(Context)))
+ MarkDeclarationReferenced(E->getExprLoc(), Destructor);
// FIXME: Add the temporary to the temporaries vector.
return Owned(CXXBindTemporaryExpr::Create(Context, Temp, E));
}
More information about the cfe-commits
mailing list