1 // RUN: %clang_cc1 -pedantic -verify %s
3 // RUN: not %clang_cc1 -pedantic -fixit -x objective-c %t
4 // RUN: %clang_cc1 -pedantic -Werror -x objective-c %t
6 /* This is a test of the various code modification hints that are
7 provided as part of warning or extension diagnostics. All of the
8 warnings will be fixed by -fixit, and the resulting file should
9 compile cleanly with -Werror -pedantic. */
14 <X> *P; // expected-warning{{protocol has no object type specified; defaults to qualified 'id'}}
21 - (void)test:(NSString *)string;
23 @property (copy) NSString *property;
30 NSString *a = "Foo"; // expected-error {{string literal must be prefixed by '@'}}
31 id b = "Foo"; // expected-error {{string literal must be prefixed by '@'}}
32 g("Foo"); // expected-error {{string literal must be prefixed by '@'}}
33 h("Foo"); // expected-error {{string literal must be prefixed by '@'}}
34 h(("Foo")); // expected-error {{string literal must be prefixed by '@'}}
35 [t test:"Foo"]; // expected-error {{string literal must be prefixed by '@'}}
36 t.property = "Foo"; // expected-error {{string literal must be prefixed by '@'}}
38 [t test:@"Foo"]]; // expected-error{{extraneous ']' before ';'}}
39 g(@"Foo")); // expected-error{{extraneous ')' before ';'}}
42 @interface Radar7861841 {
47 @property (assign) int y;
50 int f0(Radar7861841 *a) { return a.x; } // expected-error {{property 'x' not found on object of type 'Radar7861841 *'; did you mean to access instance variable 'x'}}
52 int f1(Radar7861841 *a) { return a->y; } // expected-error {{property 'y' found on object of type 'Radar7861841 *'; did you mean to access it with the "." operator?}}
55 #define nil ((void*)0)
56 #define NULL ((void*)0)
58 void sentinel(int x, ...) __attribute__((sentinel)); // expected-note{{function has been explicitly marked sentinel here}}
61 - (void)sentinel:(int)x, ... __attribute__((sentinel)); // expected-note{{method has been explicitly marked sentinel here}}
64 void sentinel_test(Sentinel *a) {
65 sentinel(1, 2, 3); // expected-warning{{missing sentinel in function call}}
66 [a sentinel:1, 2, 3]; // expected-warning{{missing sentinel in method dispatch}}
70 @property (class) int c;
74 return a.c; // expected-error {{property 'c' is a class property; did you mean to access it with class 'A'}}