diff options
-rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 10 | ||||
-rw-r--r-- | clang/test/SemaCXX/typo-correction.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaObjC/typo-correction-subscript.m | 15 |
3 files changed, 19 insertions, 8 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 4039df888ad..b8f3288284f 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -1582,7 +1582,9 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { SourceLocation RLoc = Tok.getLocation(); - ExprResult OrigLHS = LHS; + LHS = Actions.CorrectDelayedTyposInExpr(LHS); + Idx = Actions.CorrectDelayedTyposInExpr(Idx); + Length = Actions.CorrectDelayedTyposInExpr(Length); if (!LHS.isInvalid() && !Idx.isInvalid() && !Length.isInvalid() && Tok.is(tok::r_square)) { if (ColonLoc.isValid()) { @@ -1594,12 +1596,6 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { } } else { LHS = ExprError(); - } - if (LHS.isInvalid()) { - (void)Actions.CorrectDelayedTyposInExpr(OrigLHS); - (void)Actions.CorrectDelayedTyposInExpr(Idx); - (void)Actions.CorrectDelayedTyposInExpr(Length); - LHS = ExprError(); Idx = ExprError(); } diff --git a/clang/test/SemaCXX/typo-correction.cpp b/clang/test/SemaCXX/typo-correction.cpp index 0b520e0af1d..aa5a45eafbf 100644 --- a/clang/test/SemaCXX/typo-correction.cpp +++ b/clang/test/SemaCXX/typo-correction.cpp @@ -678,7 +678,7 @@ namespace { struct a0is0 {}; struct b0is0 {}; int g() { - 0 [ // expected-error {{subscripted value is not an array}} + 0 [ sizeof(c0is0)]; // expected-error {{use of undeclared identifier}} }; } diff --git a/clang/test/SemaObjC/typo-correction-subscript.m b/clang/test/SemaObjC/typo-correction-subscript.m new file mode 100644 index 00000000000..19eb860f2b2 --- /dev/null +++ b/clang/test/SemaObjC/typo-correction-subscript.m @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple i386-apple-macosx10.10 -fobjc-arc -fsyntax-only -Wno-objc-root-class %s -verify -disable-free + +@class Dictionary; + +@interface Test +@end +@implementation Test +// rdar://problem/47403222 +- (void)rdar47403222:(Dictionary *)opts { + [self undeclaredMethod:undeclaredArg]; + // expected-error@-1{{no visible @interface for 'Test' declares the selector 'undeclaredMethod:'}} + opts[(__bridge id)undeclaredKey] = 0; + // expected-error@-1{{use of undeclared identifier 'undeclaredKey'}} +} +@end |