From 2fce988e86bc01829142e4362d4eff1af0925147 Mon Sep 17 00:00:00 2001
From: rdivacky <rdivacky@FreeBSD.org>
Date: Sat, 23 Jan 2010 11:10:26 +0000
Subject: Update clang to r94309.

---
 test/SemaObjC/method-unused-attribute.m     | 15 ++++++++++++++
 test/SemaObjC/property-category-2.m         |  5 +++--
 test/SemaObjC/property-category-impl.m      | 31 +++++++++++++++++++++++++++++
 test/SemaObjC/property-user-setter.m        | 15 +++++++++++++-
 test/SemaObjC/property.m                    |  5 +++--
 test/SemaObjC/super.m                       |  7 +++++++
 test/SemaObjC/unimplemented-protocol-prop.m | 20 +++++++++++++++++++
 7 files changed, 93 insertions(+), 5 deletions(-)
 create mode 100644 test/SemaObjC/method-unused-attribute.m
 create mode 100644 test/SemaObjC/property-category-impl.m
 create mode 100644 test/SemaObjC/unimplemented-protocol-prop.m

(limited to 'test/SemaObjC')

diff --git a/test/SemaObjC/method-unused-attribute.m b/test/SemaObjC/method-unused-attribute.m
new file mode 100644
index 0000000..a4e5321
--- /dev/null
+++ b/test/SemaObjC/method-unused-attribute.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1  -fsyntax-only -Wunused-parameter -verify %s
+
+@interface INTF
+- (void) correct_use_of_unused: (void *) notice : (id)another_arg;
+- (void) will_warn_unused_arg: (void *) notice : (id)warn_unused;
+- (void) unused_attr_on_decl_ignored: (void *)  __attribute__((unused)) will_warn;
+@end
+
+@implementation INTF
+- (void) correct_use_of_unused: (void *)  __attribute__((unused)) notice : (id) __attribute__((unused)) newarg{
+}
+- (void) will_warn_unused_arg: (void *) __attribute__((unused))  notice : (id)warn_unused {}  // expected-warning {{unused parameter 'warn_unused'}}
+- (void) unused_attr_on_decl_ignored: (void *)  will_warn{}  // expected-warning {{unused parameter 'will_warn'}}
+@end
+
diff --git a/test/SemaObjC/property-category-2.m b/test/SemaObjC/property-category-2.m
index f258b2c..e63672b 100644
--- a/test/SemaObjC/property-category-2.m
+++ b/test/SemaObjC/property-category-2.m
@@ -4,7 +4,8 @@
 
 @protocol MyProtocol
 @property float  myFloat;
-@property float  anotherFloat;
+@property float  anotherFloat; // expected-warning {{property 'anotherFloat' requires method 'anotherFloat' to be defined - use @dynamic}} \
+                               // expected-warning {{property 'anotherFloat' requires method 'setAnotherFloat:' to be defined }}
 @end
 
 @interface MyObject { float anotherFloat; }
@@ -13,7 +14,7 @@
 @interface MyObject (CAT) <MyProtocol>
 @end
 
-@implementation MyObject (CAT)
+@implementation MyObject (CAT)	// expected-note 2 {{implementation is here}}
 @dynamic myFloat;	// OK
 @synthesize anotherFloat; // expected-error {{@synthesize not allowed in a category's implementation}}
 @end
diff --git a/test/SemaObjC/property-category-impl.m b/test/SemaObjC/property-category-impl.m
new file mode 100644
index 0000000..9979497
--- /dev/null
+++ b/test/SemaObjC/property-category-impl.m
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+/* This test is for categories which don't implement the accessors but some accessors are
+   implemented in their base class implementation. In this case,no warning must be issued.
+*/
+
+@interface MyClass 
+{
+    int        _foo;
+}
+@property(readonly)    int        foo;
+@end
+
+@implementation MyClass
+- (int) foo        { return _foo; }
+@end
+
+@interface MyClass (private)
+@property(readwrite)    int        foo;
+@end
+
+@implementation MyClass (private)
+- (void) setFoo:(int)foo    { _foo = foo; }
+@end
+
+@interface MyClass (public)
+@property(readwrite)    int        foo;	// expected-warning {{property 'foo' requires method 'setFoo:' to be defined }}
+@end
+
+@implementation MyClass (public)// expected-note {{implementation is here}}
+@end 
diff --git a/test/SemaObjC/property-user-setter.m b/test/SemaObjC/property-user-setter.m
index c06f2b6..babccee 100644
--- a/test/SemaObjC/property-user-setter.m
+++ b/test/SemaObjC/property-user-setter.m
@@ -80,11 +80,24 @@ static int g_val;
 }
 @end
 
+@interface C {}
+// - (int)Foo;
+- (void)setFoo:(int)value;
+@end
+
+void g(int);
+
+void f(C *c) {
+    c.Foo = 17; // expected-error {{property 'Foo' not found on object of type 'C *'}}
+    g(c.Foo); // expected-error {{property 'Foo' not found on object of type 'C *'}}
+}
+
+
 void abort(void);
 int main (void) {
     Subclass *x = [[Subclass alloc] init];
 
-    x.setterOnly = 4;
+    x.setterOnly = 4;  // expected-error {{property 'setterOnly' not found on object of type 'Subclass *'}}
     if (g_val != 4)
       abort ();
     return 0;
diff --git a/test/SemaObjC/property.m b/test/SemaObjC/property.m
index bc2056c..b7f0fca 100644
--- a/test/SemaObjC/property.m
+++ b/test/SemaObjC/property.m
@@ -11,7 +11,8 @@
 @end
 
 @interface I(CAT)
-@property int d1;
+@property int d1;	// expected-warning {{property 'd1' requires method 'd1' to be defined }} \
+			// expected-warning {{property 'd1' requires method 'setD1:' to be defined }}
 @end
 
 @implementation I
@@ -22,7 +23,7 @@
 @synthesize name;	// OK! property with same name as an accessible ivar of same name
 @end
 
-@implementation I(CAT)  
+@implementation I(CAT)  // expected-note 2 {{implementation is here}}
 @synthesize d1;		// expected-error {{@synthesize not allowed in a category's implementation}}
 @dynamic bad;		// expected-error {{property implementation must have its declaration in the category 'CAT'}}
 @end
diff --git a/test/SemaObjC/super.m b/test/SemaObjC/super.m
index 3b86972..a61d72f 100644
--- a/test/SemaObjC/super.m
+++ b/test/SemaObjC/super.m
@@ -39,3 +39,10 @@ void f0(int super) {
 void f1(int puper) {
   [super m]; // expected-error{{use of undeclared identifier 'super'}}
 }
+
+// radar 7400691
+typedef Foo super;
+
+void test() {
+  [super cMethod];
+}
diff --git a/test/SemaObjC/unimplemented-protocol-prop.m b/test/SemaObjC/unimplemented-protocol-prop.m
new file mode 100644
index 0000000..d3de50e
--- /dev/null
+++ b/test/SemaObjC/unimplemented-protocol-prop.m
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1  -fsyntax-only -verify %s
+
+@protocol PROTOCOL0
+@required
+@property float MyProperty0; // expected-warning {{property 'MyProperty0' requires method 'MyProperty0' to be defined }} \
+			     // expected-warning {{property 'MyProperty0' requires method 'setMyProperty0:' to be defined}}
+@end
+
+@protocol PROTOCOL<PROTOCOL0>
+@required
+@property float MyProperty; // expected-warning {{property 'MyProperty' requires method 'MyProperty' to be defined}} \
+			// expected-warning {{property 'MyProperty' requires method 'setMyProperty:' to be defined}}
+@optional
+@property float OptMyProperty;
+@end
+
+@interface I <PROTOCOL>
+@end
+
+@implementation I @end // expected-note 4 {{implementation is here}}
-- 
cgit v1.1