Endre =?utf-8?q?F=C3=BCl=C3=B6p?= <[email protected]>,
Endre =?utf-8?q?F=C3=BCl=C3=B6p?= <[email protected]>,
Endre =?utf-8?q?F=C3=BCl=C3=B6p?= <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
================
@@ -150,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;
+ }
+ )",
+ Diags));
+
+ // Look for any occurrence of AtDeclInit = true
+ std::size_t BindPos = Diags.find("AtDeclInit = true");
+ EXPECT_NE(BindPos, std::string::npos);
----------------
steakhal wrote:
```suggestion
EXPECT_TRUE(StringRef(Diags).contains("AtDeclInit = true"));
```
https://github.com/llvm/llvm-project/pull/152137
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits