[clang] Propagate lifetimebound from formal parameters to those in the canonical declaration and use that for analysis (PR #107627)

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 13 07:55:15 PDT 2024


================
@@ -462,14 +462,16 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call,
     }
   }
 
-  for (unsigned I = 0,
-                N = std::min<unsigned>(Callee->getNumParams(), Args.size());
-       I != N; ++I) {
-    if (CheckCoroCall || Callee->getParamDecl(I)->hasAttr<LifetimeBoundAttr>())
-      VisitLifetimeBoundArg(Callee->getParamDecl(I), Args[I]);
+  const FunctionDecl *CanonCallee = Callee->getCanonicalDecl();
+  const unsigned int NP =
----------------
ilya-biryukov wrote:

NIT: LLVM uses `unsigned`, could you remove `int` to be consistent with the rest of the code?

Also, using `const` for local variables is not very common. I'm not sure if the LLVM Style Guide has a position on it, but it's at least inconsistent with the code around the change, so we should probably lean on the side of **not** adding const.

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


More information about the cfe-commits mailing list