[clang] [analyzer] performTrivialCopy triggers checkLocation before binding (PR #129016)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 28 06:19:26 PST 2025


================
@@ -44,6 +54,21 @@ CREATE_EXPR_ENGINE_CHECKER(ExprEngineVisitPreChecker, PreStmt, GCCAsmStmt,
 CREATE_EXPR_ENGINE_CHECKER(ExprEngineVisitPostChecker, PostStmt, GCCAsmStmt,
                            "GCCAsmStmtBug")
 
+class MemAccessChecker : public Checker<check::Location, check::Bind> {
+public:
+  void checkLocation(const SVal &Loc, bool IsLoad, const Stmt *S,
+                     CheckerContext &C) const {
+    emitErrorReport(C, Bug, "checkLocation: Loc = " + getMemRegionName(Loc));
----------------
steakhal wrote:

The dump should make it clear what expression was this, what is the location and what was the loaded value from the location.
For the expression part I think dumping the class kind should be enough.

The same comments apply to `checkBind` too.

https://github.com/llvm/llvm-project/pull/129016


More information about the cfe-commits mailing list