aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/link-rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-11-23 08:57:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-11-23 08:57:45 +0200
commitc6b1d1dd870b3370d0a09fb4600e3a6b03326f35 (patch)
treef400b0d4a67bd1e067b545372e7742c5665f5caf /libbuild2/cc/link-rule.cxx
parentf19959de304afaff2b3d539c9bef1f493ede5fbd (diff)
Rework diag_buffer interface to facilitate correct destruction order
Diffstat (limited to 'libbuild2/cc/link-rule.cxx')
-rw-r--r--libbuild2/cc/link-rule.cxx24
1 files changed, 13 insertions, 11 deletions
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 */,