kadircet wrote:

I am rather worried that we'll lose ability to filter effectively when we match 
against spelled headers. Maybe the actual use cases in the wild and what I have 
mind are different, but I would expect users to have a situation like;
- they pass a `-Ithird_party/qt/include` in their compile flags
- this results in clangd spelling inclusions as `#include "QtWidgets/QWidgets"`
- users will want to have all such includes spelled with `<>` instead.
- if filter is by resolved path, they can just create filters corresponding to 
include search paths, i.e. `AngledHeaders: third_party/qt/include/.*`
- if filter is by spelling instead either the user needs to overgeneralize and 
have a filter like `Qt.*/.*` or spell multiple directory names like 
`QtWidgets/.*`, `QtCharts/.*`, .. the situation gets more problematic when the 
library is flat in hierarchy without any directory names.

Hence I'd still lean towards matching against resolved path instead, I'd also 
like to highlight that we're matching against a `suffix` of the resolved path. 
Hence it also covers regexes that just match spelled headers(except objc 
frameworks, but they're very explicit from compiler flags already), but it 
gives people more precision when needed. FWIW, clang-include-cleaner's header 
filters are also based on matching against suffix of a resolved path.

As for `either absolute path or path relative to the execution`, this is mostly 
for the cases where a header is referring to some source file outside of the 
project (e.g. some system-installed library), that being said path handling is 
hard and it can at times refer to in-project sources through absolute paths as 
well. But in general I think this shouldn't matter, as we're matching against 
suffix of that path.

P.S, when matching against spellings, we're also matching against a suffix of 
those spellings today. It might be worthwhile to re-consider that too if we're 
going down that path.

https://github.com/llvm/llvm-project/pull/140594
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to