[clang] Run analysis in post-order of the call-graph #172862 (PR #174178)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 2 02:00:03 PST 2026


================
@@ -194,16 +194,23 @@ class LifetimeChecker {
   }
 
   void inferAnnotations() {
-    // FIXME: To maximise inference propagation, functions should be analyzed in
-    // post-order of the call graph, allowing inferred annotations to propagate
-    // through the call chain
-    // FIXME: Add the inferred attribute to all redeclarations of the function,
-    // not just the definition being analyzed.
     for (const auto &[ConstPVD, EscapeExpr] : AnnotationWarningsMap) {
       ParmVarDecl *PVD = const_cast<ParmVarDecl *>(ConstPVD);
-      if (!PVD->hasAttr<LifetimeBoundAttr>())
+      if (!PVD->hasAttr<LifetimeBoundAttr>()) {
         PVD->addAttr(
             LifetimeBoundAttr::CreateImplicit(AST, PVD->getLocation()));
+        if (const FunctionDecl *FD =
----------------
Xazax-hun wrote:

I do not have strong feelings here, but I am not sure yet if we want to add these attributes to all redeclarations, or only to the canonical decl or decl with the body and use that decl consistently to look up the annotation. 

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


More information about the cfe-commits mailing list