summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-06-23 18:11:15 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-06-23 18:11:15 +0000
commitb77ebd749af6171a565c19139849fc7d8d4209e4 (patch)
tree124ac4e509017b031febc648fd1cd2d9d0ac75e9 /clang/lib/Sema/SemaExpr.cpp
parent38bb1c15fdf76ab0632c0062d06867cb6c93c7af (diff)
downloadbcm5719-llvm-b77ebd749af6171a565c19139849fc7d8d4209e4.tar.gz
bcm5719-llvm-b77ebd749af6171a565c19139849fc7d8d4209e4.zip
Revert r273548, "Rearrange condition handling so that semantic checks on a condition variable"
as it caused a regression in -Wfor-loop-analysis. llvm-svn: 273589
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index f975b817e00..755d99d54b3 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -14341,7 +14341,7 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *ParenE) {
}
}
-ExprResult Sema::CheckBooleanCondition(SourceLocation Loc, Expr *E) {
+ExprResult Sema::CheckBooleanCondition(Expr *E, SourceLocation Loc) {
DiagnoseAssignmentAsCondition(E);
if (ParenExpr *parenE = dyn_cast<ParenExpr>(E))
DiagnoseEqualityWithExtraParens(parenE);
@@ -14371,26 +14371,12 @@ ExprResult Sema::CheckBooleanCondition(SourceLocation Loc, Expr *E) {
return E;
}
-Sema::ConditionResult Sema::ActOnCondition(Scope *S, SourceLocation Loc,
- Expr *SubExpr, ConditionKind CK) {
- // Empty conditions are valid in for-statements.
+ExprResult Sema::ActOnBooleanCondition(Scope *S, SourceLocation Loc,
+ Expr *SubExpr) {
if (!SubExpr)
- return ConditionResult();
-
- ExprResult Cond;
- switch (CK) {
- case ConditionKind::Boolean:
- Cond = CheckBooleanCondition(Loc, SubExpr);
- break;
-
- case ConditionKind::Switch:
- Cond = CheckSwitchCondition(Loc, SubExpr);
- break;
- }
- if (Cond.isInvalid())
- return ConditionError();
+ return ExprError();
- return ConditionResult(nullptr, MakeFullExpr(Cond.get(), Loc));
+ return CheckBooleanCondition(SubExpr, Loc);
}
namespace {
OpenPOWER on IntegriCloud