Skip to content

Use spelling for clangd missing includes filtering #143411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

Harald-R
Copy link
Contributor

@Harald-R Harald-R commented Jun 9, 2025

As part of #140594, support was added for configuring the inclusion style of clangd's missing includes feature. For filtering the headers, the resolved path of the header was used instead of its spelling. It turns out that the spelling is intentionally used in other components like clang-tidy, leading to inconsistency between the tools. More details here.

@llvmbot
Copy link
Member

llvmbot commented Jun 9, 2025

@llvm/pr-subscribers-clang-tools-extra

@llvm/pr-subscribers-clangd

Author: None (Harald-R)

Changes

As part of #140594, support was added for configuring the inclusion style of clangd's missing includes feature. For filtering the headers, the resolved path of the header was used instead of its spelling. It turns out that the spelling is intentionally used in other components like clang-tidy, leading to inconsistency between the tools. More details here.


Full diff: https://github.com/llvm/llvm-project/pull/143411.diff

1 Files Affected:

  • (modified) clang-tools-extra/clangd/IncludeCleaner.cpp (+1-1)
diff --git a/clang-tools-extra/clangd/IncludeCleaner.cpp b/clang-tools-extra/clangd/IncludeCleaner.cpp
index 382ea3ffe342b..1a81d7a228dba 100644
--- a/clang-tools-extra/clangd/IncludeCleaner.cpp
+++ b/clang-tools-extra/clangd/IncludeCleaner.cpp
@@ -148,7 +148,7 @@ std::vector<Diag> generateMissingIncludeDiagnostics(
     if (SymbolWithMissingInclude.Providers.front().kind() ==
         include_cleaner::Header::Kind::Physical) {
       for (auto &Filter : Angled ? QuotedHeaders : AngledHeaders) {
-        if (Filter(ResolvedPath)) {
+        if (Filter(HeaderRef)) {
           Angled = !Angled;
           break;
         }

@Harald-R Harald-R closed this Jun 18, 2025
@Harald-R Harald-R deleted the clangd/include_cleaner/use_spelling branch June 18, 2025 16:28
@kadircet
Copy link
Member

sorry for silence here, i was mostly waiting for some replies to #140594 (comment). as it stands, i feel like we'll likely limit users with a spelling based filter. unless people have concerns/disagreement, i'd suggest we resolve this by filtering on resolved paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants