22 using namespace clang;
26 class FixedAddressChecker
27 :
public Checker< check::PreStmt<BinaryOperator> > {
28 mutable std::unique_ptr<BuiltinBug> BT;
31 void checkPreStmt(
const BinaryOperator *B, CheckerContext &C)
const;
36 CheckerContext &C)
const {
47 SVal RV = C.getSVal(B->
getRHS());
49 if (!RV.isConstant() || RV.isZeroConstant())
52 if (ExplodedNode *N = C.generateNonFatalErrorNode()) {
55 new BuiltinBug(
this,
"Use fixed address",
56 "Using a fixed address is not portable because that " 57 "address will probably not be valid in all " 58 "environments or platforms."));
59 auto R = llvm::make_unique<BugReport>(*BT, BT->getDescription(), N);
61 C.emitReport(std::move(R));
65 void ento::registerFixedAddressChecker(CheckerManager &mgr) {
66 mgr.registerChecker<FixedAddressChecker>();
A (possibly-)qualified type.
A builtin binary operation expression such as "x + y" or "x <= y".
Dataflow Directional Tag Classes.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
bool isPointerType() const