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