From f9e9d10bcb60b807466ddb646a9c0a0a447f7a20 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 15 Dec 2021 07:42:13 +0200 Subject: Return stable imported target name from import_direct() --- libbuild2/file.ixx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'libbuild2/file.ixx') diff --git a/libbuild2/file.ixx b/libbuild2/file.ixx index bd138a0..dbd892d 100644 --- a/libbuild2/file.ixx +++ b/libbuild2/file.ixx @@ -42,7 +42,7 @@ namespace build2 return *import (ctx, pk, false, nullopt, false, location ()); } - inline pair + inline import_result import_direct (scope& base, name tgt, bool ph2, bool opt, bool md, @@ -53,19 +53,21 @@ namespace build2 } template - inline pair + inline import_result import_direct (scope& base, name tgt, bool ph2, bool opt, bool md, const location& loc, const char* w) { auto r (import_direct (base, move (tgt), ph2, opt, md, loc, w)); - return make_pair (r.first != nullptr ? &r.first->as () : nullptr, - r.second); + return import_result { + r.target != nullptr ? &r.target->as () : nullptr, + move (r.name), + r.kind}; } template - inline pair + inline import_result import_direct (bool& nv, scope& base, name tgt, @@ -73,8 +75,10 @@ namespace build2 const location& loc, const char* w) { auto r (import_direct (nv, base, move (tgt), ph2, opt, md, loc, w)); - return make_pair (r.first != nullptr ? &r.first->as () : nullptr, - r.second); + return import_result { + r.target != nullptr ? &r.target->as () : nullptr, + move (r.name), + r.kind}; } inline const target* -- cgit v1.1