[clang-tools-extra] Use resolved path when filtering in IncludeInserter (PR #148371)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 5 23:49:42 PDT 2025
================
@@ -344,6 +344,21 @@ TEST_F(HeadersTest, ShortenIncludesInSearchPathBracketed) {
EXPECT_EQ(calculate(BarHeader), "<sub/bar.h>");
}
+TEST_F(HeadersTest, ShortenIncludesInSearchPathBracketedFilterByFullPath) {
+ // The filter receives the full path of the header, so it is able to filter by
+ // the parent directory, even if it is part of the include search path
+ AngledHeaders.push_back([](auto Path) {
+#if defined(_WIN32)
----------------
HighCommander4 wrote:
It's a bit unfortunate that users have to use different path separators on different platforms in the pattern; it seems like that would inhibit a cross-platform project being able to check in a `.clangd` file containing this configuration key.
What do you think about using `convert_to_slash` (similar to [here](https://searchfox.org/llvm/rev/ab6923b9b7a75de79ee06b400ae73771e130339e/clang-tools-extra/clangd/Headers.cpp#301)) to normalize the path to forward-slashes before checking it against the regex?
https://github.com/llvm/llvm-project/pull/148371
More information about the cfe-commits
mailing list