From 3f41feb6e022a30cfce39ec40c7ffda46d75193d Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Fri, 26 May 2023 15:06:49 +0200 Subject: style: Use designated initializers This feature has been introduced with C++20. --- .../execution_api/bazel_msg/bazel_msg_factory.cpp | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/buildtool/execution_api/bazel_msg') diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp index 5f392483..ba52443b 100644 --- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp +++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp @@ -349,15 +349,16 @@ template [[nodiscard]] auto CreateObjectInfo(bazel_re::DirectoryNode const& node) -> Artifact::ObjectInfo { - return Artifact::ObjectInfo{ArtifactDigest{node.digest()}, - ObjectType::Tree}; + return Artifact::ObjectInfo{.digest = ArtifactDigest{node.digest()}, + .type = ObjectType::Tree}; } [[nodiscard]] auto CreateObjectInfo(bazel_re::FileNode const& node) -> Artifact::ObjectInfo { - return Artifact::ObjectInfo{ - ArtifactDigest{node.digest()}, - node.is_executable() ? ObjectType::Executable : ObjectType::File}; + return Artifact::ObjectInfo{.digest = ArtifactDigest{node.digest()}, + .type = node.is_executable() + ? ObjectType::Executable + : ObjectType::File}; } /// \brief Convert `DirectoryTree` to `DirectoryNodeBundle`. @@ -445,12 +446,13 @@ auto BazelMsgFactory::ReadObjectInfosFromGitTree( for (auto const& [raw_id, es] : entries) { auto const hex_id = ToHexString(raw_id); for (auto const& entry : es) { - if (not store_info(entry.name, - Artifact::ObjectInfo{ - ArtifactDigest{hex_id, - /*size is unknown*/ 0, - IsTreeObject(entry.type)}, - entry.type})) { + if (not store_info( + entry.name, + Artifact::ObjectInfo{ + .digest = ArtifactDigest{hex_id, + /*size is unknown*/ 0, + IsTreeObject(entry.type)}, + .type = entry.type})) { return false; } } -- cgit v1.2.3