From cbcb0b03501ce346ca3778624dcf908e851e6e2e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 19 Mar 2020 09:27:22 +0200 Subject: Tweak lookup_config() semantics some more --- libbuild2/scope.hxx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'libbuild2/scope.hxx') diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx index 97ec448..c49778f 100644 --- a/libbuild2/scope.hxx +++ b/libbuild2/scope.hxx @@ -151,10 +151,30 @@ namespace build2 size_t start_depth = 1) const; pair - lookup_override (const variable&, + lookup_override (const variable& var, pair original, bool target = false, - bool rule = false) const; + bool rule = false) const + { + return lookup_override_info (var, original, target, rule).lookup; + } + + // As above but also return an indication of whether the resulting value + // is/is based (e.g., via append/prepend overrides) on the original or an + // "outright" override. Note that it will always be false if there is no + // original. + // + struct override_info + { + pair lookup; + bool original; + }; + + override_info + lookup_override_info (const variable&, + pair original, + bool target = false, + bool rule = false) const; // Return a value suitable for assignment (or append if you only want to // append to the value from this scope). If the value does not exist in -- cgit v1.1