diff options
Diffstat (limited to 'libbuild2')
-rw-r--r-- | libbuild2/algorithm.cxx | 16 | ||||
-rw-r--r-- | libbuild2/algorithm.hxx | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx index 7788b90..4e47c63 100644 --- a/libbuild2/algorithm.cxx +++ b/libbuild2/algorithm.cxx @@ -112,6 +112,8 @@ namespace build2 assert (s.ctx.phase == run_phase::match || s.ctx.phase == run_phase::execute); + // See also scope::find_prerequisite_key(). + // name n (cn); auto rp (s.find_target_type (n, location ())); const target_type* tt (rp.first); @@ -139,6 +141,20 @@ namespace build2 : search_existing_target (s.ctx, pk); } + const target* + search_existing (const names& ns, const scope& s) + { + if (size_t n = ns.size ()) + { + if (n == (ns[0].pair ? 2 : 1)) + { + return search_existing (ns[0], s, n == 1 ? dir_path () : ns[1].dir); + } + } + + fail << "invalid target name: " << ns << endf; + } + // target_lock // // Note that the stack may contain locks for targets from multiple nested diff --git a/libbuild2/algorithm.hxx b/libbuild2/algorithm.hxx index 28b76c4..ad4ee74 100644 --- a/libbuild2/algorithm.hxx +++ b/libbuild2/algorithm.hxx @@ -101,6 +101,9 @@ namespace build2 const scope&, const dir_path& out = dir_path ()); + LIBBUILD2_SYMEXPORT const target* + search_existing (const names&, const scope&); + // Target match lock: a non-const target reference and the target::offset_* // state that has already been "achieved". Note that target::task_count // itself is set to busy for the duration or the lock. While at it we also |