[cfe-commits] r114231 - in /cfe/trunk: lib/Parse/ParseExpr.cpp test/Index/complete-recovery.m
Douglas Gregor
dgregor at apple.com
Fri Sep 17 15:41:35 PDT 2010
Author: dgregor
Date: Fri Sep 17 17:41:34 2010
New Revision: 114231
URL: http://llvm.org/viewvc/llvm-project?rev=114231&view=rev
Log:
Improve recovery when the middle expression of a ternary operator is ill-formed
Modified:
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/test/Index/complete-recovery.m
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=114231&r1=114230&r2=114231&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Fri Sep 17 17:41:34 2010
@@ -291,8 +291,10 @@
// In particular, the RHS of the '?' is 'expression', not
// 'logical-OR-expression' as we might expect.
TernaryMiddle = ParseExpression();
- if (TernaryMiddle.isInvalid())
- return move(TernaryMiddle);
+ if (TernaryMiddle.isInvalid()) {
+ LHS = ExprError();
+ TernaryMiddle = 0;
+ }
} else {
// Special case handling of "X ? Y : Z" where Y is empty:
// logical-OR-expression '?' ':' conditional-expression [GNU]
Modified: cfe/trunk/test/Index/complete-recovery.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-recovery.m?rev=114231&r1=114230&r2=114231&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-recovery.m (original)
+++ cfe/trunk/test/Index/complete-recovery.m Fri Sep 17 17:41:34 2010
@@ -10,6 +10,7 @@
blarg * blah = wibble;
A *a2;
z = [a2 method:1];
+ blah ? blech : [a2 method:1];
}
@end
@@ -27,3 +28,4 @@
// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
// RUN: c-index-test -code-completion-at=%s:12:11 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (int)} (17)
+// RUN: c-index-test -code-completion-at=%s:13:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
More information about the cfe-commits
mailing list