Skip to content

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