Minor renaming/refactoring. No change in functionality.

llvm-svn: 77985
This commit is contained in:
Fariborz Jahanian 2009-08-03 19:13:25 +00:00
parent 9170f36f5c
commit 6782844874
4 changed files with 10 additions and 12 deletions

View File

@ -1673,9 +1673,9 @@ public:
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.

View File

@ -3201,9 +3201,7 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl,
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);
}
}
}

View File

@ -2371,14 +2371,14 @@ void Sema::InitializeVarWithConstructor(VarDecl *VD,
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 @@ void Sema::AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
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;
}

View File

@ -1576,7 +1576,9 @@ Sema::OwningExprResult Sema::MaybeBindToTemporary(Expr *E) {
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));
}