[cfe-commits] r61245 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/SemaExpr.cpp test/SemaObjC/property-missing.m
Anders Carlsson
andersca at mac.com
Fri Dec 19 09:28:07 PST 2008
Author: andersca
Date: Fri Dec 19 11:27:57 2008
New Revision: 61245
URL: http://llvm.org/viewvc/llvm-project?rev=61245&view=rev
Log:
Fix for PR3234
Added:
cfe/trunk/test/SemaObjC/property-missing.m
Modified:
cfe/trunk/include/clang/Basic/DiagnosticKinds.def
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=61245&r1=61244&r2=61245&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Fri Dec 19 11:27:57 2008
@@ -458,6 +458,8 @@
"property with '%0' attribute must be of object type")
DIAG(err_property_type, ERROR,
"property cannot have array or function type %0")
+DIAG(err_property_not_found, ERROR,
+ "property %0 not found on object of type %1")
DIAG(err_objc_directive_only_in_protocol, ERROR,
"directive may only be specified in protocols only")
DIAG(err_missing_catch_finally, ERROR,
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=61245&r1=61244&r2=61245&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Dec 19 11:27:57 2008
@@ -1348,6 +1348,9 @@
return new ObjCKVCRefExpr(Getter, Getter->getResultType(), Setter,
MemberLoc, BaseExpr);
}
+
+ return Diag(MemberLoc, diag::err_property_not_found) <<
+ &Member << BaseType;
}
// Handle properties on qualified "id" protocols.
const ObjCQualifiedIdType *QIdTy;
@@ -1364,6 +1367,9 @@
OpLoc, MemberLoc, NULL, 0);
}
}
+
+ return Diag(MemberLoc, diag::err_property_not_found) <<
+ &Member << BaseType;
}
// Handle 'field access' to vectors, such as 'V.xx'.
if (BaseType->isExtVectorType() && OpKind == tok::period) {
Added: cfe/trunk/test/SemaObjC/property-missing.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-missing.m?rev=61245&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/property-missing.m (added)
+++ cfe/trunk/test/SemaObjC/property-missing.m Fri Dec 19 11:27:57 2008
@@ -0,0 +1,22 @@
+// RUN: clang -fsyntax-only -verify %s
+
+// PR3234
+
+ at protocol NSCopying @end
+ at interface NSObject @end
+
+void f1(NSObject *o)
+{
+ o.foo; // expected-error{{property 'foo' not found on object of type 'NSObject *'}}
+}
+
+void f2(id<NSCopying> o)
+{
+ o.foo; // expected-error{{property 'foo' not found on object of type 'id<NSCopying>'}}
+}
+
+void f3(id o)
+{
+ o.foo; // expected-error{{member reference base type 'id' is not a structure or union}}
+}
+
More information about the cfe-commits
mailing list