[clang] [LifetimeSafety] Infer [[clang::lifetimebound]] annotation (PR #171081)

Kashika Akhouri via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 8 04:57:17 PST 2025


================
@@ -160,6 +162,19 @@ class LifetimeChecker {
     for (const auto &[PVD, EscapeExpr] : AnnotationWarningsMap)
       Reporter->suggestAnnotation(PVD, EscapeExpr);
   }
+
+  void inferAnnotations() {
+    /// NOTE: This currently only adds the attribute to the function definition
+    /// being analyzed. For full inter-procedural inference to work reliably
+    /// (e.g., with out-of-order definitions), this attribute would also need to
+    /// be added to all other redeclarations of the function.
----------------
kashika0112 wrote:

Added the Fixme comments.

Thank you for giving the code reference. Should help me in creating the CallGraph.

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


More information about the cfe-commits mailing list