================ @@ -23,38 +25,35 @@ using namespace ento; namespace { class FixedAddressChecker - : public Checker< check::PreStmt<BinaryOperator> > { + : public Checker<check::PreStmt<BinaryOperator>, check::PreStmt<DeclStmt>, + check::PreStmt<CallExpr>> { const BugType BT{this, "Use fixed address"}; + void checkUseOfFixedAddress(QualType DstType, const Expr *SrcExpr, + CheckerContext &C) const; + public: void checkPreStmt(const BinaryOperator *B, CheckerContext &C) const; + void checkPreStmt(const DeclStmt *D, CheckerContext &C) const; + void checkPreStmt(const CallExpr *CE, CheckerContext &C) const; }; } -void FixedAddressChecker::checkPreStmt(const BinaryOperator *B, - CheckerContext &C) const { - // Using a fixed address is not portable because that address will probably - // not be valid in all environments or platforms. - - if (B->getOpcode() != BO_Assign) - return; - - QualType T = B->getType(); - if (!T->isPointerType()) +void FixedAddressChecker::checkUseOfFixedAddress(QualType DstType, + const Expr *SrcExpr, + CheckerContext &C) const { + if (!DstType->isPointerType()) ---------------- steakhal wrote:
Can the destination type be reference type? https://github.com/llvm/llvm-project/pull/110977 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits