aboutsummaryrefslogtreecommitdiff
path: root/build2/algorithm.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-06-01 15:18:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-06-01 15:18:08 +0200
commitf36d3e02033ff2f9d14cb20a6d338c8bb09a3962 (patch)
tree94d610b8f7a344aa200f1e9165f5ec18fb7c1959 /build2/algorithm.cxx
parenta8b6e14fdce2c950a42cc007e0413c1635161fce (diff)
Implement module interface unit compilation for Clang and VC
Diffstat (limited to 'build2/algorithm.cxx')
-rw-r--r--build2/algorithm.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx
index 156a209..8f555dd 100644
--- a/build2/algorithm.cxx
+++ b/build2/algorithm.cxx
@@ -244,6 +244,33 @@ namespace build2
sched.resume (t.task_count);
}
+ target_lock
+ add_adhoc_member (action a, target& t, const target_type& tt, const char* s)
+ {
+ string n (t.name);
+ if (s != nullptr)
+ {
+ n += '.';
+ n += s;
+ }
+
+ const target& m (t.member != nullptr // Might already be there.
+ ? *t.member
+ : search (t, tt, t.dir, t.out, n));
+
+ target_lock l (lock (a, m));
+ assert (l.target != nullptr); // Someone messing with ad hoc members?
+
+ if (t.member == nullptr)
+ t.member = l.target;
+ else
+ // Basic sanity check.
+ //
+ assert (t.member->type () == tt && t.member->name == n);
+
+ return l;
+ };
+
// Return the matching rule and the recipe action.
//
pair<const pair<const string, reference_wrapper<const rule>>*, action>