[clang-tools-extra] [clangd] Avoid invalid include-fixer fuzzy-find queries (PR #212134)

Macro Terra via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 09:54:43 PDT 2026


hongtaihu wrote:

Investigated this further. `DeclarationNameInfo` is correct here: parser recognizes `operator ::align_val_t` as a conversion-function-id, and Sema constructs a `CXXConversionFunctionName` with a target type.

The incorrect step was in `UnresolvedNameRecorder`: it unconditionally called `Typo.getAsString()` and treated the diagnostic presentation string as `UnresolvedName::Name`. For this kind, that string contains the target type and can contain `std::`, which is not an outer lookup scope that IncludeFixer can split into `Name + Scopes`.

I updated the patch to reject only `CXXConversionFunctionName` before this lossy conversion. This removes the string-based `contains("::")` check. I intentionally do not reject all non-identifier names: e.g. overloaded operators may still be valid unqualified index names.


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


More information about the cfe-commits mailing list