[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:48 PST 2025
================
@@ -28,29 +56,20 @@ View conditional_return_view (
return res; // expected-note 2 {{param returned here}}
}
-// FIXME: Fails to generate lifetime suggestion for reference types as these are not handled currently.
-MyObj& return_reference (MyObj& a, MyObj& b, bool c) {
- if(c) {
- return a;
- }
- return b;
-}
-
-// FIXME: Fails to generate lifetime suggestion for reference types as these are not handled currently.
-View return_view_from_reference (MyObj& p) {
- return p;
-}
-
-int* return_pointer_directly (int* a) { // expected-warning {{param should be marked [[clang::lifetimebound]]}}.
+int* return_pointer_directly(int* a) {
return a; // expected-note {{param returned here}}
}
-MyObj* return_pointer_object (MyObj* a) { // expected-warning {{param should be marked [[clang::lifetimebound]]}}.
+MyObj* return_pointer_object(MyObj* a) {
return a; // expected-note {{param returned here}}
}
+//===----------------------------------------------------------------------===//
+// Private Annotation Test Cases
+//===----------------------------------------------------------------------===//
----------------
kashika0112 wrote:
Done
https://github.com/llvm/llvm-project/pull/171972
More information about the cfe-commits
mailing list