[clang] [Lifetime Safety] Public Vs Private Annotation Suggestions (PR #171972)
Kashika Akhouri via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 15 00:36:44 PST 2025
================
@@ -12,14 +22,32 @@ struct [[gsl::Pointer()]] View {
void use() const;
};
-View return_view_directly (View a) { // expected-warning {{param should be marked [[clang::lifetimebound]]}}.
+View return_view_directly(View a); // expected-warning {{parameter in cross-TU function should be marked [[clang::lifetimebound]]}}
+
+View conditional_return_view(
+ View a, // expected-warning {{parameter in cross-TU function should be marked [[clang::lifetimebound]]}}
+ View b, // expected-warning {{parameter in cross-TU function should be marked [[clang::lifetimebound]]}}
+ bool c);
+
+int* return_pointer_directly(int* a); // expected-warning {{parameter in cross-TU function should be marked [[clang::lifetimebound]]}}
+
+MyObj* return_pointer_object(MyObj* a); // expected-warning {{parameter in cross-TU function should be marked [[clang::lifetimebound]]}}
----------------
kashika0112 wrote:
Added these. Plus we also have annotation inference cases where these functions are used.
https://github.com/llvm/llvm-project/pull/171972
More information about the cfe-commits
mailing list