diff options
author | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-06-26 23:02:27 +0000 |
---|---|---|
committer | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-06-26 23:02:27 +0000 |
commit | 623513742c068bf463e8287d91ba42bc2fe2e3ef (patch) | |
tree | cbc98738c00ddba3045fa9f104a242df256d354c /clang/test/FixIt/fixit-format-darwin.m | |
parent | 01676883cd6b4016c3d4b8cc2761f6a1f3ea2ea2 (diff) | |
download | bcm5719-llvm-623513742c068bf463e8287d91ba42bc2fe2e3ef.tar.gz bcm5719-llvm-623513742c068bf463e8287d91ba42bc2fe2e3ef.zip |
[clang] Enable printf check for CFIndex
According to
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
CFIndex and NSInteger should be treated the same way (see the section Platform Dependencies).
This diff changes the function shouldNotPrintDirectly in SemaChecking.cpp accordingly
and adds tests for the "fixit" and the warning.
Differential revision: https://reviews.llvm.org/D34496
Test plan: make check-all
llvm-svn: 306343
Diffstat (limited to 'clang/test/FixIt/fixit-format-darwin.m')
-rw-r--r-- | clang/test/FixIt/fixit-format-darwin.m | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/FixIt/fixit-format-darwin.m b/clang/test/FixIt/fixit-format-darwin.m index 077cc0cf21b..54d25d92c2b 100644 --- a/clang/test/FixIt/fixit-format-darwin.m +++ b/clang/test/FixIt/fixit-format-darwin.m @@ -8,12 +8,15 @@ int printf(const char * restrict, ...); #if __LP64__ +typedef long CFIndex; typedef long NSInteger; typedef unsigned long NSUInteger; #else +typedef int CFIndex; typedef int NSInteger; typedef unsigned int NSUInteger; #endif +CFIndex getCFIndex(); NSInteger getNSInteger(); NSUInteger getNSUInteger(); @@ -74,3 +77,10 @@ void bug33447() { Outer2("test 9: %s %s", getNSInteger(), getNSInteger()); // CHECK: Outer2("test 9: %ld %ld", (long)getNSInteger(), (long)getNSInteger()); } + +void testCFIndex() { + printf("test 10: %s", getCFIndex()); + // CHECK: printf("test 10: %ld", (long)getCFIndex()); + printf("test 11: %s %s", getCFIndex(), getCFIndex()); + // CHECK: printf("test 11: %ld %ld", (long)getCFIndex(), (long)getCFIndex()); +} |