aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/target.cxx')
-rw-r--r--libbuild2/target.cxx20
1 files changed, 11 insertions, 9 deletions
diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx
index 2a134a4..65e18d3 100644
--- a/libbuild2/target.cxx
+++ b/libbuild2/target.cxx
@@ -142,7 +142,7 @@ namespace build2
pair<lookup, size_t> target::
lookup_original (const variable& var,
- bool target_only,
+ lookup_limit limit,
const scope* bs,
bool locked) const
{
@@ -188,9 +188,10 @@ namespace build2
// Skip looking up in the ad hoc group, which is semantically the
// first/primary member.
//
- if ((g1 = group == nullptr
+ const target* g (group); // Atomic.
+ if ((g1 = g == nullptr
? nullptr
- : group->adhoc_group () ? group->group : group))
+ : g->adhoc_group () ? static_cast<const target*> (g->group) : g))
{
auto p (g1->vars.lookup (var));
if (p.first != nullptr)
@@ -203,7 +204,7 @@ namespace build2
//
if (!r.first)
{
- if (!target_only)
+ if (limit != lookup_limit::target)
{
auto key = [locked] (const target* t)
{
@@ -220,7 +221,8 @@ namespace build2
auto p (bs->lookup_original (var,
&tk,
g1 != nullptr ? &g1k : nullptr,
- g2 != nullptr ? &g2k : nullptr));
+ g2 != nullptr ? &g2k : nullptr,
+ limit));
r.first = move (p.first);
r.second = r.first ? r.second + p.second : p.second;
@@ -240,7 +242,7 @@ namespace build2
// Note that here we want the original value without any overrides
// applied.
//
- auto l (lookup_original (var, false, bs).first);
+ auto l (lookup_original (var, bs).first);
if (l.defined () && l.belongs (*this)) // Existing var in this target.
return vars.modify (l); // Ok since this is original.
@@ -256,7 +258,7 @@ namespace build2
value& target::
append_locked (const variable& var, const scope* bs)
{
- auto l (lookup_original (var, false, bs, true /* locked */).first);
+ auto l (lookup_original (var, bs, true /* locked */).first);
if (l.defined () && l.belongs (*this)) // Existing var in this target.
return vars.modify (l); // Ok since this is original.
@@ -270,7 +272,7 @@ namespace build2
}
pair<lookup, size_t> target::opstate::
- lookup_original (const variable& var, bool target_only) const
+ lookup_original (const variable& var, lookup_limit limit) const
{
pair<lookup_type, size_t> r (lookup_type (), 0);
@@ -285,7 +287,7 @@ namespace build2
//
if (!r.first)
{
- auto p (target_->lookup_original (var, target_only));
+ auto p (target_->lookup_original (var, limit));
r.first = move (p.first);
r.second = r.first ? r.second + p.second : p.second;