summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-02-17 17:19:00 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-02-17 17:19:00 +0000
commit2eb74e278d44ee1336f4b27b5b0d4c12ec062405 (patch)
treecf7a86337cdd2ba716c99bd096f6f56ce214511f /clang/lib/Sema
parent5a5b21d5beb9d80e2dd307b38e9a2630bf7daecd (diff)
downloadbcm5719-llvm-2eb74e278d44ee1336f4b27b5b0d4c12ec062405.tar.gz
bcm5719-llvm-2eb74e278d44ee1336f4b27b5b0d4c12ec062405.zip
Correct more typos in conditional expressions
We didn't correctly handle some edge cases, causing us to bail out before correcting all the typos. llvm-svn: 261109
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 44a39d7cad7..5976c2c9f34 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -6838,8 +6838,23 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
// doesn't handle dependent types properly, so make sure any TypoExprs have
// been dealt with before checking the operands.
ExprResult CondResult = CorrectDelayedTyposInExpr(CondExpr);
- if (!CondResult.isUsable()) return ExprError();
+ ExprResult LHSResult = CorrectDelayedTyposInExpr(LHSExpr);
+ ExprResult RHSResult = CorrectDelayedTyposInExpr(RHSExpr);
+
+ if (!CondResult.isUsable())
+ return ExprError();
+
+ if (LHSExpr) {
+ if (!LHSResult.isUsable())
+ return ExprError();
+ }
+
+ if (!RHSResult.isUsable())
+ return ExprError();
+
CondExpr = CondResult.get();
+ LHSExpr = LHSResult.get();
+ RHSExpr = RHSResult.get();
}
// If this is the gnu "x ?: y" extension, analyze the types as though the LHS
OpenPOWER on IntegriCloud