[cfe-commits] r101943 - in /cfe/trunk: lib/Parse/ParseExpr.cpp test/FixIt/fixit.c
Chris Lattner
sabre at nondot.org
Tue Apr 20 14:33:39 PDT 2010
Author: lattner
Date: Tue Apr 20 16:33:39 2010
New Revision: 101943
URL: http://llvm.org/viewvc/llvm-project?rev=101943&view=rev
Log:
fix the ?: fixit that ted added to recover properly.
Modified:
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/test/FixIt/fixit.c
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=101943&r1=101942&r2=101943&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Tue Apr 20 16:33:39 2010
@@ -335,15 +335,15 @@
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.
Modified: cfe/trunk/test/FixIt/fixit.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit.c?rev=101943&r1=101942&r2=101943&view=diff
==============================================================================
--- cfe/trunk/test/FixIt/fixit.c (original)
+++ cfe/trunk/test/FixIt/fixit.c Tue Apr 20 16:33:39 2010
@@ -31,8 +31,8 @@
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;
}
More information about the cfe-commits
mailing list