From 0b65b1dc5abed26492740206c24e86271c9dca6b Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 17 Dec 2008 17:55:55 +0000 Subject: [PATCH] Consolidated property check into property-typecheck-1.m file. Improved on property diagnostics. Added a FIXME per Steve's comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61141 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/DeclObjC.h | 2 ++ include/clang/Basic/DiagnosticKinds.def | 2 +- test/SemaObjC/property-typecheck-1.m | 12 ++++++++++++ test/SemaObjC/property-typecheck-2.m | 12 ------------ 4 files changed, 15 insertions(+), 13 deletions(-) delete mode 100644 test/SemaObjC/property-typecheck-2.m diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index c9f5265542..1ccc8a5570 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -277,6 +277,8 @@ class ObjCInterfaceDecl : public NamedDecl, public DeclContext { Type *TypeForDecl; friend class ASTContext; + // FIXME: We should be able to get away with this slot by saving the + // record decl. build lazily in a map. RecordDecl *RecordForDecl; /// Class's super class. diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index 7beac265f7..1417b8acbd 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -457,7 +457,7 @@ DIAG(warn_objc_property_default_assign_on_object, WARNING, DIAG(err_objc_property_requires_object, ERROR, "property with '%0' attribute must be of object type") DIAG(err_property_type, ERROR, - "property cannot have type %0 (array or function type)") + "property cannot have array or function type %0") DIAG(err_objc_directive_only_in_protocol, ERROR, "directive may only be specified in protocols only") DIAG(err_missing_catch_finally, ERROR, diff --git a/test/SemaObjC/property-typecheck-1.m b/test/SemaObjC/property-typecheck-1.m index d5ee8d1b88..30d56081c5 100644 --- a/test/SemaObjC/property-typecheck-1.m +++ b/test/SemaObjC/property-typecheck-1.m @@ -17,3 +17,15 @@ } @end + +typedef int T[2]; +typedef void (F)(void); + +@interface C +@property(assign) T p2; // expected-error {{property cannot have array or function type 'T'}} + +@property(assign) F f2; // expected-error {{property cannot have array or function type 'F'}} + +@end + + diff --git a/test/SemaObjC/property-typecheck-2.m b/test/SemaObjC/property-typecheck-2.m deleted file mode 100644 index b8da661126..0000000000 --- a/test/SemaObjC/property-typecheck-2.m +++ /dev/null @@ -1,12 +0,0 @@ -// RUN: clang -fsyntax-only -verify %s - -typedef int T[2]; -typedef void (F)(void); - -@interface A -@property(assign) T p2; // expected-error {{property cannot have type 'T' (array or function type)}} - -@property(assign) F f2; // expected-error {{property cannot have type 'F' (array or function type)}} - -@end - -- 2.50.1