[clang-tools-extra] Use spelling for clangd missing includes filtering (PR #143411)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 9 10:04:01 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangd

Author: None (Harald-R)

<details>
<summary>Changes</summary>

As part of https://github.com/llvm/llvm-project/pull/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](https://github.com/llvm/llvm-project/pull/140594#issuecomment-2954770590).

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


1 Files Affected:

- (modified) clang-tools-extra/clangd/IncludeCleaner.cpp (+1-1) 


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

``````````

</details>


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


More information about the cfe-commits mailing list