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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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;
         }

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.

2 participants