diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-07-01 13:24:05 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-07-01 13:24:05 +0000 |
commit | cf1b401909b5e54edfd80656b1a18eaa31f9f6f1 (patch) | |
tree | edb0ffff2a43d84ba9b4c862b394cfeeebb36ddc /test/FixIt/format-darwin.m | |
parent | ef915aab0ac566c55bfb0d7a9f6635bb5d94d4af (diff) | |
download | src-test2-cf1b401909b5e54edfd80656b1a18eaa31f9f6f1.tar.gz src-test2-cf1b401909b5e54edfd80656b1a18eaa31f9f6f1.zip |
Vendor import of clang trunk r306956:vendor/clang/clang-trunk-r306956
Notes
Notes:
svn path=/vendor/clang/dist/; revision=320535
svn path=/vendor/clang/clang-trunk-r306956/; revision=320536; tag=vendor/clang/clang-trunk-r306956
Diffstat (limited to 'test/FixIt/format-darwin.m')
-rw-r--r-- | test/FixIt/format-darwin.m | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/FixIt/format-darwin.m b/test/FixIt/format-darwin.m index 170bb09fb904..fcc81036fcf3 100644 --- a/test/FixIt/format-darwin.m +++ b/test/FixIt/format-darwin.m @@ -7,13 +7,14 @@ int printf(const char * restrict, ...); #if __LP64__ +typedef long CFIndex; typedef long NSInteger; typedef unsigned long NSUInteger; typedef int SInt32; typedef unsigned int UInt32; #else - +typedef int CFIndex; typedef int NSInteger; typedef unsigned int NSUInteger; typedef long SInt32; @@ -27,6 +28,7 @@ typedef enum NSIntegerEnum : NSInteger { EnumValueB } NSIntegerEnum; +CFIndex getCFIndex(); NSInteger getNSInteger(); NSUInteger getNSUInteger(); SInt32 getSInt32(); @@ -55,6 +57,11 @@ void testCorrectionInAllCases() { // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:11-[[@LINE-2]]:13}:"%ld" // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:16-[[@LINE-3]]:16}:"(long)" + + printf("%s", getCFIndex()); // expected-warning{{values of type 'CFIndex' should not be used as format arguments; add an explicit cast to 'long' instead}} + + // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:11-[[@LINE-2]]:13}:"%ld" + // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:16-[[@LINE-3]]:16}:"(long)" } @interface Foo { @@ -120,6 +127,11 @@ void testWarn() { // CHECK-64: fix-it:"{{.*}}":{[[@LINE-2]]:11-[[@LINE-2]]:13}:"%ld" // CHECK-64: fix-it:"{{.*}}":{[[@LINE-3]]:16-[[@LINE-3]]:16}:"(long)" + + printf("%d", getCFIndex()); // expected-warning{{values of type 'CFIndex' should not be used as format arguments; add an explicit cast to 'long' instead}} + + // CHECK-64: fix-it:"{{.*}}":{[[@LINE-2]]:11-[[@LINE-2]]:13}:"%ld" + // CHECK-64: fix-it:"{{.*}}":{[[@LINE-3]]:16-[[@LINE-3]]:16}:"(long)" } void testPreserveHex() { @@ -167,6 +179,10 @@ void testWarn() { printf("%ld", getNSIntegerEnum()); // expected-warning{{enum values with underlying type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead}} // CHECK-32: fix-it:"{{.*}}":{[[@LINE-2]]:17-[[@LINE-2]]:17}:"(long)" + + printf("%ld", getCFIndex()); // expected-warning{{values of type 'CFIndex' should not be used as format arguments; add an explicit cast to 'long' instead}} + + // CHECK-32: fix-it:"{{.*}}":{[[@LINE-2]]:17-[[@LINE-2]]:17}:"(long)" } void testPreserveHex() { @@ -218,6 +234,11 @@ void testCasts() { // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:11-[[@LINE-2]]:13}:"%ld" // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:16-[[@LINE-3]]:31}:"(long)" + + printf("%s", (CFIndex)0); // expected-warning{{values of type 'CFIndex' should not be used as format arguments; add an explicit cast to 'long' instead}} + + // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:11-[[@LINE-2]]:13}:"%ld" + // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:16-[[@LINE-3]]:25}:"(long)" } void testCapitals() { |