[cfe-commits] r62355 - in /cfe/trunk: lib/Sema/SemaExprObjC.cpp test/SemaObjC/invalid-receiver.m
Fariborz Jahanian
fjahanian at apple.com
Fri Jan 16 12:35:09 PST 2009
Author: fjahanian
Date: Fri Jan 16 14:35:09 2009
New Revision: 62355
URL: http://llvm.org/viewvc/llvm-project?rev=62355&view=rev
Log:
Don't ICE (issue diagnostics) when receiver is a non-objc
type.
Added:
cfe/trunk/test/SemaObjC/invalid-receiver.m
Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=62355&r1=62354&r2=62355&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Fri Jan 16 14:35:09 2009
@@ -239,8 +239,9 @@
if (TypedefDecl *OCTD = dyn_cast_or_null<TypedefDecl>(IDecl)) {
const ObjCInterfaceType *OCIT;
OCIT = OCTD->getUnderlyingType()->getAsObjCInterfaceType();
- if (OCIT)
- ClassDecl = OCIT->getDecl();
+ if (!OCIT)
+ return Diag(receiverLoc, diag::err_invalid_receiver_to_message);
+ ClassDecl = OCIT->getDecl();
}
}
assert(ClassDecl && "missing interface declaration");
Added: cfe/trunk/test/SemaObjC/invalid-receiver.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/invalid-receiver.m?rev=62355&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/invalid-receiver.m (added)
+++ cfe/trunk/test/SemaObjC/invalid-receiver.m Fri Jan 16 14:35:09 2009
@@ -0,0 +1,9 @@
+// RUN: clang -fsyntax-only -verify %s
+
+typedef struct NotAClass {
+ int a, b;
+} NotAClass;
+
+void foo() {
+ [NotAClass nonexistent_method]; // expected-error {{invalid receiver to message expression}}
+}
More information about the cfe-commits
mailing list