================
@@ -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())
----------------
balazske wrote:

Probably yes, but for this checker it is a corner-case, the checker is mainly 
for C code (with the last changes some of C++ is supported). Assign of any 
integer value (fixed or not) to a reference type is probably rare if possible 
at all.

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

Reply via email to