Nick Lewycky | ba5f6ec | 2010-04-24 01:30:46 +0000 | [diff] [blame] | 1 | // RUN: cp %s %t |
| 2 | // RUN: %clang_cc1 -pedantic -fixit -x objective-c %t |
| 3 | // RUN: %clang_cc1 -pedantic -verify -x objective-c %t |
Anders Carlsson | b76cd3d | 2009-11-10 04:46:30 +0000 | [diff] [blame] | 4 | |
| 5 | /* This is a test of the various code modification hints that are |
| 6 | provided as part of warning or extension diagnostics. All of the |
| 7 | warnings will be fixed by -fixit, and the resulting file should |
| 8 | compile cleanly with -Werror -pedantic. */ |
Chris Lattner | 75e3606 | 2009-04-03 18:38:42 +0000 | [diff] [blame] | 9 | |
| 10 | @protocol X; |
| 11 | |
| 12 | void foo() { |
| 13 | <X> *P; // should be fixed to 'id<X>'. |
| 14 | } |
Anders Carlsson | b76cd3d | 2009-11-10 04:46:30 +0000 | [diff] [blame] | 15 | |
| 16 | @class A; |
| 17 | @class NSString; |
| 18 | |
| 19 | @interface Test |
| 20 | - (void)test:(NSString *)string; |
| 21 | |
| 22 | @property (copy) NSString *property; |
| 23 | @end |
| 24 | |
| 25 | void g(NSString *a); |
| 26 | void h(id a); |
| 27 | |
| 28 | void f(Test *t) { |
| 29 | NSString *a = "Foo"; |
| 30 | id b = "Foo"; |
Douglas Gregor | 08a4190 | 2010-04-09 17:53:29 +0000 | [diff] [blame] | 31 | A* c = "Foo"; // expected-warning {{incompatible pointer types initializing 'A *' with an expression of type 'char [4]'}} |
Anders Carlsson | b76cd3d | 2009-11-10 04:46:30 +0000 | [diff] [blame] | 32 | g("Foo"); |
| 33 | h("Foo"); |
| 34 | h(("Foo")); |
| 35 | [t test:"Foo"]; |
| 36 | t.property = "Foo"; |
| 37 | } |