commit | 623513742c068bf463e8287d91ba42bc2fe2e3ef | [log] [tgz] |
---|---|---|
author | Alexander Shaposhnikov <shal1t712@gmail.com> | Mon Jun 26 23:02:27 2017 +0000 |
committer | Alexander Shaposhnikov <shal1t712@gmail.com> | Mon Jun 26 23:02:27 2017 +0000 |
tree | cbc98738c00ddba3045fa9f104a242df256d354c | |
parent | 01676883cd6b4016c3d4b8cc2761f6a1f3ea2ea2 [diff] [blame] |
[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
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index b794628..5201796 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6000,6 +6000,7 @@ while (const TypedefType *UserTy = TyTy->getAs<TypedefType>()) { StringRef Name = UserTy->getDecl()->getName(); QualType CastTy = llvm::StringSwitch<QualType>(Name) + .Case("CFIndex", Context.LongTy) .Case("NSInteger", Context.LongTy) .Case("NSUInteger", Context.UnsignedLongTy) .Case("SInt32", Context.IntTy)