From 011adfe1efe3ff20dc019e242d56c95b2b35ac13 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 11 Nov 2020 15:04:27 +0200 Subject: Expose low-level function registration support --- libbuild2/forward.hxx | 1 + libbuild2/function.hxx | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'libbuild2') diff --git a/libbuild2/forward.hxx b/libbuild2/forward.hxx index cd0f3c3..5fffaaf 100644 --- a/libbuild2/forward.hxx +++ b/libbuild2/forward.hxx @@ -34,6 +34,7 @@ namespace build2 // // class function_map; + class function_family; // // diff --git a/libbuild2/function.hxx b/libbuild2/function.hxx index 47eee5b..43b8024 100644 --- a/libbuild2/function.hxx +++ b/libbuild2/function.hxx @@ -249,10 +249,9 @@ namespace build2 default_thunk (const scope*, vector_view, const function_overload&); // A function family uses a common qualification (though you can pass - // empty string to supress it). For an unqualified name (doesn't not - // contain a dot) the qualified version is added automatically. A name - // containing a leading dot is a shortcut notation for a qualified-only - // name. + // empty string to supress it). For an unqualified name (doesn't contain + // dot) the qualified version is added automatically. A name containing a + // leading dot is a shortcut notation for a qualified-only name. // function_family (function_map& map, string qual, @@ -910,6 +909,26 @@ namespace build2 typename cast::data {&cast::thunk, dm})); } + // Low-level interface that can be used to register additional data. + // + // Note that the call to this function sidesteps the thunk. + // + template + void + insert (function_impl* i, D d) && + { + using args = function_args; + + insert (move (name), + function_overload ( + nullptr, + args::min, + args::max, + function_overload::types (args::types, args::max), + i, + move (d))); + } + private: void insert (string, function_overload) const; -- cgit v1.1