[clang] [LifetimeSafety] Add suggestion and inference for implicit this (PR #176703)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 23 09:44:27 PST 2026


================
@@ -56,15 +66,24 @@ class LifetimeSafetyReporter {
                                     SourceLocation ExpiryLoc,
                                     Confidence Confidence) {}
 
-  // Suggests lifetime bound annotations for function paramters
-  virtual void suggestAnnotation(SuggestionScope Scope,
-                                 const ParmVarDecl *ParmToAnnotate,
-                                 const Expr *EscapeExpr) {}
+  // Suggests lifetime bound annotations for function paramters.
+  virtual void suggestLifetimeboundToParmVar(SuggestionScope Scope,
+                                             const ParmVarDecl *ParmToAnnotate,
+                                             const Expr *EscapeExpr) {}
+
+  // Suggests lifetime bound annotations for implicit this.
+  virtual void suggestLifetimeboundToImplicitThis(SuggestionScope Scope,
+                                                  const CXXMethodDecl *MD,
+                                                  const Expr *EscapeExpr) {}
+
+  // Adds inferred lifetime bound attribute for implicit this to its
+  // TypeSourceInfo.
+  virtual void addLifetimeBoundToImplicitThis(const CXXMethodDecl *MD) {}
 };
 
 /// The main entry point for the analysis.
 void runLifetimeSafetyAnalysis(AnalysisDeclContext &AC,
-                               LifetimeSafetyReporter *Reporter,
+                               LifetimeSafetySemaHelper *Reporter,
----------------
usx95 wrote:

Same here. Rename `reporter`.

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


More information about the cfe-commits mailing list