]> granicus.if.org Git - clang/commit
[clang] Fix printf fixit for objc specific types
authorAlexander Shaposhnikov <shal1t712@gmail.com>
Fri, 22 Sep 2017 18:36:06 +0000 (18:36 +0000)
committerAlexander Shaposhnikov <shal1t712@gmail.com>
Fri, 22 Sep 2017 18:36:06 +0000 (18:36 +0000)
commitcc76a8176ee9da9a1c3a5ede43d606b9c727b1ce
tree46f898a8714926bac9e6c58d34fc02c1de10405c
parentda4e89c8477c389ad03d1ba659bbfa23df1584cd
[clang] Fix printf fixit for objc specific types

For the triple thumbv7-apple-ios8.0.0 ssize_t is long and size_t is unsigned long,
while NSInteger is int and NSUinteger is unsigned int. Following
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
Clang catches it and insert a cast to long, for example
 printf("%zd", getNSInteger())
will be replaced with
 printf("%zd", (long)getNSInteger())
but since the underlying type of ssize_t is long the specifier "%zd" is not getting replaced.
This diff changes this behavior to enable replacing the specifier "%zd" with the correct one.

Differential revision: https://reviews.llvm.org/D38159

Test plan: make check-all

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314011 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaChecking.cpp
test/FixIt/fixit-format-ios.m [new file with mode: 0644]