[llvm-branch-commits] [clang] [SSAF][PointerFlow] A pointer assignment may yield more than one edge (PR #218207)

Balázs Benics via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 28 05:22:01 PDT 2026


================
@@ -1113,6 +1116,26 @@ TEST_F(PointerFlowTest, MultipleReturnEdges) {
                                       }));
 }
 
+// A function returning a reference to a multi-level pointer.  The return
+// type `int **&` has two pointer levels once the reference is stripped, so the
+// (foo_ret, n) -> (gpp, m) edge should be elaborated up to level 2.
+TEST_F(PointerFlowTest, ReturnRefToMultiLevelPointer) {
+  ASSERT_TRUE(setUpTest(R"cpp(
+    int **gpp;
+    int **&foo() {
+      return gpp;
+    }
+  )cpp"));
+
+  auto *Sum = getEntitySummary("foo");
+
+  ASSERT_NE(Sum, nullptr);
+  EXPECT_EQ(*Sum, makeEdges(__LINE__, {
+                                          {{"foo", 1U, true}, {"gpp", 1U}},
----------------
steakhal wrote:

For a moment I was reading `gpu` - I guess you see your wishes everywhere.
No action expected :D

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


More information about the llvm-branch-commits mailing list