20#include "llvm/ADT/StringRef.h"
26class PointerSubChecker
27 :
public Checker< check::PreStmt<BinaryOperator> > {
28 const BugType BT{
this,
"Pointer subtraction"};
58 if (isa<SymbolicRegion>(BaseLR) || isa<SymbolicRegion>(BaseRR))
62 constexpr llvm::StringLiteral Msg =
63 "Subtraction of two pointers that do not point to the same memory "
64 "chunk may cause incorrect result.";
65 auto R = std::make_unique<PathSensitiveBugReport>(BT, Msg, N);
67 C.emitReport(std::move(R));
75bool ento::shouldRegisterPointerSubChecker(
const CheckerManager &mgr) {
A builtin binary operation expression such as "x + y" or "x <= y".
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
CHECKER * registerChecker(AT &&... Args)
Used to register checkers.
MemRegion - The root abstract class for all memory regions.
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegion * getBaseRegion() const
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
const MemRegion * getAsRegion() const
The JSON file list parser is used to communicate input to InstallAPI.