================ @@ -483,6 +483,72 @@ struct FragmentCompiler { FullyQualifiedNamespaces.begin(), FullyQualifiedNamespaces.end()); }); } + +// 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 : F.AngledHeaders) { + // Anchor on the right. + std::string AnchoredPattern = "(" + *HeaderPattern + ")$"; + llvm::Regex CompiledRegex(AnchoredPattern, Flags); + std::string RegexError; + if (!CompiledRegex.isValid(RegexError)) { + diag(Warning, + llvm::formatv("Invalid regular expression '{0}': {1}", + *HeaderPattern, RegexError) + .str(), + HeaderPattern.Range); + continue; + } + Filters->push_back(std::move(CompiledRegex)); + } + if (Filters->empty()) + return; ---------------- zyn0217 wrote:
I think this is why you're seeing the puzzling behavior: You've bailed out of parsing the `QuotedHeaders` block if don't see any `AngledHeaders` field. Perhaps extract these two blocks into separate functions? https://github.com/llvm/llvm-project/pull/67749 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits