forked from OSchip/llvm-project
Improve recovery when the middle expression of a ternary operator is ill-formed
llvm-svn: 114231
This commit is contained in:
parent
7a6c37d3e7
commit
ec06c124f1
|
@ -291,8 +291,10 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) {
|
|||
// 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]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue