summaryrefslogtreecommitdiff
path: root/test/FixIt/fixit-objc.m
blob: 665ac74441ae65bc98a184c4106024297aa14ba3 (plain)
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_cc1 -pedantic -fixit %s -o %t
// RUN: %clang_cc1 -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";
}