[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

Yitzhak Mandelbaum via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 2 03:52:36 PDT 2024


================
@@ -975,6 +994,35 @@ TEST_F(WideningTest, DistinctValuesWithSamePropertiesAreEquivalent) {
       });
 }
 
+TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) {
+  std::string Code = R"(
+    void target(bool Cond) {
+      int *Foo;
+      int i = 0;
+      Foo = nullptr;
+      while (Cond) {
+        Foo = &i;
+      }
+      (void)0;
+      /*[[p]]*/
+    }
+  )";
+  runDataflow(
+      Code,
+      [](const llvm::StringMap<DataflowAnalysisState<NoopLattice>> &Results,
+         ASTContext &ASTCtx) {
+        ASSERT_THAT(Results.keys(), UnorderedElementsAre("p"));
----------------
ymand wrote:

Great. I've removed it here and in all other cases of WideningTest.

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


More information about the cfe-commits mailing list