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>'.