1// RUN: %clang_cc1 -fsyntax-only -verify %s
2// RUN: %clang_cc1 -fdiagnostics-parseable-fixits -fsyntax-only %s 2>&1 | FileCheck %s
3
4// CHECK-NOT: fix-it:
5
6@class NSString;
7extern void NSLog(NSString *format, ...);
8int printf(const char * restrict, ...) ;
9
10
11void test_object_correction (id x) {
12  printf("%d", x); // expected-warning{{format specifies type 'int' but the argument has type 'id'}}
13  printf("%s", x); // expected-warning{{format specifies type 'char *' but the argument has type 'id'}}
14  printf("%lf", x); // expected-warning{{format specifies type 'double' but the argument has type 'id'}}
15}
16
17
18// Old-style Core Foundation types do not have __attribute__((NSObject)).
19// This is okay, but we won't suggest a fixit; arbitrary structure pointers may
20// not be objects.
21typedef const struct __CFString * CFStringRef;
22
23void test_cf_object_correction (CFStringRef x) {
24  NSLog(@"%@", x); // no-warning
25
26  NSLog(@"%d", x); // expected-warning{{format specifies type 'int' but the argument has type 'CFStringRef'}}
27  NSLog(@"%s", x); // expected-warning{{format specifies type 'char *' but the argument has type 'CFStringRef'}}
28  NSLog(@"%lf", x); // expected-warning{{format specifies type 'double' but the argument has type 'CFStringRef'}}
29}
30
31