forked from OSchip/llvm-project
Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoretical
reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
This commit is contained in:
parent
fb212de06d
commit
5d41378146
|
@ -1879,21 +1879,26 @@ public:
|
|||
friend class ASTStmtWriter;
|
||||
};
|
||||
|
||||
class CXXExprWithTemporaries : public Expr {
|
||||
/// Represents an expression --- generally a full-expression --- which
|
||||
/// introduces cleanups to be run at the end of the sub-expression's
|
||||
/// evaluation. The most common source of expression-introduced
|
||||
/// cleanups is temporary objects in C++, but several other C++
|
||||
/// expressions can create cleanups.
|
||||
class ExprWithCleanups : public Expr {
|
||||
Stmt *SubExpr;
|
||||
|
||||
CXXTemporary **Temps;
|
||||
unsigned NumTemps;
|
||||
|
||||
CXXExprWithTemporaries(ASTContext &C, Expr *SubExpr, CXXTemporary **Temps,
|
||||
unsigned NumTemps);
|
||||
|
||||
ExprWithCleanups(ASTContext &C, Expr *SubExpr,
|
||||
CXXTemporary **Temps, unsigned NumTemps);
|
||||
|
||||
public:
|
||||
CXXExprWithTemporaries(EmptyShell Empty)
|
||||
: Expr(CXXExprWithTemporariesClass, Empty),
|
||||
ExprWithCleanups(EmptyShell Empty)
|
||||
: Expr(ExprWithCleanupsClass, Empty),
|
||||
SubExpr(0), Temps(0), NumTemps(0) {}
|
||||
|
||||
static CXXExprWithTemporaries *Create(ASTContext &C, Expr *SubExpr,
|
||||
static ExprWithCleanups *Create(ASTContext &C, Expr *SubExpr,
|
||||
CXXTemporary **Temps,
|
||||
unsigned NumTemps);
|
||||
|
||||
|
@ -1905,7 +1910,7 @@ public:
|
|||
return Temps[i];
|
||||
}
|
||||
const CXXTemporary *getTemporary(unsigned i) const {
|
||||
return const_cast<CXXExprWithTemporaries*>(this)->getTemporary(i);
|
||||
return const_cast<ExprWithCleanups*>(this)->getTemporary(i);
|
||||
}
|
||||
void setTemporary(unsigned i, CXXTemporary *T) {
|
||||
assert(i < NumTemps && "Index out of range");
|
||||
|
@ -1922,9 +1927,9 @@ public:
|
|||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == CXXExprWithTemporariesClass;
|
||||
return T->getStmtClass() == ExprWithCleanupsClass;
|
||||
}
|
||||
static bool classof(const CXXExprWithTemporaries *) { return true; }
|
||||
static bool classof(const ExprWithCleanups *) { return true; }
|
||||
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
|
|
|
@ -1768,7 +1768,7 @@ DEF_TRAVERSE_STMT(CXXBindTemporaryExpr, { })
|
|||
DEF_TRAVERSE_STMT(CXXBoolLiteralExpr, { })
|
||||
DEF_TRAVERSE_STMT(CXXDefaultArgExpr, { })
|
||||
DEF_TRAVERSE_STMT(CXXDeleteExpr, { })
|
||||
DEF_TRAVERSE_STMT(CXXExprWithTemporaries, { })
|
||||
DEF_TRAVERSE_STMT(ExprWithCleanups, { })
|
||||
DEF_TRAVERSE_STMT(CXXNullPtrLiteralExpr, { })
|
||||
DEF_TRAVERSE_STMT(CXXPseudoDestructorExpr, { })
|
||||
DEF_TRAVERSE_STMT(CXXThisExpr, { })
|
||||
|
|
|
@ -103,7 +103,7 @@ def UnaryTypeTraitExpr : DStmt<Expr>;
|
|||
def DependentScopeDeclRefExpr : DStmt<Expr>;
|
||||
def CXXConstructExpr : DStmt<Expr>;
|
||||
def CXXBindTemporaryExpr : DStmt<Expr>;
|
||||
def CXXExprWithTemporaries : DStmt<Expr>;
|
||||
def ExprWithCleanups : DStmt<Expr>;
|
||||
def CXXTemporaryObjectExpr : DStmt<CXXConstructExpr>;
|
||||
def CXXUnresolvedConstructExpr : DStmt<Expr>;
|
||||
def CXXDependentScopeMemberExpr : DStmt<Expr>;
|
||||
|
|
|
@ -2359,12 +2359,12 @@ public:
|
|||
UnqualifiedId &SecondTypeName,
|
||||
bool HasTrailingLParen);
|
||||
|
||||
/// MaybeCreateCXXExprWithTemporaries - If the list of temporaries is
|
||||
/// non-empty, will create a new CXXExprWithTemporaries expression.
|
||||
/// Otherwise, just returs the passed in expression.
|
||||
Expr *MaybeCreateCXXExprWithTemporaries(Expr *SubExpr);
|
||||
Stmt *MaybeCreateCXXStmtWithTemporaries(Stmt *SubStmt);
|
||||
ExprResult MaybeCreateCXXExprWithTemporaries(ExprResult SubExpr);
|
||||
/// MaybeCreateExprWithCleanups - If the current full-expression
|
||||
/// requires any cleanups, surround it with a ExprWithCleanups node.
|
||||
/// Otherwise, just returns the passed-in expression.
|
||||
Expr *MaybeCreateExprWithCleanups(Expr *SubExpr);
|
||||
Stmt *MaybeCreateStmtWithCleanups(Stmt *SubStmt);
|
||||
ExprResult MaybeCreateExprWithCleanups(ExprResult SubExpr);
|
||||
FullExpr CreateFullExpr(Expr *SubExpr);
|
||||
|
||||
ExprResult ActOnFinishFullExpr(Expr *Expr);
|
||||
|
|
|
@ -915,7 +915,7 @@ namespace clang {
|
|||
EXPR_CXX_DELETE, // CXXDeleteExpr
|
||||
EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
|
||||
|
||||
EXPR_CXX_EXPR_WITH_TEMPORARIES, // CXXExprWithTemporaries
|
||||
EXPR_EXPR_WITH_CLEANUPS, // ExprWithCleanups
|
||||
|
||||
EXPR_CXX_DEPENDENT_SCOPE_MEMBER, // CXXDependentScopeMemberExpr
|
||||
EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
|
||||
|
|
|
@ -1176,15 +1176,14 @@ Expr *ParmVarDecl::getDefaultArg() {
|
|||
"Default argument is not yet instantiated!");
|
||||
|
||||
Expr *Arg = getInit();
|
||||
if (CXXExprWithTemporaries *E = dyn_cast_or_null<CXXExprWithTemporaries>(Arg))
|
||||
if (ExprWithCleanups *E = dyn_cast_or_null<ExprWithCleanups>(Arg))
|
||||
return E->getSubExpr();
|
||||
|
||||
return Arg;
|
||||
}
|
||||
|
||||
unsigned ParmVarDecl::getNumDefaultArgTemporaries() const {
|
||||
if (const CXXExprWithTemporaries *E =
|
||||
dyn_cast<CXXExprWithTemporaries>(getInit()))
|
||||
if (const ExprWithCleanups *E = dyn_cast<ExprWithCleanups>(getInit()))
|
||||
return E->getNumTemporaries();
|
||||
|
||||
return 0;
|
||||
|
@ -1194,7 +1193,7 @@ CXXTemporary *ParmVarDecl::getDefaultArgTemporary(unsigned i) {
|
|||
assert(getNumDefaultArgTemporaries() &&
|
||||
"Default arguments does not have any temporaries!");
|
||||
|
||||
CXXExprWithTemporaries *E = cast<CXXExprWithTemporaries>(getInit());
|
||||
ExprWithCleanups *E = cast<ExprWithCleanups>(getInit());
|
||||
return E->getTemporary(i);
|
||||
}
|
||||
|
||||
|
|
|
@ -449,8 +449,7 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
|
|||
// Nothing to print
|
||||
} else {
|
||||
Expr *Init = BMInitializer->getInit();
|
||||
if (CXXExprWithTemporaries *Tmp
|
||||
= dyn_cast<CXXExprWithTemporaries>(Init))
|
||||
if (ExprWithCleanups *Tmp = dyn_cast<ExprWithCleanups>(Init))
|
||||
Init = Tmp->getSubExpr();
|
||||
|
||||
Init = Init->IgnoreParens();
|
||||
|
|
|
@ -1407,8 +1407,8 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1,
|
|||
case CXXBindTemporaryExprClass:
|
||||
return (cast<CXXBindTemporaryExpr>(this)
|
||||
->getSubExpr()->isUnusedResultAWarning(Loc, R1, R2, Ctx));
|
||||
case CXXExprWithTemporariesClass:
|
||||
return (cast<CXXExprWithTemporaries>(this)
|
||||
case ExprWithCleanupsClass:
|
||||
return (cast<ExprWithCleanups>(this)
|
||||
->getSubExpr()->isUnusedResultAWarning(Loc, R1, R2, Ctx));
|
||||
}
|
||||
}
|
||||
|
@ -1643,7 +1643,7 @@ Expr::CanThrowResult Expr::CanThrow(ASTContext &C) const {
|
|||
case ParenListExprClass:
|
||||
case VAArgExprClass:
|
||||
case CXXDefaultArgExprClass:
|
||||
case CXXExprWithTemporariesClass:
|
||||
case ExprWithCleanupsClass:
|
||||
case ObjCIvarRefExprClass:
|
||||
case ObjCIsaExprClass:
|
||||
case ShuffleVectorExprClass:
|
||||
|
|
|
@ -615,11 +615,11 @@ CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
|
|||
}
|
||||
}
|
||||
|
||||
CXXExprWithTemporaries::CXXExprWithTemporaries(ASTContext &C,
|
||||
Expr *subexpr,
|
||||
CXXTemporary **temps,
|
||||
unsigned numtemps)
|
||||
: Expr(CXXExprWithTemporariesClass, subexpr->getType(),
|
||||
ExprWithCleanups::ExprWithCleanups(ASTContext &C,
|
||||
Expr *subexpr,
|
||||
CXXTemporary **temps,
|
||||
unsigned numtemps)
|
||||
: Expr(ExprWithCleanupsClass, subexpr->getType(),
|
||||
subexpr->getValueKind(), subexpr->getObjectKind(),
|
||||
subexpr->isTypeDependent(), subexpr->isValueDependent()),
|
||||
SubExpr(subexpr), Temps(0), NumTemps(0) {
|
||||
|
@ -630,18 +630,18 @@ CXXExprWithTemporaries::CXXExprWithTemporaries(ASTContext &C,
|
|||
}
|
||||
}
|
||||
|
||||
void CXXExprWithTemporaries::setNumTemporaries(ASTContext &C, unsigned N) {
|
||||
void ExprWithCleanups::setNumTemporaries(ASTContext &C, unsigned N) {
|
||||
assert(Temps == 0 && "Cannot resize with this");
|
||||
NumTemps = N;
|
||||
Temps = new (C) CXXTemporary*[NumTemps];
|
||||
}
|
||||
|
||||
|
||||
CXXExprWithTemporaries *CXXExprWithTemporaries::Create(ASTContext &C,
|
||||
Expr *SubExpr,
|
||||
CXXTemporary **Temps,
|
||||
unsigned NumTemps) {
|
||||
return new (C) CXXExprWithTemporaries(C, SubExpr, Temps, NumTemps);
|
||||
ExprWithCleanups *ExprWithCleanups::Create(ASTContext &C,
|
||||
Expr *SubExpr,
|
||||
CXXTemporary **Temps,
|
||||
unsigned NumTemps) {
|
||||
return new (C) ExprWithCleanups(C, SubExpr, Temps, NumTemps);
|
||||
}
|
||||
|
||||
// CXXBindTemporaryExpr
|
||||
|
@ -661,12 +661,12 @@ Stmt::child_iterator CXXConstructExpr::child_end() {
|
|||
return &Args[0]+NumArgs;
|
||||
}
|
||||
|
||||
// CXXExprWithTemporaries
|
||||
Stmt::child_iterator CXXExprWithTemporaries::child_begin() {
|
||||
// ExprWithCleanups
|
||||
Stmt::child_iterator ExprWithCleanups::child_begin() {
|
||||
return &SubExpr;
|
||||
}
|
||||
|
||||
Stmt::child_iterator CXXExprWithTemporaries::child_end() {
|
||||
Stmt::child_iterator ExprWithCleanups::child_end() {
|
||||
return &SubExpr + 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -255,9 +255,9 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) {
|
|||
case Expr::CXXBindTemporaryExprClass:
|
||||
return ClassifyInternal(Ctx, cast<CXXBindTemporaryExpr>(E)->getSubExpr());
|
||||
|
||||
// And the temporary lifetime guard.
|
||||
case Expr::CXXExprWithTemporariesClass:
|
||||
return ClassifyInternal(Ctx, cast<CXXExprWithTemporaries>(E)->getSubExpr());
|
||||
// And the cleanups guard.
|
||||
case Expr::ExprWithCleanupsClass:
|
||||
return ClassifyInternal(Ctx, cast<ExprWithCleanups>(E)->getSubExpr());
|
||||
|
||||
// Casts depend completely on the target type. All casts work the same.
|
||||
case Expr::CStyleCastExprClass:
|
||||
|
|
|
@ -2494,7 +2494,7 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
|
|||
case Expr::DependentScopeDeclRefExprClass:
|
||||
case Expr::CXXConstructExprClass:
|
||||
case Expr::CXXBindTemporaryExprClass:
|
||||
case Expr::CXXExprWithTemporariesClass:
|
||||
case Expr::ExprWithCleanupsClass:
|
||||
case Expr::CXXTemporaryObjectExprClass:
|
||||
case Expr::CXXUnresolvedConstructExprClass:
|
||||
case Expr::CXXDependentScopeMemberExprClass:
|
||||
|
|
|
@ -161,7 +161,7 @@ namespace {
|
|||
void VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node);
|
||||
void VisitCXXConstructExpr(CXXConstructExpr *Node);
|
||||
void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node);
|
||||
void VisitCXXExprWithTemporaries(CXXExprWithTemporaries *Node);
|
||||
void VisitExprWithCleanups(ExprWithCleanups *Node);
|
||||
void VisitUnresolvedLookupExpr(UnresolvedLookupExpr *Node);
|
||||
void DumpCXXTemporary(CXXTemporary *Temporary);
|
||||
|
||||
|
@ -534,7 +534,7 @@ void StmtDumper::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node) {
|
|||
DumpCXXTemporary(Node->getTemporary());
|
||||
}
|
||||
|
||||
void StmtDumper::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *Node) {
|
||||
void StmtDumper::VisitExprWithCleanups(ExprWithCleanups *Node) {
|
||||
DumpExpr(Node);
|
||||
++IndentLevel;
|
||||
for (unsigned i = 0, e = Node->getNumTemporaries(); i != e; ++i) {
|
||||
|
|
|
@ -1142,7 +1142,7 @@ void StmtPrinter::VisitCXXConstructExpr(CXXConstructExpr *E) {
|
|||
// Nothing to print.
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
|
||||
void StmtPrinter::VisitExprWithCleanups(ExprWithCleanups *E) {
|
||||
// Just forward to the sub expression.
|
||||
PrintExpr(E->getSubExpr());
|
||||
}
|
||||
|
|
|
@ -790,11 +790,8 @@ StmtProfiler::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *S) {
|
|||
VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
|
||||
}
|
||||
|
||||
void StmtProfiler::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *S) {
|
||||
void StmtProfiler::VisitExprWithCleanups(ExprWithCleanups *S) {
|
||||
VisitExpr(S);
|
||||
for (unsigned I = 0, N = S->getNumTemporaries(); I != N; ++I)
|
||||
VisitDecl(
|
||||
const_cast<CXXDestructorDecl *>(S->getTemporary(I)->getDestructor()));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -290,7 +290,7 @@ private:
|
|||
CFGBlock *VisitBlockExpr(BlockExpr* E, AddStmtChoice asc);
|
||||
CFGBlock *VisitBreakStmt(BreakStmt *B);
|
||||
CFGBlock *VisitCXXCatchStmt(CXXCatchStmt *S);
|
||||
CFGBlock *VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E,
|
||||
CFGBlock *VisitExprWithCleanups(ExprWithCleanups *E,
|
||||
AddStmtChoice asc);
|
||||
CFGBlock *VisitCXXThrowExpr(CXXThrowExpr *T);
|
||||
CFGBlock *VisitCXXTryStmt(CXXTryStmt *S);
|
||||
|
@ -555,11 +555,11 @@ CFGBlock *CFGBuilder::addInitializer(CXXBaseOrMemberInitializer *I) {
|
|||
if (Init) {
|
||||
if (FieldDecl *FD = I->getAnyMember())
|
||||
IsReference = FD->getType()->isReferenceType();
|
||||
HasTemporaries = isa<CXXExprWithTemporaries>(Init);
|
||||
HasTemporaries = isa<ExprWithCleanups>(Init);
|
||||
|
||||
if (BuildOpts.AddImplicitDtors && HasTemporaries) {
|
||||
// Generate destructors for temporaries in initialization expression.
|
||||
VisitForTemporaryDtors(cast<CXXExprWithTemporaries>(Init)->getSubExpr(),
|
||||
VisitForTemporaryDtors(cast<ExprWithCleanups>(Init)->getSubExpr(),
|
||||
IsReference);
|
||||
}
|
||||
}
|
||||
|
@ -572,7 +572,7 @@ CFGBlock *CFGBuilder::addInitializer(CXXBaseOrMemberInitializer *I) {
|
|||
if (HasTemporaries)
|
||||
// For expression with temporaries go directly to subexpression to omit
|
||||
// generating destructors for the second time.
|
||||
return Visit(cast<CXXExprWithTemporaries>(Init)->getSubExpr(), asc);
|
||||
return Visit(cast<ExprWithCleanups>(Init)->getSubExpr(), asc);
|
||||
return Visit(Init, asc);
|
||||
}
|
||||
|
||||
|
@ -839,8 +839,8 @@ tryAgain:
|
|||
case Stmt::CXXCatchStmtClass:
|
||||
return VisitCXXCatchStmt(cast<CXXCatchStmt>(S));
|
||||
|
||||
case Stmt::CXXExprWithTemporariesClass:
|
||||
return VisitCXXExprWithTemporaries(cast<CXXExprWithTemporaries>(S), asc);
|
||||
case Stmt::ExprWithCleanupsClass:
|
||||
return VisitExprWithCleanups(cast<ExprWithCleanups>(S), asc);
|
||||
|
||||
case Stmt::CXXBindTemporaryExprClass:
|
||||
return VisitCXXBindTemporaryExpr(cast<CXXBindTemporaryExpr>(S), asc);
|
||||
|
@ -1322,11 +1322,11 @@ CFGBlock *CFGBuilder::VisitDeclSubExpr(DeclStmt* DS) {
|
|||
Expr *Init = VD->getInit();
|
||||
if (Init) {
|
||||
IsReference = VD->getType()->isReferenceType();
|
||||
HasTemporaries = isa<CXXExprWithTemporaries>(Init);
|
||||
HasTemporaries = isa<ExprWithCleanups>(Init);
|
||||
|
||||
if (BuildOpts.AddImplicitDtors && HasTemporaries) {
|
||||
// Generate destructors for temporaries in initialization expression.
|
||||
VisitForTemporaryDtors(cast<CXXExprWithTemporaries>(Init)->getSubExpr(),
|
||||
VisitForTemporaryDtors(cast<ExprWithCleanups>(Init)->getSubExpr(),
|
||||
IsReference);
|
||||
}
|
||||
}
|
||||
|
@ -1339,7 +1339,7 @@ CFGBlock *CFGBuilder::VisitDeclSubExpr(DeclStmt* DS) {
|
|||
if (HasTemporaries)
|
||||
// For expression with temporaries go directly to subexpression to omit
|
||||
// generating destructors for the second time.
|
||||
Visit(cast<CXXExprWithTemporaries>(Init)->getSubExpr(), asc);
|
||||
Visit(cast<ExprWithCleanups>(Init)->getSubExpr(), asc);
|
||||
else
|
||||
Visit(Init, asc);
|
||||
}
|
||||
|
@ -2411,7 +2411,7 @@ CFGBlock* CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt* CS) {
|
|||
return CatchBlock;
|
||||
}
|
||||
|
||||
CFGBlock *CFGBuilder::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E,
|
||||
CFGBlock *CFGBuilder::VisitExprWithCleanups(ExprWithCleanups *E,
|
||||
AddStmtChoice asc) {
|
||||
if (BuildOpts.AddImplicitDtors) {
|
||||
// If adding implicit destructors visit the full expression for adding
|
||||
|
|
|
@ -203,7 +203,7 @@ public:
|
|||
if (isa<CXXConstructExpr>(E))
|
||||
return;
|
||||
|
||||
if (isa<CXXExprWithTemporaries>(E))
|
||||
if (isa<ExprWithCleanups>(E))
|
||||
return;
|
||||
|
||||
// A dead initialization is a variable that is dead after it
|
||||
|
|
|
@ -69,8 +69,8 @@ SVal Environment::getSVal(const Stmt *E, SValBuilder& svalBuilder) const {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case Stmt::CXXExprWithTemporariesClass:
|
||||
E = cast<CXXExprWithTemporaries>(E)->getSubExpr();
|
||||
case Stmt::ExprWithCleanupsClass:
|
||||
E = cast<ExprWithCleanups>(E)->getSubExpr();
|
||||
continue;
|
||||
case Stmt::CXXBindTemporaryExprClass:
|
||||
E = cast<CXXBindTemporaryExpr>(E)->getSubExpr();
|
||||
|
|
|
@ -797,7 +797,7 @@ void GRExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
|
|||
case Stmt::CXXCatchStmtClass:
|
||||
case Stmt::CXXDefaultArgExprClass:
|
||||
case Stmt::CXXDependentScopeMemberExprClass:
|
||||
case Stmt::CXXExprWithTemporariesClass:
|
||||
case Stmt::ExprWithCleanupsClass:
|
||||
case Stmt::CXXNullPtrLiteralExprClass:
|
||||
case Stmt::CXXPseudoDestructorExprClass:
|
||||
case Stmt::CXXTemporaryObjectExprClass:
|
||||
|
@ -1154,8 +1154,8 @@ void GRExprEngine::VisitLValue(const Expr* Ex, ExplodedNode* Pred,
|
|||
break;
|
||||
}
|
||||
|
||||
case Stmt::CXXExprWithTemporariesClass: {
|
||||
const CXXExprWithTemporaries *expr = cast<CXXExprWithTemporaries>(Ex);
|
||||
case Stmt::ExprWithCleanupsClass: {
|
||||
const ExprWithCleanups *expr = cast<ExprWithCleanups>(Ex);
|
||||
VisitLValue(expr->getSubExpr(), Pred, Dst);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ void StringRefCheckerVisitor::VisitVarDecl(VarDecl *VD) {
|
|||
// llvm::StringRef x = call() (where call returns std::string)
|
||||
if (!IsLLVMStringRef(VD->getType()))
|
||||
return;
|
||||
CXXExprWithTemporaries *Ex1 = dyn_cast<CXXExprWithTemporaries>(Init);
|
||||
ExprWithCleanups *Ex1 = dyn_cast<ExprWithCleanups>(Init);
|
||||
if (!Ex1)
|
||||
return;
|
||||
CXXConstructExpr *Ex2 = dyn_cast<CXXConstructExpr>(Ex1->getSubExpr());
|
||||
|
|
|
@ -547,7 +547,7 @@ static void EmitAnyExprToExn(CodeGenFunction &CGF, const Expr *E,
|
|||
// Technically, the exception object is like a temporary; it has to
|
||||
// be cleaned up when its full-expression is complete.
|
||||
// Unfortunately, the AST represents full-expressions by creating a
|
||||
// CXXExprWithTemporaries, which it only does when there are actually
|
||||
// ExprWithCleanups, which it only does when there are actually
|
||||
// temporaries.
|
||||
//
|
||||
// If any cleanups have been added since we pushed ours, they must
|
||||
|
|
|
@ -192,7 +192,7 @@ EmitExprForReferenceBinding(CodeGenFunction &CGF, const Expr *E,
|
|||
if (const CXXDefaultArgExpr *DAE = dyn_cast<CXXDefaultArgExpr>(E))
|
||||
E = DAE->getExpr();
|
||||
|
||||
if (const CXXExprWithTemporaries *TE = dyn_cast<CXXExprWithTemporaries>(E)) {
|
||||
if (const ExprWithCleanups *TE = dyn_cast<ExprWithCleanups>(E)) {
|
||||
CodeGenFunction::RunCleanupsScope Scope(CGF);
|
||||
|
||||
return EmitExprForReferenceBinding(CGF, TE->getSubExpr(),
|
||||
|
@ -537,8 +537,8 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
|
|||
return EmitCXXConstructLValue(cast<CXXConstructExpr>(E));
|
||||
case Expr::CXXBindTemporaryExprClass:
|
||||
return EmitCXXBindTemporaryLValue(cast<CXXBindTemporaryExpr>(E));
|
||||
case Expr::CXXExprWithTemporariesClass:
|
||||
return EmitCXXExprWithTemporariesLValue(cast<CXXExprWithTemporaries>(E));
|
||||
case Expr::ExprWithCleanupsClass:
|
||||
return EmitExprWithCleanupsLValue(cast<ExprWithCleanups>(E));
|
||||
case Expr::CXXScalarValueInitExprClass:
|
||||
return EmitNullInitializationLValue(cast<CXXScalarValueInitExpr>(E));
|
||||
case Expr::CXXDefaultArgExprClass:
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
}
|
||||
void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E);
|
||||
void VisitCXXConstructExpr(const CXXConstructExpr *E);
|
||||
void VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E);
|
||||
void VisitExprWithCleanups(ExprWithCleanups *E);
|
||||
void VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E);
|
||||
void VisitCXXTypeidExpr(CXXTypeidExpr *E) { EmitAggLoadOfLValue(E); }
|
||||
|
||||
|
@ -487,8 +487,8 @@ AggExprEmitter::VisitCXXConstructExpr(const CXXConstructExpr *E) {
|
|||
CGF.EmitCXXConstructExpr(E, Slot);
|
||||
}
|
||||
|
||||
void AggExprEmitter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
|
||||
CGF.EmitCXXExprWithTemporaries(E, Dest);
|
||||
void AggExprEmitter::VisitExprWithCleanups(ExprWithCleanups *E) {
|
||||
CGF.EmitExprWithCleanups(E, Dest);
|
||||
}
|
||||
|
||||
void AggExprEmitter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
|
||||
|
|
|
@ -311,7 +311,7 @@ void
|
|||
CodeGenFunction::EmitSynthesizedCXXCopyCtor(llvm::Value *Dest,
|
||||
llvm::Value *Src,
|
||||
const Expr *Exp) {
|
||||
if (const CXXExprWithTemporaries *E = dyn_cast<CXXExprWithTemporaries>(Exp))
|
||||
if (const ExprWithCleanups *E = dyn_cast<ExprWithCleanups>(Exp))
|
||||
Exp = E->getSubExpr();
|
||||
assert(isa<CXXConstructExpr>(Exp) &&
|
||||
"EmitSynthesizedCXXCopyCtor - unknown copy ctor expr");
|
||||
|
|
|
@ -177,8 +177,8 @@ public:
|
|||
ComplexPairTy VisitCXXDefaultArgExpr(CXXDefaultArgExpr *DAE) {
|
||||
return Visit(DAE->getExpr());
|
||||
}
|
||||
ComplexPairTy VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
|
||||
return CGF.EmitCXXExprWithTemporaries(E).getComplexVal();
|
||||
ComplexPairTy VisitExprWithCleanups(ExprWithCleanups *E) {
|
||||
return CGF.EmitExprWithCleanups(E).getComplexVal();
|
||||
}
|
||||
ComplexPairTy VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
|
||||
assert(E->getType()->isAnyComplexType() && "Expected complex type!");
|
||||
|
|
|
@ -339,8 +339,8 @@ public:
|
|||
return CGF.LoadCXXThis();
|
||||
}
|
||||
|
||||
Value *VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
|
||||
return CGF.EmitCXXExprWithTemporaries(E).getScalarVal();
|
||||
Value *VisitExprWithCleanups(ExprWithCleanups *E) {
|
||||
return CGF.EmitExprWithCleanups(E).getScalarVal();
|
||||
}
|
||||
Value *VisitCXXNewExpr(const CXXNewExpr *E) {
|
||||
return CGF.EmitCXXNewExpr(E);
|
||||
|
|
|
@ -76,14 +76,13 @@ void CodeGenFunction::EmitCXXTemporary(const CXXTemporary *Temporary,
|
|||
}
|
||||
|
||||
RValue
|
||||
CodeGenFunction::EmitCXXExprWithTemporaries(const CXXExprWithTemporaries *E,
|
||||
AggValueSlot Slot) {
|
||||
CodeGenFunction::EmitExprWithCleanups(const ExprWithCleanups *E,
|
||||
AggValueSlot Slot) {
|
||||
RunCleanupsScope Scope(*this);
|
||||
return EmitAnyExpr(E->getSubExpr(), Slot);
|
||||
}
|
||||
|
||||
LValue CodeGenFunction::EmitCXXExprWithTemporariesLValue(
|
||||
const CXXExprWithTemporaries *E) {
|
||||
LValue CodeGenFunction::EmitExprWithCleanupsLValue(const ExprWithCleanups *E) {
|
||||
RunCleanupsScope Scope(*this);
|
||||
return EmitLValue(E->getSubExpr());
|
||||
}
|
||||
|
|
|
@ -1456,7 +1456,7 @@ public:
|
|||
|
||||
LValue EmitCXXConstructLValue(const CXXConstructExpr *E);
|
||||
LValue EmitCXXBindTemporaryLValue(const CXXBindTemporaryExpr *E);
|
||||
LValue EmitCXXExprWithTemporariesLValue(const CXXExprWithTemporaries *E);
|
||||
LValue EmitExprWithCleanupsLValue(const ExprWithCleanups *E);
|
||||
LValue EmitCXXTypeidLValue(const CXXTypeidExpr *E);
|
||||
|
||||
LValue EmitObjCMessageExprLValue(const ObjCMessageExpr *E);
|
||||
|
@ -1656,8 +1656,8 @@ public:
|
|||
void EmitSynthesizedCXXCopyCtor(llvm::Value *Dest, llvm::Value *Src,
|
||||
const Expr *Exp);
|
||||
|
||||
RValue EmitCXXExprWithTemporaries(const CXXExprWithTemporaries *E,
|
||||
AggValueSlot Slot =AggValueSlot::ignored());
|
||||
RValue EmitExprWithCleanups(const ExprWithCleanups *E,
|
||||
AggValueSlot Slot =AggValueSlot::ignored());
|
||||
|
||||
void EmitCXXThrowExpr(const CXXThrowExpr *E);
|
||||
|
||||
|
|
|
@ -1960,8 +1960,8 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity) {
|
|||
mangleExpression(cast<CXXBindTemporaryExpr>(E)->getSubExpr());
|
||||
break;
|
||||
|
||||
case Expr::CXXExprWithTemporariesClass:
|
||||
mangleExpression(cast<CXXExprWithTemporaries>(E)->getSubExpr(), Arity);
|
||||
case Expr::ExprWithCleanupsClass:
|
||||
mangleExpression(cast<ExprWithCleanups>(E)->getSubExpr(), Arity);
|
||||
break;
|
||||
|
||||
case Expr::FloatingLiteralClass: {
|
||||
|
|
|
@ -179,7 +179,7 @@ static ControlFlowKind CheckFallThrough(AnalysisContext &AC) {
|
|||
}
|
||||
// FIXME: Remove this hack once temporaries and their destructors are
|
||||
// modeled correctly by the CFG.
|
||||
if (CXXExprWithTemporaries *E = dyn_cast<CXXExprWithTemporaries>(S)) {
|
||||
if (ExprWithCleanups *E = dyn_cast<ExprWithCleanups>(S)) {
|
||||
for (unsigned I = 0, N = E->getNumTemporaries(); I != N; ++I) {
|
||||
const FunctionDecl *FD = E->getTemporary(I)->getDestructor();
|
||||
if (FD->hasAttr<NoReturnAttr>() ||
|
||||
|
|
|
@ -3037,7 +3037,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC,
|
|||
SourceLocation(),
|
||||
Owned(E));
|
||||
if (!Res.isInvalid()) {
|
||||
Res = MaybeCreateCXXExprWithTemporaries(Res.get());
|
||||
Res = MaybeCreateExprWithCleanups(Res.get());
|
||||
Expr *Init = Res.takeAs<Expr>();
|
||||
Context.setBlockVarCopyInits(NewVD, Init);
|
||||
}
|
||||
|
@ -4589,7 +4589,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
|
|||
// Check any implicit conversions within the expression.
|
||||
CheckImplicitConversions(Init, VDecl->getLocation());
|
||||
|
||||
Init = MaybeCreateCXXExprWithTemporaries(Init);
|
||||
Init = MaybeCreateExprWithCleanups(Init);
|
||||
// Attach the initializer to the decl.
|
||||
VDecl->setInit(Init);
|
||||
|
||||
|
@ -4805,7 +4805,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl,
|
|||
if (Init.isInvalid())
|
||||
Var->setInvalidDecl();
|
||||
else if (Init.get()) {
|
||||
Var->setInit(MaybeCreateCXXExprWithTemporaries(Init.takeAs<Expr>()));
|
||||
Var->setInit(MaybeCreateExprWithCleanups(Init.takeAs<Expr>()));
|
||||
|
||||
if (getLangOptions().CPlusPlus && !Var->isInvalidDecl() &&
|
||||
Var->hasGlobalStorage() && !Var->isStaticLocal() &&
|
||||
|
|
|
@ -137,7 +137,7 @@ Sema::SetParamDefaultArgument(ParmVarDecl *Param, Expr *Arg,
|
|||
Arg = Result.takeAs<Expr>();
|
||||
|
||||
CheckImplicitConversions(Arg, EqualLoc);
|
||||
Arg = MaybeCreateCXXExprWithTemporaries(Arg);
|
||||
Arg = MaybeCreateExprWithCleanups(Arg);
|
||||
|
||||
// Okay: add the default argument to the parameter
|
||||
Param->setDefaultArg(Arg);
|
||||
|
@ -311,7 +311,7 @@ bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old) {
|
|||
} else if (OldParam->hasDefaultArg()) {
|
||||
// Merge the old default argument into the new parameter.
|
||||
// It's important to use getInit() here; getDefaultArg()
|
||||
// strips off any top-level CXXExprWithTemporaries.
|
||||
// strips off any top-level ExprWithCleanups.
|
||||
NewParam->setHasInheritedDefaultArg();
|
||||
if (OldParam->hasUninstantiatedDefaultArg())
|
||||
NewParam->setUninstantiatedDefaultArg(
|
||||
|
@ -1332,7 +1332,7 @@ Sema::BuildMemberInitializer(T *Member, Expr **Args,
|
|||
// C++0x [class.base.init]p7:
|
||||
// The initialization of each base and member constitutes a
|
||||
// full-expression.
|
||||
MemberInit = MaybeCreateCXXExprWithTemporaries(MemberInit.get());
|
||||
MemberInit = MaybeCreateExprWithCleanups(MemberInit.get());
|
||||
if (MemberInit.isInvalid())
|
||||
return true;
|
||||
|
||||
|
@ -1461,7 +1461,7 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
|
|||
// C++0x [class.base.init]p7:
|
||||
// The initialization of each base and member constitutes a
|
||||
// full-expression.
|
||||
BaseInit = MaybeCreateCXXExprWithTemporaries(BaseInit.get());
|
||||
BaseInit = MaybeCreateExprWithCleanups(BaseInit.get());
|
||||
if (BaseInit.isInvalid())
|
||||
return true;
|
||||
|
||||
|
@ -1557,7 +1557,7 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
|
|||
if (BaseInit.isInvalid())
|
||||
return true;
|
||||
|
||||
BaseInit = SemaRef.MaybeCreateCXXExprWithTemporaries(BaseInit.get());
|
||||
BaseInit = SemaRef.MaybeCreateExprWithCleanups(BaseInit.get());
|
||||
if (BaseInit.isInvalid())
|
||||
return true;
|
||||
|
||||
|
@ -1671,7 +1671,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
|
|||
ExprResult MemberInit
|
||||
= InitSeq.Perform(SemaRef, Entities.back(), InitKind,
|
||||
MultiExprArg(&CopyCtorArgE, 1));
|
||||
MemberInit = SemaRef.MaybeCreateCXXExprWithTemporaries(MemberInit.get());
|
||||
MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit.get());
|
||||
if (MemberInit.isInvalid())
|
||||
return true;
|
||||
|
||||
|
@ -1699,7 +1699,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
|
|||
if (MemberInit.isInvalid())
|
||||
return true;
|
||||
|
||||
MemberInit = SemaRef.MaybeCreateCXXExprWithTemporaries(MemberInit.get());
|
||||
MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit.get());
|
||||
if (MemberInit.isInvalid())
|
||||
return true;
|
||||
|
||||
|
@ -5414,7 +5414,7 @@ bool Sema::InitializeVarWithConstructor(VarDecl *VD,
|
|||
Expr *Temp = TempResult.takeAs<Expr>();
|
||||
CheckImplicitConversions(Temp, VD->getLocation());
|
||||
MarkDeclarationReferenced(VD->getLocation(), Constructor);
|
||||
Temp = MaybeCreateCXXExprWithTemporaries(Temp);
|
||||
Temp = MaybeCreateExprWithCleanups(Temp);
|
||||
VD->setInit(Temp);
|
||||
|
||||
return false;
|
||||
|
@ -5549,7 +5549,7 @@ void Sema::AddCXXDirectInitializerToDecl(Decl *RealDecl,
|
|||
|
||||
CheckImplicitConversions(Result.get(), LParenLoc);
|
||||
|
||||
Result = MaybeCreateCXXExprWithTemporaries(Result.get());
|
||||
Result = MaybeCreateExprWithCleanups(Result.get());
|
||||
VDecl->setInit(Result.takeAs<Expr>());
|
||||
VDecl->setCXXDirectInitializer(true);
|
||||
|
||||
|
@ -7039,7 +7039,7 @@ void Sema::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) {
|
|||
InitializationSequence InitSeq(*this, InitEntity, InitKind, 0, 0);
|
||||
ExprResult MemberInit =
|
||||
InitSeq.Perform(*this, InitEntity, InitKind, MultiExprArg());
|
||||
MemberInit = MaybeCreateCXXExprWithTemporaries(MemberInit.get());
|
||||
MemberInit = MaybeCreateExprWithCleanups(MemberInit.get());
|
||||
// Note, MemberInit could actually come back empty if no initialization
|
||||
// is required (e.g., because it would call a trivial default constructor)
|
||||
if (!MemberInit.get() || MemberInit.isInvalid())
|
||||
|
|
|
@ -2272,7 +2272,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
|
|||
SourceLocation(),
|
||||
Owned(E));
|
||||
if (!Res.isInvalid()) {
|
||||
Res = MaybeCreateCXXExprWithTemporaries(Res.get());
|
||||
Res = MaybeCreateExprWithCleanups(Res.get());
|
||||
Expr *Init = Res.takeAs<Expr>();
|
||||
BDRE->setCopyConstructorExpr(Init);
|
||||
}
|
||||
|
|
|
@ -3080,7 +3080,7 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) {
|
|||
return Owned(CXXBindTemporaryExpr::Create(Context, Temp, E));
|
||||
}
|
||||
|
||||
Expr *Sema::MaybeCreateCXXExprWithTemporaries(Expr *SubExpr) {
|
||||
Expr *Sema::MaybeCreateExprWithCleanups(Expr *SubExpr) {
|
||||
assert(SubExpr && "sub expression can't be null!");
|
||||
|
||||
unsigned FirstTemporary = ExprEvalContexts.back().NumTemporaries;
|
||||
|
@ -3088,9 +3088,9 @@ Expr *Sema::MaybeCreateCXXExprWithTemporaries(Expr *SubExpr) {
|
|||
if (ExprTemporaries.size() == FirstTemporary)
|
||||
return SubExpr;
|
||||
|
||||
Expr *E = CXXExprWithTemporaries::Create(Context, SubExpr,
|
||||
&ExprTemporaries[FirstTemporary],
|
||||
ExprTemporaries.size() - FirstTemporary);
|
||||
Expr *E = ExprWithCleanups::Create(Context, SubExpr,
|
||||
&ExprTemporaries[FirstTemporary],
|
||||
ExprTemporaries.size() - FirstTemporary);
|
||||
ExprTemporaries.erase(ExprTemporaries.begin() + FirstTemporary,
|
||||
ExprTemporaries.end());
|
||||
|
||||
|
@ -3098,11 +3098,11 @@ Expr *Sema::MaybeCreateCXXExprWithTemporaries(Expr *SubExpr) {
|
|||
}
|
||||
|
||||
ExprResult
|
||||
Sema::MaybeCreateCXXExprWithTemporaries(ExprResult SubExpr) {
|
||||
Sema::MaybeCreateExprWithCleanups(ExprResult SubExpr) {
|
||||
if (SubExpr.isInvalid())
|
||||
return ExprError();
|
||||
|
||||
return Owned(MaybeCreateCXXExprWithTemporaries(SubExpr.takeAs<Expr>()));
|
||||
return Owned(MaybeCreateExprWithCleanups(SubExpr.take()));
|
||||
}
|
||||
|
||||
FullExpr Sema::CreateFullExpr(Expr *SubExpr) {
|
||||
|
@ -3121,7 +3121,7 @@ FullExpr Sema::CreateFullExpr(Expr *SubExpr) {
|
|||
return E;
|
||||
}
|
||||
|
||||
Stmt *Sema::MaybeCreateCXXStmtWithTemporaries(Stmt *SubStmt) {
|
||||
Stmt *Sema::MaybeCreateStmtWithCleanups(Stmt *SubStmt) {
|
||||
assert(SubStmt && "sub statement can't be null!");
|
||||
|
||||
unsigned FirstTemporary = ExprEvalContexts.back().NumTemporaries;
|
||||
|
@ -3138,7 +3138,7 @@ Stmt *Sema::MaybeCreateCXXStmtWithTemporaries(Stmt *SubStmt) {
|
|||
SourceLocation());
|
||||
Expr *E = new (Context) StmtExpr(CompStmt, Context.VoidTy, SourceLocation(),
|
||||
SourceLocation());
|
||||
return MaybeCreateCXXExprWithTemporaries(E);
|
||||
return MaybeCreateExprWithCleanups(E);
|
||||
}
|
||||
|
||||
ExprResult
|
||||
|
@ -3559,11 +3559,11 @@ ExprResult Sema::ActOnFinishFullExpr(Expr *FullExpr) {
|
|||
|
||||
IgnoredValueConversions(FullExpr);
|
||||
CheckImplicitConversions(FullExpr);
|
||||
return MaybeCreateCXXExprWithTemporaries(FullExpr);
|
||||
return MaybeCreateExprWithCleanups(FullExpr);
|
||||
}
|
||||
|
||||
StmtResult Sema::ActOnFinishFullStmt(Stmt *FullStmt) {
|
||||
if (!FullStmt) return StmtError();
|
||||
|
||||
return MaybeCreateCXXStmtWithTemporaries(FullStmt);
|
||||
return MaybeCreateStmtWithCleanups(FullStmt);
|
||||
}
|
||||
|
|
|
@ -500,7 +500,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
|
|||
if (!Res.isInvalid()) {
|
||||
Expr *ResExpr = Res.takeAs<Expr>();
|
||||
if (ResExpr)
|
||||
ResExpr = MaybeCreateCXXExprWithTemporaries(ResExpr);
|
||||
ResExpr = MaybeCreateExprWithCleanups(ResExpr);
|
||||
PIDecl->setGetterCXXConstructor(ResExpr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S) {
|
|||
// we might want to make a more specific diagnostic. Check for one of these
|
||||
// cases now.
|
||||
unsigned DiagID = diag::warn_unused_expr;
|
||||
if (const CXXExprWithTemporaries *Temps = dyn_cast<CXXExprWithTemporaries>(E))
|
||||
if (const ExprWithCleanups *Temps = dyn_cast<ExprWithCleanups>(E))
|
||||
E = Temps->getSubExpr();
|
||||
|
||||
E = E->IgnoreParenImpCasts();
|
||||
|
@ -455,7 +455,7 @@ Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond,
|
|||
|
||||
if (!CondVar) {
|
||||
CheckImplicitConversions(Cond, SwitchLoc);
|
||||
CondResult = MaybeCreateCXXExprWithTemporaries(Cond);
|
||||
CondResult = MaybeCreateExprWithCleanups(Cond);
|
||||
if (CondResult.isInvalid())
|
||||
return StmtError();
|
||||
Cond = CondResult.take();
|
||||
|
@ -899,7 +899,7 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body,
|
|||
return StmtError();
|
||||
|
||||
CheckImplicitConversions(Cond, DoLoc);
|
||||
ExprResult CondResult = MaybeCreateCXXExprWithTemporaries(Cond);
|
||||
ExprResult CondResult = MaybeCreateExprWithCleanups(Cond);
|
||||
if (CondResult.isInvalid())
|
||||
return StmtError();
|
||||
Cond = CondResult.take();
|
||||
|
@ -958,7 +958,7 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
|
|||
/// full-expression.
|
||||
StmtResult Sema::ActOnForEachLValueExpr(Expr *E) {
|
||||
CheckImplicitConversions(E);
|
||||
ExprResult Result = MaybeCreateCXXExprWithTemporaries(E);
|
||||
ExprResult Result = MaybeCreateExprWithCleanups(E);
|
||||
if (Result.isInvalid()) return StmtError();
|
||||
return Owned(static_cast<Stmt*>(Result.get()));
|
||||
}
|
||||
|
@ -1195,7 +1195,7 @@ Sema::ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
|
|||
|
||||
if (RetValExp) {
|
||||
CheckImplicitConversions(RetValExp, ReturnLoc);
|
||||
RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp);
|
||||
RetValExp = MaybeCreateExprWithCleanups(RetValExp);
|
||||
}
|
||||
|
||||
RetValExp = Res.takeAs<Expr>();
|
||||
|
@ -1254,7 +1254,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
|
|||
}
|
||||
|
||||
CheckImplicitConversions(RetValExp, ReturnLoc);
|
||||
RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp);
|
||||
RetValExp = MaybeCreateExprWithCleanups(RetValExp);
|
||||
}
|
||||
|
||||
Result = new (Context) ReturnStmt(ReturnLoc, RetValExp, 0);
|
||||
|
@ -1298,7 +1298,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
|
|||
|
||||
if (RetValExp) {
|
||||
CheckImplicitConversions(RetValExp, ReturnLoc);
|
||||
RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp);
|
||||
RetValExp = MaybeCreateExprWithCleanups(RetValExp);
|
||||
}
|
||||
Result = new (Context) ReturnStmt(ReturnLoc, RetValExp, NRVOCandidate);
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ static bool InstantiateInitializer(Sema &S, Expr *Init,
|
|||
if (!Init)
|
||||
return false;
|
||||
|
||||
if (CXXExprWithTemporaries *ExprTemp = dyn_cast<CXXExprWithTemporaries>(Init))
|
||||
if (ExprWithCleanups *ExprTemp = dyn_cast<ExprWithCleanups>(Init))
|
||||
Init = ExprTemp->getSubExpr();
|
||||
|
||||
while (CXXBindTemporaryExpr *Binder = dyn_cast<CXXBindTemporaryExpr>(Init))
|
||||
|
|
|
@ -5780,15 +5780,14 @@ TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
|
|||
return getDerived().TransformExpr(E->getSubExpr());
|
||||
}
|
||||
|
||||
/// \brief Transform a C++ expression that contains temporaries that should
|
||||
/// be destroyed after the expression is evaluated.
|
||||
/// \brief Transform a C++ expression that contains cleanups that should
|
||||
/// be run after the expression is evaluated.
|
||||
///
|
||||
/// Since CXXExprWithTemporaries nodes are implicitly generated, we
|
||||
/// Since ExprWithCleanups nodes are implicitly generated, we
|
||||
/// just transform the subexpression and return that.
|
||||
template<typename Derived>
|
||||
ExprResult
|
||||
TreeTransform<Derived>::TransformCXXExprWithTemporaries(
|
||||
CXXExprWithTemporaries *E) {
|
||||
TreeTransform<Derived>::TransformExprWithCleanups(ExprWithCleanups *E) {
|
||||
return getDerived().TransformExpr(E->getSubExpr());
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ namespace clang {
|
|||
void VisitCXXDeleteExpr(CXXDeleteExpr *E);
|
||||
void VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
|
||||
|
||||
void VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E);
|
||||
void VisitExprWithCleanups(ExprWithCleanups *E);
|
||||
|
||||
void VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E);
|
||||
void VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E);
|
||||
|
@ -1164,7 +1164,7 @@ void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
|
|||
E->setDestroyedType(GetTypeSourceInfo(Record, Idx));
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
|
||||
void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
|
||||
VisitExpr(E);
|
||||
unsigned NumTemps = Record[Idx++];
|
||||
if (NumTemps) {
|
||||
|
@ -1767,8 +1767,8 @@ Stmt *ASTReader::ReadStmtFromStream(PerFileData &F) {
|
|||
S = new (Context) CXXPseudoDestructorExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_EXPR_WITH_TEMPORARIES:
|
||||
S = new (Context) CXXExprWithTemporaries(Empty);
|
||||
case EXPR_EXPR_WITH_CLEANUPS:
|
||||
S = new (Context) ExprWithCleanups(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_DEPENDENT_SCOPE_MEMBER:
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace clang {
|
|||
void VisitCXXDeleteExpr(CXXDeleteExpr *E);
|
||||
void VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
|
||||
|
||||
void VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E);
|
||||
void VisitExprWithCleanups(ExprWithCleanups *E);
|
||||
void VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E);
|
||||
void VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E);
|
||||
void VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E);
|
||||
|
@ -1156,14 +1156,14 @@ void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
|
|||
Code = serialization::EXPR_CXX_PSEUDO_DESTRUCTOR;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
|
||||
void ASTStmtWriter::VisitExprWithCleanups(ExprWithCleanups *E) {
|
||||
VisitExpr(E);
|
||||
Record.push_back(E->getNumTemporaries());
|
||||
for (unsigned i = 0, e = E->getNumTemporaries(); i != e; ++i)
|
||||
Writer.AddCXXTemporary(E->getTemporary(i), Record);
|
||||
|
||||
Writer.AddStmt(E->getSubExpr());
|
||||
Code = serialization::EXPR_CXX_EXPR_WITH_TEMPORARIES;
|
||||
Code = serialization::EXPR_EXPR_WITH_CLEANUPS;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -151,7 +151,7 @@ CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent,
|
|||
case Stmt::UnaryTypeTraitExprClass:
|
||||
case Stmt::DependentScopeDeclRefExprClass:
|
||||
case Stmt::CXXBindTemporaryExprClass:
|
||||
case Stmt::CXXExprWithTemporariesClass:
|
||||
case Stmt::ExprWithCleanupsClass:
|
||||
case Stmt::CXXUnresolvedConstructExprClass:
|
||||
case Stmt::CXXDependentScopeMemberExprClass:
|
||||
case Stmt::UnresolvedMemberExprClass:
|
||||
|
|
Loading…
Reference in New Issue