From f36d3e02033ff2f9d14cb20a6d338c8bb09a3962 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 1 Jun 2017 15:18:08 +0200 Subject: Implement module interface unit compilation for Clang and VC --- build2/algorithm.cxx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'build2/algorithm.cxx') 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>*, action> -- cgit v1.1