Loading parser.cpp +14 −0 Changes for parser.cpp: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1258,6 +1258,20 @@ std::string Parser::func_wildcard(const std::string& pattern) const { std::vector<std::string> results; for (const auto& pat : patterns) { // Fast path: a literal pattern (no glob metacharacters) does not need a // directory scan. GNU make's $(wildcard foo) just checks if foo exists. // This matters for performance: Kbuild .cmd files contain dozens of // $(wildcard include/config/FOO) per object, and include/config can hold // thousands of entries. Scanning the whole directory for every literal // lookup is catastrophically slow, so stat the path directly instead. if (pat.find_first_of("*?[") == std::string::npos) { std::error_code ec; if (fs::exists(pat, ec)) { results.push_back(pat); } continue; } fs::path p(pat); fs::path dir = p.parent_path(); std::string name_pat = p.filename().string(); Loading Loading
parser.cpp +14 −0 Changes for parser.cpp: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1258,6 +1258,20 @@ std::string Parser::func_wildcard(const std::string& pattern) const { std::vector<std::string> results; for (const auto& pat : patterns) { // Fast path: a literal pattern (no glob metacharacters) does not need a // directory scan. GNU make's $(wildcard foo) just checks if foo exists. // This matters for performance: Kbuild .cmd files contain dozens of // $(wildcard include/config/FOO) per object, and include/config can hold // thousands of entries. Scanning the whole directory for every literal // lookup is catastrophically slow, so stat the path directly instead. if (pat.find_first_of("*?[") == std::string::npos) { std::error_code ec; if (fs::exists(pat, ec)) { results.push_back(pat); } continue; } fs::path p(pat); fs::path dir = p.parent_path(); std::string name_pat = p.filename().string(); Loading