[clang-tools-extra] [clangd] Allow specifying what headers are always included via "" or <> (PR #67749)
kleines Filmröllchen via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 11 11:53:37 PDT 2023
================
@@ -483,6 +483,56 @@ struct FragmentCompiler {
FullyQualifiedNamespaces.begin(), FullyQualifiedNamespaces.end());
});
}
+ auto QuotedFilter = compileHeaderRegexes(F.QuotedHeaders);
+ if (QuotedFilter.has_value()) {
+ Out.Apply.push_back(
+ [QuotedFilter = *QuotedFilter](const Params &, Config &C) {
+ C.Style.QuotedHeaders.emplace_back(QuotedFilter);
+ });
+ }
+ auto AngledFilter = compileHeaderRegexes(F.AngledHeaders);
+ if (AngledFilter.has_value()) {
+ Out.Apply.push_back(
+ [AngledFilter = *AngledFilter](const Params &, Config &C) {
+ C.Style.AngledHeaders.emplace_back(AngledFilter);
+ });
+ }
+ }
+
+ auto compileHeaderRegexes(llvm::ArrayRef<Located<std::string>> HeaderPatterns)
+ -> std::optional<std::function<bool(llvm::StringRef)>> {
+ // TODO: Share this code with Diagnostics.Includes.IgnoreHeader
+#ifdef CLANGD_PATH_CASE_INSENSITIVE
+ static llvm::Regex::RegexFlags Flags = llvm::Regex::IgnoreCase;
+#else
+ static llvm::Regex::RegexFlags Flags = llvm::Regex::NoFlags;
+#endif
+ auto Filters = std::make_shared<std::vector<llvm::Regex>>();
+ for (auto &HeaderPattern : HeaderPatterns) {
+ elog("found angle pattern {0}", *HeaderPattern);
----------------
kleinesfilmroellchen wrote:
Oops, that's not supposed to be there anymore 😅
https://github.com/llvm/llvm-project/pull/67749
More information about the cfe-commits
mailing list