r175282 - Fix crash-on-invalid where a ParenListExpr shows up as a message receiver
Argyrios Kyrtzidis
akyrtzi at gmail.com
Fri Feb 15 10:34:15 PST 2013
Author: akirtzidis
Date: Fri Feb 15 12:34:15 2013
New Revision: 175282
URL: http://llvm.org/viewvc/llvm-project?rev=175282&view=rev
Log:
Fix crash-on-invalid where a ParenListExpr shows up as a message receiver
while trying to do error recovery.
rdar://13207886
Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/SemaObjC/message.m
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=175282&r1=175281&r2=175282&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Fri Feb 15 12:34:15 2013
@@ -2485,6 +2485,13 @@ ExprResult Sema::ActOnInstanceMessage(Sc
MultiExprArg Args) {
if (!Receiver)
return ExprError();
+
+ // A ParenListExpr can show up while doing error recovery with invalid code.
+ if (isa<ParenListExpr>(Receiver)) {
+ ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Receiver);
+ if (Result.isInvalid()) return ExprError();
+ Receiver = Result.take();
+ }
if (RespondsToSelectorSel.isNull()) {
IdentifierInfo *SelectorId = &Context.Idents.get("respondsToSelector");
Modified: cfe/trunk/test/SemaObjC/message.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/message.m?rev=175282&r1=175281&r2=175282&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/message.m (original)
+++ cfe/trunk/test/SemaObjC/message.m Fri Feb 15 12:34:15 2013
@@ -98,3 +98,11 @@ void foo4() {
[X rect]; // expected-warning {{receiver type 'struct objc_object *' is not 'id' or interface pointer, consider casting it to 'id'}} expected-warning {{method '-rect' not found (return type defaults to 'id')}}
}
+// rdar://13207886
+void foo5(id p) {
+ p
+ [(id)(p) bar]; // expected-error {{missing '['}} \
+ // expected-error {{expected ']'}} \
+ // expected-note {{to match this '['}} \
+ // expected-warning {{instance method '-bar' not found}}
+}
More information about the cfe-commits
mailing list