================
@@ -84,4 +118,24 @@ TEST(ExprEngineVisitTest, checkPostStmtGCCAsmStmt) {
EXPECT_EQ(Diags, "ExprEngineVisitPostChecker: checkPostStmt<GCCAsmStmt>\n");
}
+TEST(ExprEngineVisitTest, checkLocationAndBind) {
+ std::string Diags;
+ EXPECT_TRUE(runCheckerOnCode<addMemAccessChecker>(R"(
+ class MyClass{
+ public:
+ int Value;
+ };
+ extern MyClass MyClassWrite, MyClassRead;
+ void top() {
+ MyClassWrite = MyClassRead;
+ }
+ )",
+ Diags));
+
+ std::string RHSMsg = "checkLocation: Loc = MyClassRead";
+ std::string LHSMsg = "checkBind: Loc = MyClassWrite";
+ EXPECT_NE(Diags.find(RHSMsg), std::string::npos);
+ EXPECT_NE(Diags.find(LHSMsg), std::string::npos);
----------------
steakhal wrote:
I think it makes sense to enforce the ordering: first checkLocation should see
a load event, then the checkBind should see the store side effect of the
assignment.
https://github.com/llvm/llvm-project/pull/129016
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits