[clang] [LifetimeSafety] Suggest lifetime annotations (PR #169767)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 28 06:38:56 PST 2025


================
@@ -0,0 +1,81 @@
+// RUN: %clang_cc1 -fsyntax-only -fexperimental-lifetime-safety -Wexperimental-lifetime-safety-suggestions -verify %s
+
+struct MyObj {
+  int id;
+  ~MyObj() {}  // Non-trivial destructor
+  MyObj operator+(MyObj);
+};
+
+struct [[gsl::Pointer()]] View {
+  View(const MyObj&); // Borrows from MyObj
+  View();
+  void use() const;
+};
+
+//===----------------------------------------------------------------------===//
+// Lifetimebound Annotation Suggestion Tests
+//===----------------------------------------------------------------------===//
----------------
usx95 wrote:

nit: remove this now as this whole file is for that.

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


More information about the cfe-commits mailing list