aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build/script/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2025-02-03 06:46:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2025-02-03 06:48:19 +0200
commit43eb1e43b6b22a0343104387431db7f32a88b16c (patch)
tree15b90b59ac4748bfa923190eb91952b5a613992b /libbuild2/build/script/parser.cxx
parent4ed0fe15d139748784adb40841028b36704b2f4f (diff)
Optimize maybe-used diag_record
It turns out the std::ostringstream member of butl::diag_record is quite expensive to construct but to never use.
Diffstat (limited to 'libbuild2/build/script/parser.cxx')
-rw-r--r--libbuild2/build/script/parser.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/libbuild2/build/script/parser.cxx b/libbuild2/build/script/parser.cxx
index c9193ff..0199137 100644
--- a/libbuild2/build/script/parser.cxx
+++ b/libbuild2/build/script/parser.cxx
@@ -106,7 +106,7 @@ namespace build2
// name from the script operation first.
//
{
- diag_record dr;
+ maybe_diag_record dr;
if (!diag_name_ && diag_preamble_.empty ())
{
@@ -131,7 +131,7 @@ namespace build2
<< "'";
}
- if (!dr.empty ())
+ if (dr)
{
dr << info << "consider specifying it explicitly with the 'diag' "
<< "recipe attribute";
@@ -2507,8 +2507,8 @@ namespace build2
//
bool df (!ctx.match_only && !ctx.dry_run_option);
- diag_record dr;
- dr << error << what << ' ' << f << " not found and no rule to "
+ diag_record dr (error);
+ dr << what << ' ' << f << " not found and no rule to "
<< "generate it";
if (df)