21 using namespace clang;
25 class FixedAddressChecker
26 :
public Checker< check::PreStmt<BinaryOperator> > {
27 mutable std::unique_ptr<BuiltinBug> BT;
30 void checkPreStmt(
const BinaryOperator *B, CheckerContext &C)
const;
35 CheckerContext &C)
const {
46 SVal RV = C.getSVal(B->
getRHS());
48 if (!RV.isConstant() || RV.isZeroConstant())
51 if (ExplodedNode *N = C.generateNonFatalErrorNode()) {
54 new BuiltinBug(
this,
"Use fixed address",
55 "Using a fixed address is not portable because that " 56 "address will probably not be valid in all " 57 "environments or platforms."));
58 auto R = llvm::make_unique<BugReport>(*BT, BT->getDescription(), N);
60 C.emitReport(std::move(R));
64 void ento::registerFixedAddressChecker(CheckerManager &mgr) {
65 mgr.registerChecker<FixedAddressChecker>();
68 bool ento::shouldRegisterFixedAddressChecker(
const LangOptions &LO) {
A (possibly-)qualified type.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
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