Fixed DISABLE_SMART_POINTERS breakage

llvm-svn: 103198
This commit is contained in:
Douglas Gregor
2010-05-06 21:39:56 +00:00
parent 66bfb27545
commit 12cc7eeb82
6 changed files with 27 additions and 16 deletions

View File

@@ -166,7 +166,7 @@ namespace llvm {
// conversions.
// Flip this switch to measure performance impact of the smart pointers.
//#define DISABLE_SMART_POINTERS
// #define DISABLE_SMART_POINTERS
namespace llvm {
template<>

View File

@@ -989,6 +989,7 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
bool ForEach = false;
OwningStmtResult FirstPart(Actions);
bool SecondPartIsInvalid = false;
FullExprArg SecondPart(Actions);
OwningExprResult Collection(Actions);
FullExprArg ThirdPart(Actions);
@@ -1062,13 +1063,14 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
Second = Actions.ActOnBooleanCondition(CurScope, ForLoc,
move(Second));
}
SecondPartIsInvalid = Second.isInvalid();
SecondPart = Actions.MakeFullExpr(Second);
}
if (Tok.is(tok::semi)) {
ConsumeToken();
} else {
if (!SecondPart->isInvalid() || SecondVar.get())
if (!SecondPartIsInvalid || SecondVar.get())
Diag(Tok, diag::err_expected_semi_for);
SkipUntil(tok::semi);
}

View File

@@ -7697,10 +7697,10 @@ bool Sema::CheckBooleanCondition(Expr *&E, SourceLocation Loc) {
Sema::OwningExprResult Sema::ActOnBooleanCondition(Scope *S, SourceLocation Loc,
ExprArg SubExpr) {
if (SubExpr.isInvalid())
Expr *Sub = SubExpr.takeAs<Expr>();
if (!Sub)
return ExprError();
Expr *Sub = SubExpr.takeAs<Expr>();
if (CheckBooleanCondition(Sub, Loc)) {
Sub->Destroy(Context);
return ExprError();

View File

@@ -2949,12 +2949,11 @@ CXXMemberCallExpr *Sema::BuildCXXMemberCallExpr(Expr *Exp,
}
Sema::OwningExprResult Sema::ActOnFinishFullExpr(ExprArg Arg) {
if (Arg.isInvalid())
return ExprError();
Expr *FullExpr = Arg.takeAs<Expr>();
if (FullExpr)
FullExpr = MaybeCreateCXXExprWithTemporaries(FullExpr);
else
return ExprError();
return Owned(FullExpr);
}

View File

@@ -524,9 +524,11 @@ Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, ExprArg Cond,
VarDecl *ConditionVar = 0;
if (CondVar.get()) {
ConditionVar = CondVar.getAs<VarDecl>();
Cond = CheckConditionVariable(ConditionVar, SourceLocation(), false);
if (Cond.isInvalid())
OwningExprResult CondE = CheckConditionVariable(ConditionVar, SourceLocation(), false);
if (CondE.isInvalid())
return StmtError();
Cond = move(CondE);
}
Expr *CondExpr = Cond.takeAs<Expr>();

View File

@@ -763,9 +763,12 @@ public:
SourceLocation ElseLoc, StmtArg Else) {
if (Cond.get()) {
// Convert the condition to a boolean value.
Cond = getSema().ActOnBooleanCondition(0, IfLoc, move(Cond));
if (Cond.isInvalid())
OwningExprResult CondE = getSema().ActOnBooleanCondition(0, IfLoc,
move(Cond));
if (CondE.isInvalid())
return getSema().StmtError();
Cond = move(CondE);
}
Sema::FullExprArg FullCond(getSema().MakeFullExpr(Cond));
@@ -804,9 +807,11 @@ public:
StmtArg Body) {
if (Cond.get()) {
// Convert the condition to a boolean value.
Cond = getSema().ActOnBooleanCondition(0, WhileLoc, move(Cond));
if (Cond.isInvalid())
OwningExprResult CondE = getSema().ActOnBooleanCondition(0, WhileLoc,
move(Cond));
if (CondE.isInvalid())
return getSema().StmtError();
Cond = move(CondE);
}
Sema::FullExprArg FullCond(getSema().MakeFullExpr(Cond));
@@ -838,9 +843,12 @@ public:
SourceLocation RParenLoc, StmtArg Body) {
if (Cond.get()) {
// Convert the condition to a boolean value.
Cond = getSema().ActOnBooleanCondition(0, ForLoc, move(Cond));
if (Cond.isInvalid())
OwningExprResult CondE = getSema().ActOnBooleanCondition(0, ForLoc,
move(Cond));
if (CondE.isInvalid())
return getSema().StmtError();
Cond = move(CondE);
}
Sema::FullExprArg FullCond(getSema().MakeFullExpr(Cond));