aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-07-17 15:57:33 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-07-17 15:57:33 +0200
commitab4a9ef42e8f1070dcb5d783a5afccd2f685e86d (patch)
tree23c7c9420d313076814d91656b9717fc3dd60b68 /libbuild2/rule.cxx
parentb74a1e44cb4478356e4261ce0050de744e42d122 (diff)
Add optimized derive_path_with_extension(), use in file_rule
Diffstat (limited to 'libbuild2/rule.cxx')
-rw-r--r--libbuild2/rule.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx
index 7ccee4e..4b2d69d 100644
--- a/libbuild2/rule.cxx
+++ b/libbuild2/rule.cxx
@@ -94,13 +94,15 @@ namespace build2
// derivation function to treat this as a prerequisite (just like in
// search_existing_file()).
//
- if (pt->derive_extension (true) == nullptr)
+ if (const string* e = pt->derive_extension (true))
+ {
+ p = &pt->derive_path_with_extension (*e);
+ }
+ else
{
l4 ([&]{trace << "no default extension for target " << *pt;});
return false;
}
-
- p = &pt->derive_path ();
}
ts = mtime (*p);