[clang] [clang][analyzer][NFCi] Pass if bind is to a Decl or not to checkBind (PR #152137)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 7 12:36:59 PDT 2025


Endre =?utf-8?q?F=C3=BCl=C3=B6p?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?F=C3=BCl=C3=B6p?= <endre.fulop at sigmatechnology.com>,
Endre =?utf-8?q?F=C3=BCl=C3=B6p?= <endre.fulop at sigmatechnology.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/152137 at github.com>


================
@@ -152,4 +152,23 @@ TEST(ExprEngineVisitTest, checkLocationAndBind) {
   EXPECT_TRUE(LocPos > BindPos);
 }
 
+TEST(ExprEngineVisitTest, checkLocationAndBindInitialization) {
+  std::string Diags;
+  EXPECT_TRUE(runCheckerOnCode<addMemAccessChecker>(R"(
+    class MyClass{
+    public:
+      int Value;
+    };
+    extern MyClass MyClassRead;
+    void top() {
+      MyClass MyClassWrite = MyClassRead;
+    }
----------------
steakhal wrote:

```suggestion
    void top(MyClass param) {
      MyClass MyClassWrite = param;
    }
```

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


More information about the cfe-commits mailing list