[clang] [LifetimeSafety] Implement support for lifetimebound attribute (PR #158489)

via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 14 07:50:51 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- clang/include/clang/Analysis/Analyses/LifetimeSafety.h clang/lib/Analysis/LifetimeSafety.cpp clang/test/Sema/warn-lifetime-safety-dataflow.cpp clang/unittests/Analysis/LifetimeSafetyTest.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/unittests/Analysis/LifetimeSafetyTest.cpp b/clang/unittests/Analysis/LifetimeSafetyTest.cpp
index 1c547e3cf..7bbe5dbad 100644
--- a/clang/unittests/Analysis/LifetimeSafetyTest.cpp
+++ b/clang/unittests/Analysis/LifetimeSafetyTest.cpp
@@ -1114,7 +1114,7 @@ TEST_F(LifetimeAnalysisTest, LifetimeboundReturnReference) {
   )");
   EXPECT_THAT(Origin("v1"), HasLoansTo({"a"}, "p1"));
   EXPECT_THAT(Origin("v2"), HasLoansTo({"a"}, "p2"));
-  
+
   // FIXME: v3 should have loan to 'a' instead of 'b'.
   EXPECT_THAT(Origin("v3"), HasLoansTo({"b"}, "p2"));
 
@@ -1172,8 +1172,8 @@ TEST_F(LifetimeAnalysisTest, LifetimeboundConversionOperator) {
       POINT(p1);
     }
   )");
-  // The view 'v' should inherit the loan from the 'owner' object's internal 'o'.
-  // Assuming the loan is tracked back to the ultimate owner 'owner.o'.
+  // The view 'v' should inherit the loan from the 'owner' object's internal
+  // 'o'. Assuming the loan is tracked back to the ultimate owner 'owner.o'.
   EXPECT_THAT(Origin("v"), HasLoansTo({"owner"}, "p1"));
 }
 } // anonymous namespace

``````````

</details>


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


More information about the cfe-commits mailing list