annotate clang/test/FixIt/format-no-fixit.m @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -fdiagnostics-parseable-fixits -fsyntax-only %s 2>&1 | FileCheck %s
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 // CHECK-NOT: fix-it:
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 @class NSString;
anatofuz
parents:
diff changeset
7 extern void NSLog(NSString *format, ...);
anatofuz
parents:
diff changeset
8 int printf(const char * restrict, ...) ;
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 void test_object_correction (id x) {
anatofuz
parents:
diff changeset
12 printf("%d", x); // expected-warning{{format specifies type 'int' but the argument has type 'id'}}
anatofuz
parents:
diff changeset
13 printf("%s", x); // expected-warning{{format specifies type 'char *' but the argument has type 'id'}}
anatofuz
parents:
diff changeset
14 printf("%lf", x); // expected-warning{{format specifies type 'double' but the argument has type 'id'}}
anatofuz
parents:
diff changeset
15 }
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 // Old-style Core Foundation types do not have __attribute__((NSObject)).
anatofuz
parents:
diff changeset
19 // This is okay, but we won't suggest a fixit; arbitrary structure pointers may
anatofuz
parents:
diff changeset
20 // not be objects.
anatofuz
parents:
diff changeset
21 typedef const struct __CFString * CFStringRef;
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 void test_cf_object_correction (CFStringRef x) {
anatofuz
parents:
diff changeset
24 NSLog(@"%@", x); // no-warning
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 NSLog(@"%d", x); // expected-warning{{format specifies type 'int' but the argument has type 'CFStringRef'}}
anatofuz
parents:
diff changeset
27 NSLog(@"%s", x); // expected-warning{{format specifies type 'char *' but the argument has type 'CFStringRef'}}
anatofuz
parents:
diff changeset
28 NSLog(@"%lf", x); // expected-warning{{format specifies type 'double' but the argument has type 'CFStringRef'}}
anatofuz
parents:
diff changeset
29 }
anatofuz
parents:
diff changeset
30