From 54e24990203f5e123396a44297ea4656ed3b6101 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 26 Apr 2015 09:53:41 +0200 Subject: Rework resolved prerequisite targets storage --- build/dump.cxx | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'build/dump.cxx') diff --git a/build/dump.cxx b/build/dump.cxx index 9299a86..3f8eb15 100644 --- a/build/dump.cxx +++ b/build/dump.cxx @@ -19,25 +19,47 @@ using namespace std; namespace build { static void - dump_target (ostream& os, const target& t) + dump_target (ostream& os, action a, const target& t) { - //@@ Need to print group info somehow. + os << t; - os << t << ':'; + if (t.group != nullptr) + os << "->" << *t.group; - for (const prerequisite_target& pe: t.prerequisites) + os << ':'; + + // If the target has been matched to a rule, print resolved + // prerequisite targets. + // + if (t.recipe (a)) { - os << ' '; + for (const target* pt: t.prerequisite_targets) + { + if (pt == nullptr) // Skipped. + continue; - if (pe.target != nullptr) - os << *pe.target; - else - os << *pe.prereq; + os << ' ' << *pt; + } + } + else + { + for (const prerequisite& p: t.prerequisites) + { + os << ' '; + + // Print it as target if one has been cached. + // + if (p.target != nullptr) + os << *p.target; + else + os << p; + } } } static void dump_scope (ostream& os, + action a, scope& p, scope_map::iterator& i, string& ind, @@ -94,7 +116,7 @@ namespace build os << endl; scope& s (i->second); - dump_scope (os, s, ++i, ind, rts); + dump_scope (os, a, s, ++i, ind, rts); sb = true; } @@ -141,7 +163,7 @@ namespace build os << endl << ind; - dump_target (os, t); + dump_target (os, a, t); } ind.resize (ind.size () - 2); @@ -152,7 +174,7 @@ namespace build } void - dump () + dump (action a) { auto i (scopes.begin ()); scope& g (i->second); // Global scope. @@ -162,7 +184,7 @@ namespace build set rts; ostream& os (*diag_stream); - dump_scope (os, g, ++i, ind, rts); + dump_scope (os, a, g, ++i, ind, rts); os << endl; } } -- cgit v1.1