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

github-actions bot commented Aug 17, 2025

⚠️ 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 b339adf69..89c3b9c41 100644
--- a/clang/unittests/Analysis/LifetimeSafetyTest.cpp
+++ b/clang/unittests/Analysis/LifetimeSafetyTest.cpp
@@ -888,7 +888,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"));
 }
 

@usx95 usx95 force-pushed the users/usx95/08-17-_lifetimesafety_track_gsl_pointer_types branch from 14ec176 to f5a6015 Compare August 17, 2025 22:04
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