From 9034f7c51ef6437ce9d4547ba5bde217b4740fb2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 19 Apr 2022 11:10:53 +0200 Subject: Use target recipe for auxiliary data storage during match-apply In particular, we now have separate auxiliary data storage for inner and outer operations. --- libbuild2/cc/link-rule.hxx | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'libbuild2/cc/link-rule.hxx') diff --git a/libbuild2/cc/link-rule.hxx b/libbuild2/cc/link-rule.hxx index f0052e9..14a70d2 100644 --- a/libbuild2/cc/link-rule.hxx +++ b/libbuild2/cc/link-rule.hxx @@ -23,6 +23,8 @@ namespace build2 public: link_rule (data&&); + struct match_data; + struct match_result { bool seen_x = false; @@ -52,10 +54,10 @@ namespace build2 apply (action, target&, match_extra&) const override; target_state - perform_update (action, const target&) const; + perform_update (action, const target&, match_data&) const; target_state - perform_clean (action, const target&) const; + perform_clean (action, const target&, match_data&) const; public: // Library handling. @@ -226,9 +228,9 @@ namespace build2 static void functions (function_family&, const char*); // functions.cxx - private: - friend class install_rule; - friend class libux_install_rule; + // Implementation details. + // + public: // Shared library paths. // @@ -271,6 +273,9 @@ namespace build2 struct match_data { + explicit + match_data (const link_rule& r): rule (r) {} + // The "for install" condition is signalled to us by install_rule when // it is matched for the update operation. It also verifies that if we // have already been executed, then it was for install. @@ -305,10 +310,21 @@ namespace build2 size_t start; // Parallel prerequisites/prerequisite_targets start. link_rule::libs_paths libs_paths; + + const link_rule& rule; + + target_state + operator() (action a, const target& t) + { + return a == perform_update_id + ? rule.perform_update (a, t, *this) + : rule.perform_clean (a, t, *this); + } }; // Windows rpath emulation (windows-rpath.cxx). // + private: struct windows_dll { reference_wrapper dll; -- cgit v1.1