diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-06-16 16:22:48 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-06-16 16:22:48 +0200 |
commit | 5c8de4f515c99d894bec764a6793352c9cad0825 (patch) | |
tree | 6a590192c8010e19d9fa152058ba382ec160d603 /build2/algorithm.ixx | |
parent | f3e193b2651b2589daecaf181b96c5622acc51e9 (diff) |
Add support for explicitly specifying module name on mxx{} target
Diffstat (limited to 'build2/algorithm.ixx')
-rw-r--r-- | build2/algorithm.ixx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx index 27759c9..4885ecf 100644 --- a/build2/algorithm.ixx +++ b/build2/algorithm.ixx @@ -29,6 +29,38 @@ namespace build2 return *r; } + const target* + search_existing_target (const prerequisite_key&); // <build2/search.hxx> + + const target* + import_existing (const prerequisite_key&); // <build2/file.hxx> + + inline const target* + search_existing (const prerequisite& p) + { + assert (phase == run_phase::match); // Could be relaxed. + + const target* r (p.target.load (memory_order_consume)); + + if (r == nullptr) + { + const prerequisite_key& pk (p.key ()); + r = pk.proj ? import_existing (pk) : search_existing_target (pk); + + if (r != nullptr) + { + const target* e (nullptr); + if (!p.target.compare_exchange_strong ( + e, r, + memory_order_release, + memory_order_consume)) + assert (e == r); + } + } + + return r; + } + inline const target& search (const target& t, const target_type& tt, const prerequisite_key& k) { |