From 17b3a78696f0b1fd6f0f60d53ec568cf3b9e32b4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 1 Jul 2015 09:11:31 +0200 Subject: Cleanup group "see through" design --- build/cxx/rule.cxx | 60 +++++------------------------------------------------- 1 file changed, 5 insertions(+), 55 deletions(-) (limited to 'build/cxx/rule.cxx') diff --git a/build/cxx/rule.cxx b/build/cxx/rule.cxx index 84e2f91..0812922 100644 --- a/build/cxx/rule.cxx +++ b/build/cxx/rule.cxx @@ -128,19 +128,8 @@ namespace build // When cleaning, ignore prerequisites that are not in the same // or a subdirectory of ours. // - const auto& ps (group_prerequisite_members (a, t)); - for (auto i (ps.begin ()); i != ps.end (); ++i) + for (prerequisite_member p: group_prerequisite_members (a, t)) { - prerequisite_member p (*i); - - // See through the group unless it is one that we recognize. - // - if (p.is_a ()) - { - if (!p.is_a ()) - continue; - } - target& pt (p.search ()); if (a.operation () == clean_id && !pt.dir.sub (t.dir)) @@ -155,10 +144,7 @@ namespace build // populated; see append_lib_options() above. // if (pt.is_a () || pt.is_a () || pt.is_a ()) - { - i.skip_group (); // Don't go inside the lib{} group. continue; - } t.prerequisite_targets.push_back (&pt); } @@ -855,11 +841,8 @@ namespace build bool seen_cxx (false), seen_c (false), seen_obj (false), seen_lib (false); - const auto& ps (group_prerequisite_members (a, t)); - for (auto i (ps.begin ()); i != ps.end (); ++i) + for (prerequisite_member p: group_prerequisite_members (a, t)) { - prerequisite_member p (*i); - if (p.is_a ()) { seen_cxx = seen_cxx || true; @@ -880,14 +863,12 @@ namespace build p.is_a ()) { seen_obj = seen_obj || true; - i.skip_group (); // Don't go inside the obj{} group. } else if (p.is_a () || p.is_a () || p.is_a ()) { seen_lib = seen_lib || true; - i.skip_group (); // Don't go inside the lib{} group. } else if (p.is_a () || p.is_a () || @@ -895,8 +876,6 @@ namespace build p.is_a () || p.is_a ()) ; - else if (p.is_a ()) - ; // See through. else { level3 ([&]{trace << "unexpected prerequisite type " << p.type ();}); @@ -953,22 +932,9 @@ namespace build // Process prerequisites: do rule chaining for C and C++ source // files as well as search and match. // - const auto& ps (group_prerequisite_members (a, t)); - for (auto i (ps.begin ()); i != ps.end (); ++i) + for (prerequisite_member p: group_prerequisite_members (a, t)) { - prerequisite_member p (*i); - - // See through the group unless it is one that we recognize. - // - if (p.is_a ()) - { - if (!p.is_a () && - !p.is_a ()) - continue; - } - bool group (!p.prerequisite.belongs (t)); // Group's prerequisite. - target* pt (nullptr); if (!p.is_a () && !p.is_a ()) @@ -982,7 +948,6 @@ namespace build // If this is the obj{} or lib{} target group, then pick the // appropriate member and make sure it is searched and matched. - // In both cases, skip going over the group's members. // if (obj* o = pt->is_a ()) { @@ -991,8 +956,6 @@ namespace build if (pt == nullptr) pt = &search (so ? objso::static_type : obja::static_type, p.key ()); - - i.skip_group (); } else if (lib* l = pt->is_a ()) { @@ -1028,8 +991,6 @@ namespace build if (pt == nullptr) pt = &search (lso ? libso::static_type : liba::static_type, p.key ()); - - i.skip_group (); } build::match (a, *pt); @@ -1120,19 +1081,9 @@ namespace build // searching and matching speculatively doesn't really hurt. // bool found (false); - const auto& ps (reverse_group_prerequisite_members (a, *pt)); - for (auto i (ps.begin ()); i != ps.end (); ++i) + for (prerequisite_member p1: + reverse_group_prerequisite_members (a, *pt)) { - prerequisite_member p1 (*i); - - // See through the group unless it is one that we recognize. - // - if (p1.is_a ()) - { - if (!p1.is_a ()) - continue; - } - // Ignore some known target types (fsdir, headers, libraries). // if (p1.is_a () || @@ -1144,7 +1095,6 @@ namespace build p1.is_a () || p1.is_a ()) { - i.skip_group (); // Skip going inside lib{}. continue; } -- cgit v1.1