aboutsummaryrefslogtreecommitdiff
path: root/build2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-04-27 08:29:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-04-27 08:29:52 +0200
commitc2001eb367b9b82e26689cad6f1f74f46c72b904 (patch)
treedb2ee46fc11989d85201ccebaf44f51b978fb313 /build2
parent530e19cc8f53f066039967c41bb432111ce98626 (diff)
Pass target to prerequisite search
Diffstat (limited to 'build2')
-rw-r--r--build2/algorithm20
-rw-r--r--build2/algorithm.cxx15
-rw-r--r--build2/algorithm.ixx18
-rw-r--r--build2/bin/rule.cxx4
-rw-r--r--build2/bin/target.cxx16
-rw-r--r--build2/cc/compile.cxx12
-rw-r--r--build2/cc/install.cxx2
-rw-r--r--build2/cc/link.cxx12
-rw-r--r--build2/cc/target.cxx6
-rw-r--r--build2/cli/rule.cxx9
-rw-r--r--build2/cli/target.cxx4
-rw-r--r--build2/cxx/target.cxx8
-rw-r--r--build2/dist/rule.cxx2
-rw-r--r--build2/install/rule.cxx4
-rw-r--r--build2/target39
-rw-r--r--build2/target-type2
-rw-r--r--build2/target.cxx40
-rw-r--r--build2/target.txx2
-rw-r--r--build2/test/rule.cxx6
-rw-r--r--build2/test/target.cxx2
-rw-r--r--build2/version/rule.cxx2
21 files changed, 120 insertions, 105 deletions
diff --git a/build2/algorithm b/build2/algorithm
index 7325fac..da38f19 100644
--- a/build2/algorithm
+++ b/build2/algorithm
@@ -18,34 +18,35 @@ namespace build2
class prerequisite_key;
// The default prerequisite search implementation. It first calls the
- // target-type-specific search function. If that doesn't yeld anything,
- // it creates a new target.
+ // prerequisite-type-specific search function. If that doesn't yeld
+ // anything, it creates a new target.
//
const target&
- search (const prerequisite&);
+ search (const target&, const prerequisite&);
// As above but specify the prerequisite to search as a key.
//
const target&
- search (const prerequisite_key&);
+ search (const target&, const prerequisite_key&);
// Uniform search interface for prerequisite/prerequisite_member.
//
inline const target&
- search (const prerequisite_member& p) {return p.search ();}
+ search (const target& t, const prerequisite_member& p) {return p.search (t);}
// As above but override the target type. Useful for searching for
// target group members where we need to search for a different
// target type.
//
const target&
- search (const target_type&, const prerequisite_key&);
+ search (const target&, const target_type&, const prerequisite_key&);
// As above but specify the prerequisite to search as individual key
// components. Scope can be NULL if the directory is absolute.
//
const target&
- search (const target_type& type,
+ search (const target&,
+ const target_type& type,
const dir_path& dir,
const dir_path& out,
const string& name,
@@ -57,7 +58,8 @@ namespace build2
//
template <typename T>
const T&
- search (const dir_path& dir,
+ search (const target&,
+ const dir_path& dir,
const dir_path& out,
const string& name,
const string* ext = nullptr,
@@ -68,7 +70,7 @@ namespace build2
// as the parser would and then searched based on this prerequisite.
//
const target&
- search (name, const scope&);
+ search (const target&, name, const scope&);
// As above but only search for an already existing target. Unlike the above
// version, this one can be called during the execute phase. Return NULL for
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx
index 51a683c..049df0c 100644
--- a/build2/algorithm.cxx
+++ b/build2/algorithm.cxx
@@ -20,7 +20,7 @@ using namespace butl;
namespace build2
{
const target&
- search (const prerequisite_key& pk)
+ search (const target& t, const prerequisite_key& pk)
{
assert (phase == run_phase::match);
@@ -30,14 +30,14 @@ namespace build2
if (pk.proj)
return import (pk);
- if (const target* t = pk.tk.type->search (pk))
- return *t;
+ if (const target* pt = pk.tk.type->search (t, pk))
+ return *pt;
return create_new_target (pk);
}
const target&
- search (name n, const scope& s)
+ search (const target& t, name n, const scope& s)
{
assert (phase == run_phase::match);
@@ -53,7 +53,8 @@ namespace build2
// @@ OUT: for now we assume the prerequisite's out is undetermined.
// Would need to pass a pair of names.
//
- return search (*tt,
+ return search (t,
+ *tt,
n.dir,
dir_path (),
n.value,
@@ -634,7 +635,7 @@ namespace build2
size_t i (pts.size ()); // Index of the first to be added.
for (auto&& p: forward<R> (r))
{
- const target& pt (search (p));
+ const target& pt (search (t, p));
if (s != nullptr && !pt.in (*s))
continue;
@@ -733,7 +734,7 @@ namespace build2
// Target is in the out tree, so out directory is empty.
//
const fsdir* r (
- &search<fsdir> (d, dir_path (), string (), nullptr, nullptr));
+ &search<fsdir> (t, d, dir_path (), string (), nullptr, nullptr));
match (a, *r);
t.prerequisite_targets.emplace_back (r);
return r;
diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx
index e1f8ddc..d39bf9c 100644
--- a/build2/algorithm.ixx
+++ b/build2/algorithm.ixx
@@ -8,7 +8,7 @@
namespace build2
{
inline const target&
- search (const prerequisite& p)
+ search (const target& t, const prerequisite& p)
{
assert (phase == run_phase::match);
@@ -16,7 +16,7 @@ namespace build2
if (r == nullptr)
{
- r = &search (p.key ());
+ r = &search (t, p.key ());
const target* e (nullptr);
if (!p.target.compare_exchange_strong (
@@ -30,15 +30,17 @@ namespace build2
}
inline const target&
- search (const target_type& t, const prerequisite_key& k)
+ search (const target& t, const target_type& tt, const prerequisite_key& k)
{
return search (
+ t,
prerequisite_key {
- k.proj, {&t, k.tk.dir, k.tk.out, k.tk.name, k.tk.ext}, k.scope});
+ k.proj, {&tt, k.tk.dir, k.tk.out, k.tk.name, k.tk.ext}, k.scope});
}
inline const target&
- search (const target_type& type,
+ search (const target& t,
+ const target_type& type,
const dir_path& dir,
const dir_path& out,
const string& name,
@@ -47,6 +49,7 @@ namespace build2
const optional<string>& proj)
{
return search (
+ t,
prerequisite_key {
proj,
{
@@ -61,14 +64,15 @@ namespace build2
template <typename T>
inline const T&
- search (const dir_path& dir,
+ search (const target& t,
+ const dir_path& dir,
const dir_path& out,
const string& name,
const string* ext,
const scope* scope)
{
return search (
- T::static_type, dir, out, name, ext, scope).template as<T> ();
+ t, T::static_type, dir, out, name, ext, scope).template as<T> ();
}
target_lock
diff --git a/build2/bin/rule.cxx b/build2/bin/rule.cxx
index 3ea8e75..fd1526e 100644
--- a/build2/bin/rule.cxx
+++ b/build2/bin/rule.cxx
@@ -53,8 +53,8 @@ namespace build2
fail << "unknown library type: " << type <<
info << "'static', 'shared', or 'both' expected";
- t.a = a ? &search<liba> (t.dir, t.out, t.name) : nullptr;
- t.s = s ? &search<libs> (t.dir, t.out, t.name) : nullptr;
+ t.a = a ? &search<liba> (t, t.dir, t.out, t.name) : nullptr;
+ t.s = s ? &search<libs> (t, t.dir, t.out, t.name) : nullptr;
match_result mr (true);
diff --git a/build2/bin/target.cxx b/build2/bin/target.cxx
index 2be5686..dc691d6 100644
--- a/build2/bin/target.cxx
+++ b/build2/bin/target.cxx
@@ -43,7 +43,7 @@ namespace build2
&target_extension_var<ext_var, nullptr>,
&target_pattern_var<ext_var, nullptr>,
nullptr,
- &search_target, // Note: not _file(); don't look for an existing file.
+ &target_search, // Note: not _file(); don't look for an existing file.
false
};
@@ -55,7 +55,7 @@ namespace build2
&target_extension_var<ext_var, nullptr>,
&target_pattern_var<ext_var, nullptr>,
nullptr,
- &search_target, // Note: not _file(); don't look for an existing file.
+ &target_search, // Note: not _file(); don't look for an existing file.
false
};
@@ -67,7 +67,7 @@ namespace build2
&target_extension_var<ext_var, nullptr>,
&target_pattern_var<ext_var, nullptr>,
nullptr,
- &search_target, // Note: not _file(); don't look for an existing file.
+ &target_search, // Note: not _file(); don't look for an existing file.
false
};
@@ -107,7 +107,7 @@ namespace build2
nullptr,
nullptr,
nullptr,
- &search_target,
+ &target_search,
false
};
@@ -145,7 +145,7 @@ namespace build2
&target_extension_var<ext_var, nullptr>,
&target_pattern_var<ext_var, nullptr>,
nullptr,
- &search_file,
+ &file_search,
false
};
@@ -157,7 +157,7 @@ namespace build2
&target_extension_var<ext_var, nullptr>,
&target_pattern_var<ext_var, nullptr>,
nullptr,
- &search_file,
+ &file_search,
false
};
@@ -206,7 +206,7 @@ namespace build2
nullptr,
nullptr,
nullptr,
- &search_target,
+ &target_search,
false
};
@@ -220,7 +220,7 @@ namespace build2
&target_extension_var<ext_var, nullptr>,
&target_pattern_var<ext_var, nullptr>,
nullptr,
- &search_file,
+ &file_search,
false
};
}
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx
index 67d254b..c5ef480 100644
--- a/build2/cc/compile.cxx
+++ b/build2/cc/compile.cxx
@@ -321,7 +321,7 @@ namespace build2
continue;
}
- pt = &p.search ();
+ pt = &p.search (t);
if (const lib* l = pt->is_a<lib> ())
pt = &link_member (*l, act, lo);
@@ -331,7 +331,7 @@ namespace build2
}
else
{
- pt = &p.search ();
+ pt = &p.search (t);
if (act.operation () == clean_id && !pt->dir.sub (rs.out_path ()))
continue;
@@ -375,7 +375,7 @@ namespace build2
// t.prerequisite_targets since we used standard search() and match()
// above.
//
- const file& src (*md.src.search ().is_a<file> ());
+ const file& src (*md.src.search (t).is_a<file> ());
// Make sure the output directory exists.
//
@@ -993,12 +993,12 @@ namespace build2
// from the depdb cache or from the compiler run. Return whether the
// extraction process should be restarted.
//
- auto add = [&trace, &update, &pm, act, &t, lo, &dd, &bs, this]
+ auto add = [&trace, &update, &pm, act, &t, lo, &dd, &bs, &t, this]
(path f, bool cache) -> bool
{
// Find or maybe insert the target.
//
- auto find = [&trace, this] (
+ auto find = [&trace, &t, this] (
const path& f, bool insert) -> const path_target*
{
// Split the name into its directory part, the name part, and
@@ -1059,7 +1059,7 @@ namespace build2
//
const target* r;
if (insert)
- r = &search (*tt, d, out, n, &e, nullptr);
+ r = &search (t, *tt, d, out, n, &e, nullptr);
else
{
// Note that we skip any target type-specific searches (like for
diff --git a/build2/cc/install.cxx b/build2/cc/install.cxx
index 6195ab7..e1e5719 100644
--- a/build2/cc/install.cxx
+++ b/build2/cc/install.cxx
@@ -42,7 +42,7 @@ namespace build2
if ((t.is_a<exe> () || t.is_a<libs> ()) &&
(p.is_a<lib> () || p.is_a<libs> ()))
{
- const target* pt (&p.search ());
+ const target* pt (&p.search (t));
// If this is the lib{} group, pick a member which we would link.
//
diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx
index 6d0c605..b15f340 100644
--- a/build2/cc/link.cxx
+++ b/build2/cc/link.cxx
@@ -306,7 +306,7 @@ namespace build2
const target& m (t.member != nullptr // Might already be there.
? *t.member
- : search (tt, t.dir, t.out, t.name));
+ : search (t, tt, t.dir, t.out, t.name));
target_lock l (lock (act, m));
assert (l.target != nullptr); // Someone messing with adhoc members?
@@ -438,7 +438,7 @@ namespace build2
// The rest is the same basic logic as in search_and_match().
//
if (pt == nullptr)
- pt = &p.search ();
+ pt = &p.search (t);
if (act.operation () == clean_id && !pt->dir.sub (rs.out_path ()))
continue; // Skip.
@@ -486,7 +486,7 @@ namespace build2
// If this is the obj{} target group, then pick the appropriate
// member.
//
- pt = p.is_a<obj> () ? &search (ott, p.key ()) : &p.search ();
+ pt = p.is_a<obj> () ? &search (t, ott, p.key ()) : &p.search (t);
if (act.operation () == clean_id && !pt->dir.sub (rs.out_path ()))
continue; // Skip.
@@ -539,7 +539,7 @@ namespace build2
// obj*{} is always in the out tree.
//
const target& ot (
- search (tt, d, dir_path (), *cp.tk.name, nullptr, cp.scope));
+ search (t, tt, d, dir_path (), *cp.tk.name, nullptr, cp.scope));
// If we are cleaning, check that this target is in the same or a
// subdirectory of our project root.
@@ -557,7 +557,7 @@ namespace build2
// If we have created the obj{} target group, pick one of its
// members; the rest would be primarily concerned with it.
//
- pt = group ? &search (ott, ot.dir, ot.out, ot.name) : &ot;
+ pt = group ? &search (t, ott, ot.dir, ot.out, ot.name) : &ot;
// If this obj*{} already has prerequisites, then verify they are
// "compatible" with what we are doing here. Otherwise, synthesize
@@ -699,7 +699,7 @@ namespace build2
// Searching our own prerequisite is ok, p1 must already be
// resolved.
//
- if (&p.search () != &p1.search ())
+ if (&p.search (t) != &p1.search (*pt))
fail << "synthesized dependency for prerequisite " << p << " "
<< "would be incompatible with existing target " << *pt <<
info << "existing prerequisite " << p1 << " does not match "
diff --git a/build2/cc/target.cxx b/build2/cc/target.cxx
index f269b35..a734953 100644
--- a/build2/cc/target.cxx
+++ b/build2/cc/target.cxx
@@ -18,7 +18,7 @@ namespace build2
nullptr,
nullptr,
nullptr,
- &search_target,
+ &target_search,
false
};
@@ -33,7 +33,7 @@ namespace build2
&target_extension_var<ext_var, h_ext_def>,
&target_pattern_var<ext_var, h_ext_def>,
nullptr,
- &search_file,
+ &file_search,
false
};
@@ -46,7 +46,7 @@ namespace build2
&target_extension_var<ext_var, c_ext_def>,
&target_pattern_var<ext_var, c_ext_def>,
nullptr,
- &search_file,
+ &file_search,
false
};
}
diff --git a/build2/cli/rule.cxx b/build2/cli/rule.cxx
index 7b191ea..884635a 100644
--- a/build2/cli/rule.cxx
+++ b/build2/cli/rule.cxx
@@ -86,11 +86,14 @@ namespace build2
// At this stage, no further changes to cli.options are possible and
// we can determine whether the --suppress-inline option is present.
//
- t.h = &search<cxx::hxx> (t.dir, t.out, t.name);
- t.c = &search<cxx::cxx> (t.dir, t.out, t.name);
+ // Passing the group as a "reference target" is a bit iffy,
+ // conceptually.
+ //
+ t.h = &search<cxx::hxx> (t, t.dir, t.out, t.name);
+ t.c = &search<cxx::cxx> (t, t.dir, t.out, t.name);
t.i = find_option ("--suppress-inline", t, "cli.options")
? nullptr
- : &search<cxx::ixx> (t.dir, t.out, t.name);
+ : &search<cxx::ixx> (t, t.dir, t.out, t.name);
return r;
}
diff --git a/build2/cli/target.cxx b/build2/cli/target.cxx
index e3ce7e2..2199f79 100644
--- a/build2/cli/target.cxx
+++ b/build2/cli/target.cxx
@@ -24,7 +24,7 @@ namespace build2
&target_extension_var<cli_ext_var, cli_ext_def>,
&target_pattern_var<cli_ext_var, cli_ext_def>,
nullptr,
- &search_file,
+ &file_search,
false
};
@@ -70,7 +70,7 @@ namespace build2
nullptr,
nullptr,
nullptr,
- &search_target,
+ &target_search,
true // "See through" default iteration mode.
};
}
diff --git a/build2/cxx/target.cxx b/build2/cxx/target.cxx
index 7b19312..8955cb2 100644
--- a/build2/cxx/target.cxx
+++ b/build2/cxx/target.cxx
@@ -21,7 +21,7 @@ namespace build2
&target_extension_var<ext_var, hxx_ext_def>,
&target_pattern_var<ext_var, hxx_ext_def>,
nullptr,
- &search_file,
+ &file_search,
false
};
@@ -34,7 +34,7 @@ namespace build2
&target_extension_var<ext_var, ixx_ext_def>,
&target_pattern_var<ext_var, ixx_ext_def>,
nullptr,
- &search_file,
+ &file_search,
false
};
@@ -47,7 +47,7 @@ namespace build2
&target_extension_var<ext_var, txx_ext_def>,
&target_pattern_var<ext_var, txx_ext_def>,
nullptr,
- &search_file,
+ &file_search,
false
};
@@ -60,7 +60,7 @@ namespace build2
&target_extension_var<ext_var, cxx_ext_def>,
&target_pattern_var<ext_var, cxx_ext_def>,
nullptr,
- &search_file,
+ &file_search,
false
};
}
diff --git a/build2/dist/rule.cxx b/build2/dist/rule.cxx
index 205c321..338f7f9 100644
--- a/build2/dist/rule.cxx
+++ b/build2/dist/rule.cxx
@@ -36,7 +36,7 @@ namespace build2
if (p.proj ())
continue;
- const target& pt (p.search ());
+ const target& pt (p.search (t));
// Don't match targets that are outside of our project.
//
diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx
index 0cfbe84..9f668f9 100644
--- a/build2/install/rule.cxx
+++ b/build2/install/rule.cxx
@@ -51,7 +51,7 @@ namespace build2
for (const prerequisite& p: group_prerequisites (t))
{
- const target& pt (search (p));
+ const target& pt (search (t, p));
// Check if this prerequisite is explicitly "not installable",
// that is, there is the 'install' variable and its value is
@@ -121,7 +121,7 @@ namespace build2
const target* file_rule::
filter (action, const target& t, prerequisite_member p) const
{
- const target& pt (p.search ());
+ const target& pt (p.search (t));
return pt.in (t.root_scope ()) ? &pt : nullptr;
}
diff --git a/build2/target b/build2/target
index e7e15ab..c672dc9 100644
--- a/build2/target
+++ b/build2/target
@@ -30,7 +30,7 @@ namespace build2
extern size_t current_on; // From <build/context>.
const target&
- search (const prerequisite&); // From <build2/algorithm>.
+ search (const target&, const prerequisite&); // From <build2/algorithm>.
// Target state.
//
@@ -877,9 +877,9 @@ namespace build2
}
const target_type&
- search () const
+ search (const target_type& t) const
{
- return target != nullptr ? *target : build2::search (prerequisite);
+ return target != nullptr ? *target : build2::search (t, prerequisite);
}
// Return as a new prerequisite instance.
@@ -939,17 +939,21 @@ namespace build2
template <typename R>
inline prerequisite_members_range<R>
- prerequisite_members (action a, R&& r, members_mode m = members_mode::always)
+ prerequisite_members (action a, const target& t,
+ R&& r,
+ members_mode m = members_mode::always)
{
- return prerequisite_members_range<R> (a, forward<R> (r), m);
+ return prerequisite_members_range<R> (a, t, forward<R> (r), m);
}
template <typename R>
class prerequisite_members_range
{
public:
- prerequisite_members_range (action a, R&& r, members_mode m)
- : a_ (a), mode_ (m), r_ (forward<R> (r)), e_ (r_.end ()) {}
+ prerequisite_members_range (action a, const target& t,
+ R&& r,
+ members_mode m)
+ : a_ (a), t_ (t), mode_ (m), r_ (forward<R> (r)), e_ (r_.end ()) {}
using base_iterator = decltype (declval<R> ().begin ());
@@ -1057,6 +1061,7 @@ namespace build2
private:
action a_;
+ const target& t_;
members_mode mode_;
R r_;
base_iterator e_;
@@ -1068,14 +1073,14 @@ namespace build2
prerequisite_members (action a, target& t,
members_mode m = members_mode::always)
{
- return prerequisite_members (a, t.prerequisites (), m);
+ return prerequisite_members (a, t, t.prerequisites (), m);
}
inline auto
prerequisite_members (action a, const target& t,
members_mode m = members_mode::always)
{
- return prerequisite_members (a, t.prerequisites (), m);
+ return prerequisite_members (a, t, t.prerequisites (), m);
}
// prerequisite_members(reverse_iterate(t.prerequisites))
@@ -1084,14 +1089,14 @@ namespace build2
reverse_prerequisite_members (action a, target& t,
members_mode m = members_mode::always)
{
- return prerequisite_members (a, reverse_iterate (t.prerequisites ()), m);
+ return prerequisite_members (a, t, reverse_iterate (t.prerequisites ()), m);
}
inline auto
reverse_prerequisite_members (action a, const target& t,
members_mode m = members_mode::always)
{
- return prerequisite_members (a, reverse_iterate (t.prerequisites ()), m);
+ return prerequisite_members (a, t, reverse_iterate (t.prerequisites ()), m);
}
// prerequisite_members(group_prerequisites (t))
@@ -1100,14 +1105,14 @@ namespace build2
group_prerequisite_members (action a, target& t,
members_mode m = members_mode::always)
{
- return prerequisite_members (a, group_prerequisites (t), m);
+ return prerequisite_members (a, t, group_prerequisites (t), m);
}
inline auto
group_prerequisite_members (action a, const target& t,
members_mode m = members_mode::always)
{
- return prerequisite_members (a, group_prerequisites (t), m);
+ return prerequisite_members (a, t, group_prerequisites (t), m);
}
// prerequisite_members(reverse_iterate (group_prerequisites (t)))
@@ -1117,7 +1122,7 @@ namespace build2
members_mode m = members_mode::always)
{
return prerequisite_members (
- a, reverse_iterate (group_prerequisites (t)), m);
+ a, t, reverse_iterate (group_prerequisites (t)), m);
}
inline auto
@@ -1125,7 +1130,7 @@ namespace build2
members_mode m = members_mode::always)
{
return prerequisite_members (
- a, reverse_iterate (group_prerequisites (t)), m);
+ a, t, reverse_iterate (group_prerequisites (t)), m);
}
// A target with an unspecified extension is considered equal to the one
@@ -1653,13 +1658,13 @@ namespace build2
// prerequisite's directory scope.
//
const target*
- search_target (const prerequisite_key&);
+ target_search (const target&, const prerequisite_key&);
// First look for an existing target as above. If not found, then look
// for an existing file in the target-type-specific list of paths.
//
const target*
- search_file (const prerequisite_key&);
+ file_search (const target&, const prerequisite_key&);
}
#include <build2/target.ixx>
diff --git a/build2/target-type b/build2/target-type
index 191c5d8..aa2d7cb 100644
--- a/build2/target-type
+++ b/build2/target-type
@@ -61,7 +61,7 @@ namespace build2
void (*print) (ostream&, const target_key&);
- const target* (*search) (const prerequisite_key&);
+ const target* (*search) (const target&, const prerequisite_key&);
bool see_through; // A group with the default "see through" semantics.
diff --git a/build2/target.cxx b/build2/target.cxx
index 3adfc66..e0f4e55 100644
--- a/build2/target.cxx
+++ b/build2/target.cxx
@@ -608,7 +608,7 @@ namespace build2
//
const target*
- search_target (const prerequisite_key& pk)
+ target_search (const target&, const prerequisite_key& pk)
{
// The default behavior is to look for an existing target in the
// prerequisite's directory scope.
@@ -617,7 +617,7 @@ namespace build2
}
const target*
- search_file (const prerequisite_key& pk)
+ file_search (const target&, const prerequisite_key& pk)
{
// First see if there is an existing target.
//
@@ -667,7 +667,7 @@ namespace build2
nullptr,
nullptr,
nullptr,
- &search_target,
+ &target_search,
false
};
@@ -679,7 +679,7 @@ namespace build2
nullptr,
nullptr,
nullptr,
- &search_target,
+ &target_search,
false
};
@@ -691,7 +691,7 @@ namespace build2
nullptr,
nullptr,
nullptr,
- &search_target,
+ &target_search,
false
};
@@ -726,12 +726,12 @@ namespace build2
&target_extension_var<file_ext_var, file_ext_def>,
&target_pattern_var<file_ext_var, file_ext_def>,
&target_print_1_ext_verb, // Print extension even at verbosity level 0.
- &search_file,
+ &file_search,
false
};
static const target*
- search_alias (const prerequisite_key& pk)
+ alias_search (const target&, const prerequisite_key& pk)
{
// For an alias we don't want to silently create a target since it will do
// nothing and it most likely not what the user intended.
@@ -752,14 +752,14 @@ namespace build2
nullptr, // Extension not used.
nullptr,
nullptr,
- &search_alias,
+ &alias_search,
false
};
static const target*
- dir_target_search (const prerequisite_key& pk)
+ dir_search (const target&, const prerequisite_key& pk)
{
- tracer trace ("dir_target_search");
+ tracer trace ("dir_search");
// The first step is like in search_alias(): looks for an existing target.
//
@@ -853,7 +853,7 @@ namespace build2
}
static bool
- dir_target_pattern (const target_type&, const scope&, string& v, bool r)
+ dir_pattern (const target_type&, const scope&, string& v, bool r)
{
// Add/strip trailing directory separator unless already there.
//
@@ -879,9 +879,9 @@ namespace build2
&alias::static_type,
&target_factory<dir>,
nullptr, // Extension not used.
- &dir_target_pattern,
+ &dir_pattern,
nullptr,
- &dir_target_search,
+ &dir_search,
false
};
@@ -891,9 +891,9 @@ namespace build2
&target::static_type,
&target_factory<fsdir>,
nullptr, // Extension not used.
- &dir_target_pattern,
+ &dir_pattern,
nullptr,
- &search_target,
+ &target_search,
false
};
@@ -948,7 +948,7 @@ namespace build2
nullptr,
#endif
nullptr,
- &search_file,
+ &file_search,
false
};
@@ -1004,7 +1004,7 @@ namespace build2
&buildfile_target_extension,
&buildfile_target_pattern,
nullptr,
- &search_file,
+ &file_search,
false
};
@@ -1016,7 +1016,7 @@ namespace build2
&target_extension_var<file_ext_var, file_ext_def>, // Same as file.
&target_pattern_var<file_ext_var, file_ext_def>, // Same as file.
&target_print_1_ext_verb, // Same as file.
- &search_file,
+ &file_search,
false
};
@@ -1041,7 +1041,7 @@ namespace build2
&target_extension_null, // Should be specified explicitly (see factory).
nullptr,
&target_print_1_ext_verb, // Print extension even at verbosity level 0.
- &search_file,
+ &file_search,
false
};
@@ -1055,7 +1055,7 @@ namespace build2
&target_extension_fix<man1_ext>,
&target_pattern_fix<man1_ext>,
&target_print_0_ext_verb, // Fixed extension, no use printing.
- &search_file,
+ &file_search,
false
};
}
diff --git a/build2/target.txx b/build2/target.txx
index d854ed2..5abdfc5 100644
--- a/build2/target.txx
+++ b/build2/target.txx
@@ -20,7 +20,7 @@ namespace build2
//
do
{
- g_ = resolve_group_members (r_->a_, search (*i_));
+ g_ = resolve_group_members (r_->a_, search (r_->t_, *i_));
// Group could not be resolved.
//
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index 171cbac..64292fc 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -227,7 +227,7 @@ namespace build2
group_prerequisite_members (a, t, members_mode::maybe))
{
if (p.is_a<testscript> ())
- t.prerequisite_targets.push_back (&p.search ());
+ t.prerequisite_targets.push_back (&p.search (t));
}
return [this] (action a, const target& t)
@@ -289,9 +289,9 @@ namespace build2
// @@ OUT: what if this is a @-qualified pair or names?
//
- const target* it (in != nullptr ? &search (*in, bs) : nullptr);
+ const target* it (in != nullptr ? &search (t, *in, bs) : nullptr);
const target* ot (on != nullptr
- ? in == on ? it : &search (*on, bs)
+ ? in == on ? it : &search (t, *on, bs)
: nullptr);
if (a.operation () == update_id)
diff --git a/build2/test/target.cxx b/build2/test/target.cxx
index b6f9854..fd432fd 100644
--- a/build2/test/target.cxx
+++ b/build2/test/target.cxx
@@ -64,7 +64,7 @@ namespace build2
&testscript_target_extension,
&testscript_target_pattern,
nullptr,
- &search_file,
+ &file_search,
false
};
}
diff --git a/build2/version/rule.cxx b/build2/version/rule.cxx
index 1da37bb..b6f09de 100644
--- a/build2/version/rule.cxx
+++ b/build2/version/rule.cxx
@@ -44,7 +44,7 @@ namespace build2
if (!p.is_a<file> ())
continue;
- const target& pt (p.search ());
+ const target& pt (p.search (t));
if (pt.name != "manifest")
continue;