summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorAlexander Shaposhnikov <shal1t712@gmail.com>2017-06-26 23:02:27 +0000
committerAlexander Shaposhnikov <shal1t712@gmail.com>2017-06-26 23:02:27 +0000
commit623513742c068bf463e8287d91ba42bc2fe2e3ef (patch)
treecbc98738c00ddba3045fa9f104a242df256d354c /clang/lib/Sema
parent01676883cd6b4016c3d4b8cc2761f6a1f3ea2ea2 (diff)
downloadbcm5719-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/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index b794628db73..5201796adbb 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6000,6 +6000,7 @@ shouldNotPrintDirectly(const ASTContext &Context,
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)
OpenPOWER on IntegriCloud