summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_tree.hpp
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@gmail.com>2023-04-15 16:28:33 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2023-04-26 18:29:44 +0200
commitd762bfa1953933dfac0a29a74523c25719396b8c (patch)
tree1002b0aecc1af698f0349a4efb4bfc169886c60a /src/buildtool/file_system/git_tree.hpp
parent03e1019aca5d08e53bfeb455071d91561fc33039 (diff)
downloadjustbuild-d762bfa1953933dfac0a29a74523c25719396b8c.tar.gz
imports: Switch to Microsoft GSL implementation
... with two minor code base changes compared to previous use of gsl-lite: - dag.hpp: ActionNode::Ptr and ArtifactNode::Ptr are not wrapped in gsl::not_null<> anymore, due to lack of support for wrapping std::unique_ptr<>. More specifically, the move constructor is missing, rendering it impossible to use std::vector<>::emplace_back(). - utils/cpp/gsl.hpp: New header file added to implement the macros ExpectsAudit() and EnsureAudit(), asserts running only in debug builds, which were available in gsl-lite but are missing in MS GSL.
Diffstat (limited to 'src/buildtool/file_system/git_tree.hpp')
-rw-r--r--src/buildtool/file_system/git_tree.hpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/buildtool/file_system/git_tree.hpp b/src/buildtool/file_system/git_tree.hpp
index ac409e69..5007b106 100644
--- a/src/buildtool/file_system/git_tree.hpp
+++ b/src/buildtool/file_system/git_tree.hpp
@@ -19,7 +19,7 @@
#include <optional>
#include <unordered_map>
-#include "gsl-lite/gsl-lite.hpp"
+#include "gsl/gsl"
#include "src/buildtool/file_system/git_repo.hpp"
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/multithreading/atomic_value.hpp"
@@ -69,14 +69,12 @@ class GitTree {
entries_t entries_;
std::string raw_id_;
- GitTree(gsl::not_null<GitCASPtr> cas,
+ GitTree(gsl::not_null<GitCASPtr> const& cas,
entries_t&& entries,
std::string raw_id) noexcept
- : cas_{std::move(cas)},
- entries_{std::move(entries)},
- raw_id_{std::move(raw_id)} {}
+ : cas_{cas}, entries_{std::move(entries)}, raw_id_{std::move(raw_id)} {}
- [[nodiscard]] static auto FromEntries(gsl::not_null<GitCASPtr> cas,
+ [[nodiscard]] static auto FromEntries(gsl::not_null<GitCASPtr> const& cas,
GitRepo::tree_entries_t&& entries,
std::string raw_id) noexcept
-> std::optional<GitTree> {
@@ -93,16 +91,16 @@ class GitTree {
}
}
}
- return GitTree(std::move(cas), std::move(e), std::move(raw_id));
+ return GitTree(cas, std::move(e), std::move(raw_id));
}
};
class GitTreeEntry {
public:
- GitTreeEntry(gsl::not_null<GitCASPtr> cas,
+ GitTreeEntry(gsl::not_null<GitCASPtr> const& cas,
std::string raw_id,
ObjectType type) noexcept
- : cas_{std::move(cas)}, raw_id_{std::move(raw_id)}, type_{type} {}
+ : cas_{cas}, raw_id_{std::move(raw_id)}, type_{type} {}
[[nodiscard]] auto IsBlob() const noexcept { return IsFileObject(type_); }
[[nodiscard]] auto IsTree() const noexcept { return IsTreeObject(type_); }