26class BoolAssignmentChecker :
public Checker<check::Bind> {
27 const BugType BT{
this,
"Assignment of a non-Boolean value"};
29 bool IsTainted =
false)
const;
37 bool IsTainted)
const {
39 StringRef Msg = IsTainted ?
"Might assign a tainted non-Boolean value"
40 :
"Assignment of a non-Boolean value";
41 C.emitReport(std::make_unique<PathSensitiveBugReport>(BT, Msg, N));
50 return TT->getDecl()->getName() ==
"BOOL" ||
51 TT->getDecl()->getName() ==
"_Bool" ||
52 TT->getDecl()->getName() ==
"Boolean";
86 llvm::APSInt
Zero = BVF.getValue(0, RegTy);
87 llvm::APSInt One = BVF.getValue(1, RegTy);
95 emitReport(StOut,
C,
true);
102bool ento::shouldRegisterBoolAssignmentChecker(
const CheckerManager &Mgr) {
static bool isBooleanType(QualType Ty)
A (possibly-)qualified type.
Stmt - This represents one statement.
bool isBooleanType() const
const T * getAs() const
Member-template getAs<specific type>'.
CHECKER * registerChecker(AT &&... Args)
Used to register checkers.
ProgramStatePair assumeInclusiveRangeDual(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To)
Returns a pair of states (StInRange, StOutOfRange) where the given value is assumed to be in the rang...
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
std::optional< T > getAs() const
Convert to the specified SVal type, returning std::nullopt if this SVal is not of the desired type.
const MemRegion * getAsRegion() const
TypedValueRegion - An abstract class representing regions having a typed value.
virtual QualType getValueType() const =0
bool isTainted(ProgramStateRef State, const Stmt *S, const LocationContext *LCtx, TaintTagType Kind=TaintTagGeneric)
Check if the statement has a tainted value in the given state.
bool Zero(InterpState &S, CodePtr OpPC)
The JSON file list parser is used to communicate input to InstallAPI.