aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/scope.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-07-29 10:44:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-07-29 10:44:18 +0200
commitc3212dbda325bdf6eaff6a7652c996a28e8ba688 (patch)
treeefec5919720793ed9cbc759f7168581a31d3bd29 /libbuild2/scope.hxx
parentab4c1b8a8b67fd9ffc89c804efa260584530897d (diff)
Add scope::lookup_original_info() that provides additional info about lookup
Diffstat (limited to 'libbuild2/scope.hxx')
-rw-r--r--libbuild2/scope.hxx25
1 files changed, 23 insertions, 2 deletions
diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx
index 09d61e9..f821411 100644
--- a/libbuild2/scope.hxx
+++ b/libbuild2/scope.hxx
@@ -190,12 +190,33 @@ namespace build2
// can be used to skip a number of initial lookups.
//
pair<lookup_type, size_t>
- lookup_original (const variable&,
+ lookup_original (const variable& var,
const target_key* tk = nullptr,
const target_key* g1k = nullptr,
const target_key* g2k = nullptr,
- size_t start_depth = 1) const;
+ size_t start_depth = 1) const
+ {
+ return lookup_original_info (var, tk, g1k, g2k, start_depth).lookup;
+ }
+
+ // As above but also return an indication of whether the resulting value
+ // was modified by a target type/pattern-specific append/prepend.
+ //
+ struct original_info
+ {
+ pair<lookup_type, size_t> lookup;
+ bool modified;
+ };
+ original_info
+ lookup_original_info (const variable&,
+ const target_key* tk,
+ const target_key* g1k = nullptr,
+ const target_key* g2k = nullptr,
+ size_t start_depth = 1) const;
+
+ // Implementation details (used by scope target lookup).
+ //
pair<lookup_type, size_t>
lookup_override (const variable& var,
pair<lookup_type, size_t> original,