llvm-project/clang/lib/StaticAnalyzer/Checkers
Artem Dergachev f7887d41cb [analyzer] When failing to evaluate a __builtin_constant_p, presume it's false.
__builtin_constant_p(x) is a compiler builtin that evaluates to 1 when
its argument x is a compile-time constant and to 0 otherwise. In CodeGen
it is simply lowered to the respective LLVM intrinsic. In the Analyzer
we've been trying to delegate modeling to Expr::EvaluateAsInt, which is
allowed to sometimes fail for no apparent reason.

When it fails, let's conservatively return false. Modeling it as false
is pretty much never wrong, and it is only required to return true
on a best-effort basis, which every user should expect.

Fixes VLAChecker false positives on code that tries to emulate
static asserts in C by constructing a VLA of dynamic size -1 under the
assumption that this dynamic size is actually a constant
in the sense of __builtin_constant_p.

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

llvm-svn: 357557
2019-04-03 01:53:40 +00:00
..
MPI-Checker [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
RetainCountChecker Make some helper functions static. NFC. 2019-02-11 14:52:15 +00:00
UninitializedObject [analyzer] Emit an error rather than assert on invalid checker option input 2019-03-08 16:00:42 +00:00
AllocationState.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
AnalysisOrderChecker.cpp [analyzer] Enable subcheckers to possess checker options 2019-03-04 00:28:16 +00:00
AnalyzerStatsChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ArrayBoundChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ArrayBoundCheckerV2.cpp [analyzer] Move taint API from ProgramState to a separate header. NFC. 2019-03-29 22:49:30 +00:00
BasicObjCFoundationChecks.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
BlockInCriticalSectionChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
BoolAssignmentChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
BuiltinFunctionChecker.cpp [analyzer] When failing to evaluate a __builtin_constant_p, presume it's false. 2019-04-03 01:53:40 +00:00
CMakeLists.txt [analyzer] Move taint API from ProgramState to a separate header. NFC. 2019-03-29 22:49:30 +00:00
CStringChecker.cpp [analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker 2019-01-26 21:41:50 +00:00
CStringSyntaxChecker.cpp [analyzer] CStringSyntaxChecks: Fix an off-by-one error in the strlcat() check. 2019-02-08 23:59:52 +00:00
CXXSelfAssignmentChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
CallAndMessageChecker.cpp [analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker 2019-01-26 21:41:50 +00:00
CastSizeChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
CastToStructChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
CheckObjCDealloc.cpp [analyzer] Emit an error rather than assert on invalid checker option input 2019-03-08 16:00:42 +00:00
CheckObjCInstMethSignature.cpp Fix file headers. NFC 2019-03-01 06:49:51 +00:00
CheckSecuritySyntaxOnly.cpp [analyzer] New checker for detecting usages of unsafe I/O functions 2019-02-11 13:46:43 +00:00
CheckSizeofPointer.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
CheckerDocumentation.cpp [analyzer] Fix a typo in docs 2019-01-29 10:15:52 +00:00
ChrootChecker.cpp Fix file headers. NFC 2019-03-01 06:49:51 +00:00
CloneChecker.cpp [analyzer] Emit an error rather than assert on invalid checker option input 2019-03-08 16:00:42 +00:00
ConversionChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
DeadStoresChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
DebugCheckers.cpp [analyzer] Fix an assertation failure for invalid sourcelocation, add a new debug checker 2019-03-14 16:10:29 +00:00
DeleteWithNonVirtualDtorChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
DereferenceChecker.cpp Fix file headers. NFC 2019-03-01 06:49:51 +00:00
DirectIvarAssignment.cpp [analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker 2019-01-26 21:41:50 +00:00
DivZeroChecker.cpp [analyzer] Move taint API from ProgramState to a separate header. NFC. 2019-03-29 22:49:30 +00:00
DynamicTypeChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
DynamicTypePropagation.cpp [analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker 2019-01-26 21:41:50 +00:00
EnumCastOutOfRangeChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ExprInspectionChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
FixedAddressChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
GCDAntipatternChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
GTestChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
GenericTaintChecker.cpp [analyzer] Move taint API from ProgramState to a separate header. NFC. 2019-03-29 22:49:30 +00:00
IdenticalExprChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
InnerPointerChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
InterCheckerAPI.h [analyzer] Reimplement dependencies between checkers 2019-01-26 20:06:54 +00:00
IteratorChecker.cpp [Analyzer] Skip symbolic regions based on conjured symbols in comparison of the containers of iterators 2019-03-13 13:55:11 +00:00
IvarInvalidationChecker.cpp [analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker 2019-01-26 21:41:50 +00:00
LLVMConventionsChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
LocalizationChecker.cpp [analyzer] Enable subcheckers to possess checker options 2019-03-04 00:28:16 +00:00
MIGChecker.cpp Range-style std::find{,_if} -> llvm::find{,_if}. NFC 2019-03-31 08:48:19 +00:00
MacOSKeychainAPIChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
MacOSXAPIChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
MallocChecker.cpp [analyzer] Enable subcheckers to possess checker options 2019-03-04 00:28:16 +00:00
MallocOverflowSecurityChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
MallocSizeofChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
MmapWriteExecChecker.cpp [analyzer] Enable subcheckers to possess checker options 2019-03-04 00:28:16 +00:00
MoveChecker.cpp [analyzer] Emit an error rather than assert on invalid checker option input 2019-03-08 16:00:42 +00:00
NSAutoreleasePoolChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
NSErrorChecker.cpp [analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker 2019-01-26 21:41:50 +00:00
NoReturnFunctionChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
NonNullParamChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
NonnullGlobalConstantsChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
NullabilityChecker.cpp [analyzer] Enable subcheckers to possess checker options 2019-03-04 00:28:16 +00:00
NumberObjectConversionChecker.cpp [analyzer] Enable subcheckers to possess checker options 2019-03-04 00:28:16 +00:00
OSObjectCStyleCast.cpp [analyzer] Opt-in C Style Cast Checker for OSObject pointers 2019-02-08 21:09:00 +00:00
ObjCAtSyncChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ObjCAutoreleaseWriteChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ObjCContainersASTChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ObjCContainersChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ObjCMissingSuperCallChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ObjCPropertyChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ObjCSelfInitChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ObjCSuperDeallocChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ObjCUnusedIVarsChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
PaddingChecker.cpp [analyzer] Emit an error rather than assert on invalid checker option input 2019-03-08 16:00:42 +00:00
PointerArithChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
PointerSortingChecker.cpp [Analyzer] Update the LLVM license in PointerSortingChecker.cpp 2019-03-13 19:09:48 +00:00
PointerSubChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
PthreadLockChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ReturnPointerRangeChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
ReturnUndefChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
RunLoopAutoreleaseLeakChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
SimpleStreamChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
StackAddrEscapeChecker.cpp [analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker 2019-01-26 21:41:50 +00:00
StdLibraryFunctionsChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
StreamChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
Taint.cpp Fix compiler warning, remove extra ";" [NFC] 2019-04-02 10:01:09 +00:00
Taint.h [analyzer] Move taint API from ProgramState to a separate header. NFC. 2019-03-29 22:49:30 +00:00
TaintTesterChecker.cpp [analyzer] Move taint API from ProgramState to a separate header. NFC. 2019-03-29 22:49:30 +00:00
TestAfterDivZeroChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
TraversalChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
TrustNonnullChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
UndefBranchChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
UndefCapturedBlockVarChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
UndefResultChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
UndefinedArraySubscriptChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
UndefinedAssignmentChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
UnixAPIChecker.cpp [analyzer] Split unix.API up to UnixAPIMisuseChecker and UnixAPIPortabilityChecker 2019-01-26 15:56:40 +00:00
UnreachableCodeChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
VLASizeChecker.cpp [analyzer] Move taint API from ProgramState to a separate header. NFC. 2019-03-29 22:49:30 +00:00
ValistChecker.cpp [analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker 2019-01-26 21:41:50 +00:00
VforkChecker.cpp [analyzer] Supply all checkers with a shouldRegister function 2019-01-26 14:23:08 +00:00
VirtualCallChecker.cpp [analyzer] Enable subcheckers to possess checker options 2019-03-04 00:28:16 +00:00