diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-10-04 10:52:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-10-04 10:52:15 +0200 |
commit | 3d224bcb822081c4aa54a82d514bea07f7c459fe (patch) | |
tree | 66408aa900018ae81defb1f25ba08e9f615cacf4 /libbuild2/cc/compile-rule.cxx | |
parent | e1a1d978d364c723935acfc7b56fae8b8253d054 (diff) |
Optimize internal scope implementation
Diffstat (limited to 'libbuild2/cc/compile-rule.cxx')
-rw-r--r-- | libbuild2/cc/compile-rule.cxx | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index 9149f0c..c6ecf5e 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -509,22 +509,21 @@ namespace build2 // are outside of the internal scope provided the library is not // whitelisted. // - auto whitelist = [&l] (const strings* pats) + auto whitelist = [&l] (const strings& pats) { - return (pats != nullptr && - find_if (pats->begin (), pats->end (), + return find_if (pats.begin (), pats.end (), [&l] (const string& pat) { return path_match (l.name, pat); - }) != pats->end ()); + }) != pats.end (); }; const scope* is (d.is); - if (is != nullptr && whitelist (c_internal_libs)) + if (is != nullptr && c_ilibs != nullptr && whitelist (*c_ilibs)) is = nullptr; - if (is != nullptr && whitelist (x_internal_libs)) + if (is != nullptr && x_ilibs != nullptr && whitelist (*x_ilibs)) is = nullptr; for (auto i (ops->begin ()), e (ops->end ()); i != e; ++i) @@ -654,10 +653,7 @@ namespace build2 const scope& bs, action a, const file& l, bool la, linfo li) const { - const scope* is (isystem (*this) - ? effective_internal_scope (bs) - : nullptr); - + const scope* is (isystem (*this) ? effective_iscope (bs) : nullptr); append_library_options (ls, args, bs, is, a, l, la, li, nullptr); } @@ -667,10 +663,10 @@ namespace build2 const scope& bs, action a, const target& t, linfo li) const { - auto internal_scope = [this, &bs, is = optional<const scope*> ()] () mutable + auto iscope = [this, &bs, is = optional<const scope*> ()] () mutable { if (!is) - is = isystem (*this) ? effective_internal_scope (bs) : nullptr; + is = isystem (*this) ? effective_iscope (bs) : nullptr; return *is; }; @@ -698,7 +694,7 @@ namespace build2 { append_library_options (ls, args, - bs, internal_scope (), + bs, iscope (), a, *f, la, li, &lc); } |