From c6b1d1dd870b3370d0a09fb4600e3a6b03326f35 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 23 Nov 2022 08:57:45 +0200 Subject: Rework diag_buffer interface to facilitate correct destruction order --- libbuild2/cc/link-rule.cxx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'libbuild2/cc/link-rule.cxx') diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index 9bf86e6..20c6c62 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -2892,8 +2892,6 @@ namespace build2 env_ptrs.push_back (nullptr); } - diag_buffer dbuf (ctx); - // If targeting Windows, take care of the manifest. // path manifest; // Manifest itself (msvc) or compiled object file. @@ -2949,12 +2947,14 @@ namespace build2 // process pr (rc, args, - -1 /* stdin */, - 1 /* stdout */, - dbuf.open (args[0]) /* stderr */, - nullptr /* cwd */, + -1 /* stdin */, + 1 /* stdout */, + diag_buffer::pipe (ctx) /* stderr */, + nullptr /* cwd */, env_ptrs.empty () ? nullptr : env_ptrs.data ()); + diag_buffer dbuf (ctx, args[0], pr); + try { ofdstream os (move (pr.out_fd)); @@ -4038,12 +4038,14 @@ namespace build2 process pr (*ld, args, - 0 /* stdin */, - 2 /* stdout */, - dbuf.open (args[0], filter) /* stderr */, - nullptr /* cwd */, + 0 /* stdin */, + 2 /* stdout */, + diag_buffer::pipe (ctx, filter /* force */) /* stderr */, + nullptr /* cwd */, env_ptrs.empty () ? nullptr : env_ptrs.data ()); + diag_buffer dbuf (ctx, args[0], pr); + if (filter) msvc_filter_link (dbuf, t, ot); @@ -4127,7 +4129,7 @@ namespace build2 if (!ctx.dry_run) { - run (dbuf, + run (ctx, rl, args, 1 /* finish_verbosity */, -- cgit v1.1