Skip to content

[LifetimeSafety] Track gsl::Pointer types #154009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: users/usx95/08-16-add_decl_expr_name_to_origin_s_debug_output
Choose a base branch
from

Conversation

usx95
Copy link
Contributor

@usx95 usx95 commented Aug 17, 2025

Add support for GSL pointer types in lifetime safety analysis, enabling detection of dangling references in pointer-like types.

Copy link
Contributor Author

usx95 commented Aug 17, 2025

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- clang/lib/Analysis/LifetimeSafety.cpp clang/unittests/Analysis/LifetimeSafetyTest.cpp
View the diff from clang-format here.
diff --git a/clang/unittests/Analysis/LifetimeSafetyTest.cpp b/clang/unittests/Analysis/LifetimeSafetyTest.cpp
index 12d488ec0..98469286a 100644
--- a/clang/unittests/Analysis/LifetimeSafetyTest.cpp
+++ b/clang/unittests/Analysis/LifetimeSafetyTest.cpp
@@ -813,7 +813,9 @@ TEST_F(LifetimeAnalysisTest, GslPointerReassignment) {
 
   EXPECT_THAT(Origin("v"), HasLoansTo({"safe"}, "p1"));
   EXPECT_THAT(Origin("v"), HasLoansTo({"unsafe"}, "p2"));
-  EXPECT_THAT(Origin("v"), HasLoansTo({"unsafe"}, "p3")); // The loan is still held, just expired.
+  EXPECT_THAT(
+      Origin("v"),
+      HasLoansTo({"unsafe"}, "p3")); // The loan is still held, just expired.
   EXPECT_THAT(LoansTo({"unsafe"}), AreExpiredAt("p3"));
 }
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant