[cfe-commits] r99210 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExprObjC.cpp test/SemaObjC/property-expression-error.m
Fariborz Jahanian
fjahanian at apple.com
Mon Mar 22 14:02:34 PDT 2010
Author: fjahanian
Date: Mon Mar 22 16:02:34 2010
New Revision: 99210
URL: http://llvm.org/viewvc/llvm-project?rev=99210&view=rev
Log:
Diagnose miuse of property dot-syntax instead of crashing.
(radar 7634653).
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/SemaObjC/property-expression-error.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=99210&r1=99209&r2=99210&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Mar 22 16:02:34 2010
@@ -2332,6 +2332,7 @@
def err_incomplete_type_used_in_type_trait_expr : Error<
"incomplete type %0 used in type trait expression">;
+def err_expected_ident_or_lparen : Error<"expected identifier or '('">;
// inline asm.
def err_asm_wide_character : Error<"wide string is invalid in 'asm'">;
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=99210&r1=99209&r2=99210&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Mon Mar 22 16:02:34 2010
@@ -289,7 +289,10 @@
IdentifierInfo *receiverNamePtr = &receiverName;
ObjCInterfaceDecl *IFace = getObjCInterfaceDecl(receiverNamePtr);
-
+ if (!IFace) {
+ Diag(receiverNameLoc, diag::err_expected_ident_or_lparen);
+ return ExprError();
+ }
// Search for a declared property first.
Selector Sel = PP.getSelectorTable().getNullarySelector(&propertyName);
Modified: cfe/trunk/test/SemaObjC/property-expression-error.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-expression-error.m?rev=99210&r1=99209&r2=99210&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-expression-error.m (original)
+++ cfe/trunk/test/SemaObjC/property-expression-error.m Mon Mar 22 16:02:34 2010
@@ -16,3 +16,8 @@
&object.index; // expected-error {{address of property expression requested}}
return 0;
}
+
+typedef int Foo;
+void test() {
+ Foo.x; // expected-error {{expected identifier or '('}}
+}
More information about the cfe-commits
mailing list