[clang] [clang-tools-extra] [clangd] Autocomplete fixes for methods (PR #165916)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 7 23:07:21 PST 2026


================
@@ -36,9 +36,9 @@ int func3() {
   (&A::bar)
 }
 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-3):10 -std=c++23 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: COMPLETION: foo : [#void#]foo<<#class self:auto#>>(<#int arg#>)
+// CHECK-CC3: COMPLETION: foo : [#void#]foo<<#class self:auto#>>[#(#][#int arg#][#)#]
----------------
HighCommander4 wrote:

This is a behaviour change (we previously got a placeholder here for the parameter, and now we just get informative chunks), but I think it's an acceptable one.

The rationale for the previous behaviour was that a call would in fact be valid here, e.g. `(&A::bar)(a, 42)`. (Note that this would not be valid if `bar` didn't have an explicit object parameter.)

But given `&A::bar` alone, the user may well just be saving the address of the function for calling later, and the new behaviour is consistent with the assumption we're making in this patch that if the user is taking the address of a function, they are likely not calling it.

(No change needed, just writing down my thinking.)

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


More information about the cfe-commits mailing list