aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-05-28 14:03:12 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-05-28 14:03:12 +0200
commit27547e341f32782ad2d7fd998dde1cb04f4bf1db (patch)
treea87ec58755cb133566b5c1fafae4d68bebeeed09
parentcd651d5ca3572413180827232eb18239750befca (diff)
Allow calling certain search_existing() versions during load phase
This is necessary for $target.path() implementation.
-rw-r--r--libbuild2/algorithm.cxx5
-rw-r--r--libbuild2/algorithm.hxx10
-rw-r--r--libbuild2/file.hxx3
-rw-r--r--libbuild2/file.ixx1
4 files changed, 9 insertions, 10 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index 11f2a56..0924540 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -71,8 +71,6 @@ namespace build2
const target*
search_existing (context& ctx, const prerequisite_key& pk)
{
- assert (ctx.phase == run_phase::match || ctx.phase == run_phase::execute);
-
return pk.proj
? import_existing (ctx, pk)
: search_existing_target (ctx, pk);
@@ -109,9 +107,6 @@ namespace build2
const target*
search_existing (const name& cn, const scope& s, const dir_path& out)
{
- assert (s.ctx.phase == run_phase::match ||
- s.ctx.phase == run_phase::execute);
-
// See also scope::find_prerequisite_key().
//
name n (cn);
diff --git a/libbuild2/algorithm.hxx b/libbuild2/algorithm.hxx
index 390516a..de09469 100644
--- a/libbuild2/algorithm.hxx
+++ b/libbuild2/algorithm.hxx
@@ -23,7 +23,8 @@ namespace build2
LIBBUILD2_SYMEXPORT const target&
search (const target&, const prerequisite&);
- // As above but only search for an already existing target.
+ // As above but only search for an already existing target. Note that unlike
+ // the above, this version can be called during the execute phase.
//
LIBBUILD2_SYMEXPORT const target*
search_existing (const prerequisite&);
@@ -38,6 +39,9 @@ namespace build2
LIBBUILD2_SYMEXPORT const target&
search (const target&, const prerequisite_key&);
+ // Note that unlike the above version, this one can be called during the
+ // load and execute phases.
+ //
LIBBUILD2_SYMEXPORT const target*
search_existing (context&, const prerequisite_key&);
@@ -94,8 +98,8 @@ namespace build2
LIBBUILD2_SYMEXPORT const target&
search (const target&, name, const scope&);
- // Unlike the above version, this one can be called during the execute
- // phase. Return NULL for unknown target types.
+ // Return NULL for unknown target types. Note that unlike the above version,
+ // these ones can be called during the load and execute phases.
//
LIBBUILD2_SYMEXPORT const target*
search_existing (const name&,
diff --git a/libbuild2/file.hxx b/libbuild2/file.hxx
index 78be600..3bceb80 100644
--- a/libbuild2/file.hxx
+++ b/libbuild2/file.hxx
@@ -389,7 +389,8 @@ namespace build2
operator<< (ostream&, const pair<const exe*, import_kind>&);
// As import phase 2 but only imports as an already existing target. But
- // unlike it, this function can be called during the execute phase.
+ // unlike it, this function can be called during the load and execute
+ // phases.
//
// Note: similar to search_existing().
//
diff --git a/libbuild2/file.ixx b/libbuild2/file.ixx
index 7c09d3d..4a9f411 100644
--- a/libbuild2/file.ixx
+++ b/libbuild2/file.ixx
@@ -80,7 +80,6 @@ namespace build2
inline const target*
import_existing (context& ctx, const prerequisite_key& pk)
{
- assert (ctx.phase == run_phase::match || ctx.phase == run_phase::execute);
return import (ctx, pk, false, nullopt, true, location ());
}
}