[clang-tools-extra] [clangd] Extract to Function: mark unmodified captured parameters const (PR #225666)

Aleksandr Platonov via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 28 05:58:19 PDT 2026


================
@@ -764,11 +986,13 @@ bool createParameters(NewFunction &ExtractedFunc,
       return false;
     // Parameter qualifiers are same as the Decl's qualifiers.
     QualType TypeInfo = VD->getType().getNonReferenceType();
-    // FIXME: Need better qualifier checks: check mutated status for
-    // Decl(e.g. was it assigned, passed as nonconst argument, etc)
-    // FIXME: check if parameter will be a non l-value reference.
-    // FIXME: We don't want to always pass variables of types like int,
-    // pointers, etc by reference.
----------------
ArcsinX wrote:

It looks like we don't address this FIXME in this PR.
And with this patch this looks more strange:
```cpp
struct S { int i; };
void f(S *p) { [[p->i = 1;]] }
```

Before this PR:
`void extracted(S * &p)...` 

With this PR:
`void extracted(S *const &p) ...`

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


More information about the cfe-commits mailing list