From c3212dbda325bdf6eaff6a7652c996a28e8ba688 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 29 Jul 2024 10:44:18 +0200 Subject: Add scope::lookup_original_info() that provides additional info about lookup --- libbuild2/scope.hxx | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'libbuild2/scope.hxx') 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_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; + 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_override (const variable& var, pair original, -- cgit v1.1