aboutsummaryrefslogtreecommitdiff
path: root/build2/target.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-09-01 17:33:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-09-01 17:33:44 +0200
commit53105890d75789c81adbb3d781eff9ebd7110222 (patch)
treeda93174356fc2d0a80f49b11e0cd16e7c71b7c80 /build2/target.ixx
parent631c76d7613458dbef208ca056e194e94a5becf3 (diff)
Add support for try_match(), use to handle deleted headers
Diffstat (limited to 'build2/target.ixx')
-rw-r--r--build2/target.ixx15
1 files changed, 13 insertions, 2 deletions
diff --git a/build2/target.ixx b/build2/target.ixx
index 459265b..9b4b9d8 100644
--- a/build2/target.ixx
+++ b/build2/target.ixx
@@ -92,9 +92,20 @@ namespace build2
{
// Note that the target could be being asynchronously re-matched.
//
- target_state r (state (a));
+ pair<bool, target_state> r (state (a));
- if (fail && r == target_state::failed)
+ if (fail && (!r.first || r.second == target_state::failed))
+ throw failed ();
+
+ return r.second;
+ }
+
+ inline pair<bool, target_state> target::
+ try_matched_state (action_type a, bool fail) const
+ {
+ pair<bool, target_state> r (state (a));
+
+ if (fail && r.first && r.second == target_state::failed)
throw failed ();
return r;