diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-12-15 07:42:13 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-12-15 07:42:13 +0200 |
commit | f9e9d10bcb60b807466ddb646a9c0a0a447f7a20 (patch) | |
tree | 65f3b3eb56a6bc85ebfadb1cf1d27a25fdb0feb5 /libbuild2/file.ixx | |
parent | 89aaf4d9eb26564b88c1ff400a12277e5ee45c1a (diff) |
Return stable imported target name from import_direct()
Diffstat (limited to 'libbuild2/file.ixx')
-rw-r--r-- | libbuild2/file.ixx | 18 |
1 files changed, 11 insertions, 7 deletions
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<const target*, import_kind> + inline import_result<target> import_direct (scope& base, name tgt, bool ph2, bool opt, bool md, @@ -53,19 +53,21 @@ namespace build2 } template <typename T> - inline pair<const T*, import_kind> + inline import_result<T> 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<const T> () : nullptr, - r.second); + return import_result<T> { + r.target != nullptr ? &r.target->as<const T> () : nullptr, + move (r.name), + r.kind}; } template <typename T> - inline pair<const T*, import_kind> + inline import_result<T> 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<const T> () : nullptr, - r.second); + return import_result<T> { + r.target != nullptr ? &r.target->as<const T> () : nullptr, + move (r.name), + r.kind}; } inline const target* |