diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-20 21:33:39 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-20 21:33:39 +0000 |
commit | e5deae9555f097e8418583d8265ec6f333f48210 (patch) | |
tree | cf1acb55948cc6de8c23a093f0bdb6c7f3de05c5 | |
parent | 02418c7f0cb8bb83f1a1a1fad9bf6104efa83e0e (diff) |
fix the ?: fixit that ted added to recover properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101943 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseExpr.cpp | 10 | ||||
-rw-r--r-- | test/FixIt/fixit.c | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index ee714e8e24..27696c438f 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -335,15 +335,15 @@ Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, unsigned MinPrec) { Diag(Tok, diag::ext_gnu_conditional_expr); } - if (Tok.isNot(tok::colon)) { + if (Tok.is(tok::colon)) { + // Eat the colon. + ColonLoc = ConsumeToken(); + } else { Diag(Tok, diag::err_expected_colon) << FixItHint::CreateInsertion(Tok.getLocation(), ": "); Diag(OpToken, diag::note_matching) << "?"; - return ExprError(); + ColonLoc = Tok.getLocation(); } - - // Eat the colon. - ColonLoc = ConsumeToken(); } // Parse another leaf here for the RHS of the operator. diff --git a/test/FixIt/fixit.c b/test/FixIt/fixit.c index 4c506df016..9f858524c2 100644 --- a/test/FixIt/fixit.c +++ b/test/FixIt/fixit.c @@ -31,8 +31,8 @@ void f1(x, y) int i0 = { 17 }; -int test_cond(int y) { -// CHECK: int x = y ? 1 : 2; - int x = y ? 1 2; +int test_cond(int y, int fooBar) { +// CHECK: int x = y ? 1 : 4+fooBar; + int x = y ? 1 4+foobar; return x; } |