[clang] Suggest lifetime annotations [Issue Id: 169375] (PR #169767)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 27 02:33:10 PST 2025


================
@@ -31,7 +31,7 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, LoanID ID) {
 struct AccessPath {
   const clang::ValueDecl *D;
 
-  AccessPath(const clang::ValueDecl *D) : D(D) {}
+  AccessPath(const clang::ValueDecl *D = nullptr) : D(D) {}
----------------
Xazax-hun wrote:

A `ParmVarDecl` is a value decl so I think it might be better to actually have a decl here. If the root of the access path is a `ParmVarDecl`, we know it was a placeholder loan. But now we have even more information, like we can tell which parameter does this belong to. Moreover, in the future, we want to have more complex access paths rooted at `ParmVarDecl`s. 

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


More information about the cfe-commits mailing list