llvm-project/clang/lib/Analysis
JF Bastien ec7d7f312e [Sema] -Wformat-pedantic only for NSInteger/NSUInteger %zu/%zi on Darwin
Summary:
Pick D42933 back up, and make NSInteger/NSUInteger with %zu/%zi specifiers on Darwin warn only in pedantic mode. The default -Wformat recently started warning for the following code because of the added support for analysis for the '%zi' specifier.

     NSInteger i = NSIntegerMax;
     NSLog(@"max NSInteger = %zi", i);

The problem is that on armv7 %zi is 'long', and NSInteger is typedefed to 'int' in Foundation. We should avoid this warning as it's inconvenient to our users: it's target specific (happens only on armv7 and not arm64), and breaks their existing code. We should also silence the warning for the '%zu' specifier to ensure consistency. This is acceptable because Darwin guarantees that, despite the unfortunate choice of typedef, sizeof(size_t) == sizeof(NS[U]Integer), the warning is therefore noisy for pedantic reasons. Once this is in I'll update public documentation.

Related discussion on cfe-dev:
http://lists.llvm.org/pipermail/cfe-dev/2018-May/058050.html

<rdar://36874921&40501559>

Reviewers: ahatanak, vsapsai, alexshap, aaron.ballman, javed.absar, jfb, rjmccall

Subscribers: kristof.beyls, aheejin, cfe-commits

Differential Revision: https://reviews.llvm.org/D47290

llvm-svn: 335393
2018-06-22 21:54:40 +00:00
..
AnalysisDeclContext.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2018-03-21 00:14:43 +00:00
BodyFarm.cpp [analyzer] Do not crash on callback for call_once passed by value 2018-05-16 00:29:13 +00:00
CFG.cpp [CFG] Fix automatic destructors when a member is bound to a reference. 2018-06-04 18:56:25 +00:00
CFGReachabilityAnalysis.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2018-03-16 21:22:42 +00:00
CFGStmtMap.cpp
CMakeLists.txt [CFG] NFC: Refactor ConstructionContext into a finite set of cases. 2018-02-27 20:03:35 +00:00
CallGraph.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-12-07 21:55:09 +00:00
CloneDetection.cpp Fix typos in clang 2018-04-06 15:14:32 +00:00
CocoaConventions.cpp [analyzer] Teach RetainCountChecker about CoreMedia APIs 2017-11-25 14:57:42 +00:00
CodeInjector.cpp Roll-back r250822. 2015-10-20 13:23:58 +00:00
ConstructionContext.cpp Fix -Wunused-variable warnings after r330377. 2018-04-20 09:47:03 +00:00
Consumed.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2018-03-13 21:32:01 +00:00
Dominators.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2018-03-13 21:32:01 +00:00
FormatString.cpp Add support for __builtin_os_log_format[_buffer_size] 2016-10-24 20:39:34 +00:00
FormatStringParsing.h [NFC] Header cleanup 2016-07-18 19:02:11 +00:00
LiveVariables.cpp Revert "[analyzer] Remove an unused variable" 2018-04-06 19:14:05 +00:00
OSLog.cpp Make helpers static. NFC. 2017-02-11 12:21:17 +00:00
ObjCNoReturn.cpp
PostOrderCFGView.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2018-03-13 21:32:01 +00:00
PrintfFormatString.cpp [Sema] -Wformat-pedantic only for NSInteger/NSUInteger %zu/%zi on Darwin 2018-06-22 21:54:40 +00:00
ProgramPoint.cpp Roll-back r250822. 2015-10-20 13:23:58 +00:00
PseudoConstantAnalysis.cpp Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-03 06:23:51 +00:00
ReachableCode.cpp Teach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to treat __assume(0) like __builtin_unreachable. 2018-02-13 21:31:47 +00:00
ScanfFormatString.cpp [clang] Add getUnsignedPointerDiffType method 2017-09-28 23:11:31 +00:00
ThreadSafety.cpp Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
ThreadSafetyCommon.cpp Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
ThreadSafetyLogical.cpp
ThreadSafetyTIL.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2018-03-16 00:37:51 +00:00
UninitializedValues.cpp Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00