aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/dump.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-05-02 13:05:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-05-03 05:03:20 +0200
commit7a458f210f296cb3cc1551a4606f0cf025003f3a (patch)
tree71b20a6c67fb9b6801916406391c34e6710c3c2e /libbuild2/dump.cxx
parentf66848dbd677b1027bade5728e04954c313231af (diff)
Add --dump-scope and --dump-target options to limit --dump output
Diffstat (limited to 'libbuild2/dump.cxx')
-rw-r--r--libbuild2/dump.cxx40
1 files changed, 27 insertions, 13 deletions
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<action> 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 << "<no known scope to dump>";
+
os << endl;
}
void
- dump (const target& t, const char* cind)
+ dump (const target* t, optional<action> 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 << "<no known target to dump>";
+
os << endl;
}
}