[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:03:27 PDT 2025
https://github.com/Harald-R created https://github.com/llvm/llvm-project/pull/143411
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).
>From 0967a5da921f5c3769f61cfe558dfe203a547663 Mon Sep 17 00:00:00 2001
From: Harald-R <rotuna.razvan at gmail.com>
Date: Mon, 9 Jun 2025 19:58:27 +0300
Subject: [PATCH] Use spelling instead of resolved header path
---
clang-tools-extra/clangd/IncludeCleaner.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
More information about the cfe-commits
mailing list