aboutsummaryrefslogtreecommitdiff
path: root/test/FixIt/fixit-objc.m
blob: 21aebfe3a968b0ad6dd2a9051ef93a3efd9da7f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// RUN: clang-cc -pedantic -fixit %s -o %t
// RUN: clang-cc -pedantic -x objective-c %t -verify

/* This is a test of the various code modification hints that are
   provided as part of warning or extension diagnostics. All of the
   warnings will be fixed by -fixit, and the resulting file should
   compile cleanly with -Werror -pedantic. */

@protocol X;

void foo() {
  <X> *P;    // should be fixed to 'id<X>'.
}

@class A;
@class NSString;

@interface Test
- (void)test:(NSString *)string;

@property (copy) NSString *property;
@end

void g(NSString *a);
void h(id a);

void f(Test *t) {
  NSString *a = "Foo";
  id b = "Foo";
  A* c = "Foo"; // expected-warning {{incompatible pointer types initializing 'char [4]', expected 'A *'}}
  g("Foo");
  h("Foo");
  h(("Foo"));
  [t test:"Foo"];
  t.property = "Foo";
}