llvm-project/clang/lib/Analysis
Devin Coughlin 046833e5fb [analyzer] Model correct dispatch_once() 'done' value in BodyFarm
The analyzer's BodyFarm models dispatch_once() by comparing the passed-in
predicate against a known 'done' value. If the predicate does not have that
value, the model updates the predicate to have that value and executes the
passed in block.

Unfortunately, the current model uses the wrong 'done' value: 1 instead of ~0.
This interferes with libdispatch's static inline function _dispatch_once(),
which enables a fast path if the block has already been executed. That function
uses __builtin_assume() to tell the compiler that the done flag is set to ~0 on
exit. When r302880 added modeling of __builtin_assume(), this caused the
analyzer to assume 1 == ~0. This in turn caused the analyzer to never explore any code after a call to dispatch_once().

This patch regains the missing coverage by updating BodyFarm to use the correct
'done' value.

rdar://problem/34413048

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

llvm-svn: 317516
2017-11-06 22:12:19 +00:00
..
AnalysisDeclContext.cpp [analyzer] Removing unused stored field. 2017-11-01 02:29:04 +00:00
BodyFarm.cpp [analyzer] Model correct dispatch_once() 'done' value in BodyFarm 2017-11-06 22:12:19 +00:00
CFG.cpp Implement CFG construction for __try / __except / __leave. 2017-08-23 15:33:16 +00:00
CFGReachabilityAnalysis.cpp
CFGStmtMap.cpp
CMakeLists.txt Add support for __builtin_os_log_format[_buffer_size] 2016-10-24 20:39:34 +00:00
CallGraph.cpp [analyzer] Consider function call arguments while building CallGraph. 2017-01-27 12:14:56 +00:00
CloneDetection.cpp [AST] Add TableGen for StmtDataCollectors 2017-09-06 13:20:51 +00:00
CocoaConventions.cpp Allow the cf_returns_[not_]retained attributes to appear on out-parameters. 2015-06-19 23:17:46 +00:00
CodeInjector.cpp Roll-back r250822. 2015-10-20 13:23:58 +00:00
Consumed.cpp Consolidate std::move() detection code. No behavior change. 2017-09-28 16:16:39 +00:00
Dominators.cpp
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 [CSA] [NFC] Move AnalysisContext.h to AnalysisDeclContext.h 2017-09-06 21:45:03 +00:00
OSLog.cpp Make helpers static. NFC. 2017-02-11 12:21:17 +00:00
ObjCNoReturn.cpp
PostOrderCFGView.cpp
PrintfFormatString.cpp [clang] Add getUnsignedPointerDiffType method 2017-09-28 23:11:31 +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 [CSA] [NFC] Move AnalysisContext.h to AnalysisDeclContext.h 2017-09-06 21:45:03 +00:00
ScanfFormatString.cpp [clang] Add getUnsignedPointerDiffType method 2017-09-28 23:11:31 +00:00
ThreadSafety.cpp [CSA] [NFC] Move AnalysisContext.h to AnalysisDeclContext.h 2017-09-06 21:45:03 +00:00
ThreadSafetyCommon.cpp [CSA] [NFC] Move AnalysisContext.h to AnalysisDeclContext.h 2017-09-06 21:45:03 +00:00
ThreadSafetyLogical.cpp Revert r240270 ("Fixed/added namespace ending comments using clang-tidy"). 2015-06-22 23:07:51 +00:00
ThreadSafetyTIL.cpp Spelling mistakes in comments. NFCI. (PR27635) 2017-03-30 14:13:19 +00:00
UninitializedValues.cpp Consolidate std::move() detection code. No behavior change. 2017-09-28 16:16:39 +00:00