From 7a458f210f296cb3cc1551a4606f0cf025003f3a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 2 May 2023 13:05:27 +0200 Subject: Add --dump-scope and --dump-target options to limit --dump output --- libbuild2/dump.cxx | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'libbuild2/dump.cxx') diff --git a/libbuild2/dump.cxx b/libbuild2/dump.cxx index 4ee75ee..e00d1b9 100644 --- a/libbuild2/dump.cxx +++ b/libbuild2/dump.cxx @@ -651,29 +651,43 @@ namespace build2 } void - dump (const scope& s, const char* cind) + dump (const scope* s, optional a, const char* cind) { - const scope_map& m (s.ctx.scopes); - auto i (m.find_exact (s.out_path ())); - assert (i != m.end () && i->second.front () == &s); - string ind (cind); ostream& os (*diag_stream); - dump_scope (nullopt /* action */, os, ind, i, false /* relative */); + + if (s != nullptr) + { + const scope_map& m (s->ctx.scopes); + auto i (m.find_exact (s->out_path ())); + assert (i != m.end () && i->second.front () == s); + + dump_scope (a, os, ind, i, false /* relative */); + } + else + os << ind << ""; + os << endl; } void - dump (const target& t, const char* cind) + dump (const target* t, optional a, const char* cind) { string ind (cind); ostream& os (*diag_stream); - dump_target (nullopt /* action */, - os, - ind, - t, - t.base_scope (), - false /* relative */); + + if (t != nullptr) + { + dump_target (a, + os, + ind, + *t, + t->base_scope (), + false /* relative */); + } + else + os << ind << ""; + os << endl; } } -- cgit v1.1