Context::set_ignore_options(const std::vector<std::string>& options)
{
for (const std::string& option : options) {
- std::size_t n_wildcards = std::count(option.cbegin(), option.cend(), '*');
+ size_t n_wildcards = std::count(option.cbegin(), option.cend(), '*');
if (n_wildcards == 0 || (n_wildcards == 1 && option.back() == '*')) {
m_ignore_options.push_back(option);
} else {
static bool
option_should_be_ignored(const std::string& arg,
- const std::vector<std::string>& ignore_options)
+ const std::vector<std::string>& patterns)
{
- auto pred = [&arg](const std::string& option) {
- const auto& prefix = string_view(option).substr(0, option.length() - 1);
- return (
- option == arg
- || (Util::ends_with(option, "*") && Util::starts_with(arg, prefix)));
- };
- return std::any_of(ignore_options.cbegin(), ignore_options.cend(), pred);
+ return std::any_of(
+ patterns.cbegin(), patterns.cend(), [&arg](const std::string& pattern) {
+ const auto& prefix = string_view(pattern).substr(0, pattern.length() - 1);
+ return (
+ pattern == arg
+ || (Util::ends_with(pattern, "*") && Util::starts_with(arg, prefix)));
+ });
}
// Update a hash sum with information specific to the direct and preprocessor