summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/build_engine/analysed_target/target_graph_information.cpp5
-rw-r--r--src/buildtool/build_engine/base_maps/json_file_map.hpp4
-rw-r--r--src/buildtool/build_engine/base_maps/source_map.cpp4
-rw-r--r--src/buildtool/build_engine/expression/configuration.hpp7
-rw-r--r--src/buildtool/build_engine/expression/evaluator.cpp13
-rw-r--r--src/buildtool/build_engine/expression/evaluator.hpp4
-rw-r--r--src/buildtool/build_engine/expression/expression.hpp34
-rw-r--r--src/buildtool/build_engine/expression/expression_ptr.hpp6
-rw-r--r--src/buildtool/build_engine/expression/target_node.hpp6
-rw-r--r--src/buildtool/build_engine/target_map/built_in_rules.cpp19
-rw-r--r--src/buildtool/build_engine/target_map/built_in_rules.hpp19
-rw-r--r--src/buildtool/build_engine/target_map/configured_target.hpp5
-rw-r--r--src/buildtool/crypto/hash_function.cpp10
-rw-r--r--src/buildtool/execution_api/execution_service/execution_server.hpp9
-rw-r--r--src/buildtool/execution_engine/dag/dag.hpp4
-rw-r--r--src/buildtool/execution_engine/traverser/traverser.hpp11
-rw-r--r--src/buildtool/file_system/file_system_manager.hpp23
-rw-r--r--src/buildtool/file_system/git_cas.hpp10
-rw-r--r--src/buildtool/file_system/git_repo.cpp4
-rw-r--r--src/buildtool/file_system/git_utils.cpp4
-rw-r--r--src/buildtool/logging/log_sink_cmdline.hpp5
-rw-r--r--src/buildtool/main/cli.hpp4
-rw-r--r--src/buildtool/progress_reporting/progress.hpp9
-rw-r--r--src/buildtool/storage/compactifier.cpp12
-rw-r--r--src/buildtool/storage/large_object_cas.hpp3
-rw-r--r--src/buildtool/storage/large_object_cas.tpp9
-rw-r--r--src/buildtool/storage/local_ac.hpp3
-rw-r--r--src/buildtool/storage/local_ac.tpp3
-rw-r--r--src/buildtool/storage/local_cas.hpp24
-rw-r--r--src/buildtool/storage/local_cas.tpp35
-rw-r--r--src/buildtool/storage/target_cache.hpp6
-rw-r--r--src/buildtool/storage/target_cache.tpp15
-rw-r--r--src/other_tools/just_mr/mirrors.hpp5
-rw-r--r--src/utils/archive/archive_ops.cpp8
-rw-r--r--src/utils/cpp/atomic.hpp4
-rw-r--r--src/utils/cpp/concepts.hpp59
-rw-r--r--src/utils/cpp/hash_combine.hpp4
-rw-r--r--src/utils/cpp/json.hpp4
-rw-r--r--src/utils/cpp/type_safe_arithmetic.hpp16
39 files changed, 217 insertions, 212 deletions
diff --git a/src/buildtool/build_engine/analysed_target/target_graph_information.cpp b/src/buildtool/build_engine/analysed_target/target_graph_information.cpp
index eb12863c..dfd333ac 100644
--- a/src/buildtool/build_engine/analysed_target/target_graph_information.cpp
+++ b/src/buildtool/build_engine/analysed_target/target_graph_information.cpp
@@ -23,9 +23,8 @@ auto TargetGraphInformation::NodeString() const noexcept
}
namespace {
-auto NodesToString(
- std::vector<BuildMaps::Target::ConfiguredTargetPtr> const& nodes)
- -> std::vector<std::string> {
+auto NodesToString(std::vector<BuildMaps::Target::ConfiguredTargetPtr> const&
+ nodes) -> std::vector<std::string> {
std::vector<std::string> result{};
result.reserve(nodes.size());
for (auto const& n : nodes) {
diff --git a/src/buildtool/build_engine/base_maps/json_file_map.hpp b/src/buildtool/build_engine/base_maps/json_file_map.hpp
index c18a713e..52ab89ab 100644
--- a/src/buildtool/build_engine/base_maps/json_file_map.hpp
+++ b/src/buildtool/build_engine/base_maps/json_file_map.hpp
@@ -34,11 +34,11 @@ using JsonFileMap = AsyncMapConsumer<ModuleName, nlohmann::json>;
// function pointer type for specifying which root to get from global config
using RootGetter = auto (RepositoryConfig::*)(std::string const&) const
- -> FileRoot const*;
+ -> FileRoot const*;
// function pointer type for specifying the file name from the global config
using FileNameGetter = auto (RepositoryConfig::*)(std::string const&) const
- -> std::string const*;
+ -> std::string const*;
template <RootGetter get_root, FileNameGetter get_name, bool kMandatory = true>
auto CreateJsonFileMap(
diff --git a/src/buildtool/build_engine/base_maps/source_map.cpp b/src/buildtool/build_engine/base_maps/source_map.cpp
index 4ca726cb..e47c59b1 100644
--- a/src/buildtool/build_engine/base_maps/source_map.cpp
+++ b/src/buildtool/build_engine/base_maps/source_map.cpp
@@ -27,8 +27,8 @@ namespace BuildMaps::Base {
namespace {
-auto as_target(const BuildMaps::Base::EntityName& key, ExpressionPtr artifact)
- -> AnalysedTargetPtr {
+auto as_target(const BuildMaps::Base::EntityName& key,
+ ExpressionPtr artifact) -> AnalysedTargetPtr {
auto stage = ExpressionPtr{
Expression::map_t{key.GetNamedTarget().name, std::move(artifact)}};
return std::make_shared<AnalysedTarget const>(
diff --git a/src/buildtool/build_engine/expression/configuration.hpp b/src/buildtool/build_engine/expression/configuration.hpp
index ec00bb4a..15f8c379 100644
--- a/src/buildtool/build_engine/expression/configuration.hpp
+++ b/src/buildtool/build_engine/expression/configuration.hpp
@@ -126,9 +126,10 @@ class Configuration {
}
template <class T>
- requires(Expression::IsValidType<T>() or std::is_same_v<T, ExpressionPtr>)
- [[nodiscard]] auto Update(std::string const& name, T const& value) const
- -> Configuration {
+ requires(Expression::IsValidType<T>() or
+ std::is_same_v<T, ExpressionPtr>)
+ [[nodiscard]] auto Update(std::string const& name,
+ T const& value) const -> Configuration {
auto update = Expression::map_t::underlying_map_t{};
update.emplace(name, value);
return Configuration{Expression::map_t{expr_, update}};
diff --git a/src/buildtool/build_engine/expression/evaluator.cpp b/src/buildtool/build_engine/expression/evaluator.cpp
index 350afa4e..66eb8cfe 100644
--- a/src/buildtool/build_engine/expression/evaluator.cpp
+++ b/src/buildtool/build_engine/expression/evaluator.cpp
@@ -324,8 +324,8 @@ auto Range(ExpressionPtr const& expr) -> ExpressionPtr {
return ExpressionPtr{result};
}
-auto ChangeEndingTo(ExpressionPtr const& name, ExpressionPtr const& ending)
- -> ExpressionPtr {
+auto ChangeEndingTo(ExpressionPtr const& name,
+ ExpressionPtr const& ending) -> ExpressionPtr {
std::filesystem::path path{name->String()};
return ExpressionPtr{(path.parent_path() / path.stem()).string() +
ending->String()};
@@ -376,8 +376,9 @@ auto Join(ExpressionPtr const& expr, std::string const& sep) -> ExpressionPtr {
template <bool kDisjoint = false>
// NOLINTNEXTLINE(misc-no-recursion)
-auto Union(Expression::list_t const& dicts, std::size_t from, std::size_t to)
- -> ExpressionPtr {
+auto Union(Expression::list_t const& dicts,
+ std::size_t from,
+ std::size_t to) -> ExpressionPtr {
if (to <= from) {
return Expression::kEmptyMap;
}
@@ -432,8 +433,8 @@ auto Union(ExpressionPtr const& expr) -> ExpressionPtr {
return Union<kDisjoint>(list, 0, list.size());
}
-auto ConcatTargetName(ExpressionPtr const& expr, ExpressionPtr const& append)
- -> ExpressionPtr {
+auto ConcatTargetName(ExpressionPtr const& expr,
+ ExpressionPtr const& append) -> ExpressionPtr {
if (expr->IsString()) {
return ExpressionPtr{expr->String() + append->String()};
}
diff --git a/src/buildtool/build_engine/expression/evaluator.hpp b/src/buildtool/build_engine/expression/evaluator.hpp
index 598b36d4..726df568 100644
--- a/src/buildtool/build_engine/expression/evaluator.hpp
+++ b/src/buildtool/build_engine/expression/evaluator.hpp
@@ -108,8 +108,8 @@ class Evaluator {
std::function<void(std::string const&)> const& logger,
std::function<std::string(ExpressionPtr)> const& annotate_object =
[](auto const& /*unused*/) { return std::string{}; },
- std::function<void(void)> const& note_user_context = []() {}) noexcept
- -> ExpressionPtr;
+ std::function<void(void)> const& note_user_context =
+ []() {}) noexcept -> ExpressionPtr;
constexpr static std::size_t kDefaultExpressionLogLimit = 320;
diff --git a/src/buildtool/build_engine/expression/expression.hpp b/src/buildtool/build_engine/expression/expression.hpp
index 89f5c5ea..cbfb2f24 100644
--- a/src/buildtool/build_engine/expression/expression.hpp
+++ b/src/buildtool/build_engine/expression/expression.hpp
@@ -40,8 +40,8 @@
#include "src/utils/cpp/json.hpp"
class Expression {
- friend auto operator+(Expression const& /*lhs*/, Expression const& /*rhs*/)
- -> Expression;
+ friend auto operator+(Expression const& /*lhs*/,
+ Expression const& /*rhs*/) -> Expression;
public:
using none_t = std::monostate;
@@ -84,10 +84,9 @@ class Expression {
auto operator=(Expression&& other) noexcept = delete;
template <class T>
- requires(IsValidType<std::remove_cvref_t<T>>())
- // NOLINTNEXTLINE(bugprone-forwarding-reference-overload)
- explicit Expression(T&& data) noexcept
- : data_{std::forward<T>(data)} {}
+ requires(IsValidType<std::remove_cvref_t<T>>())
+ // NOLINTNEXTLINE(bugprone-forwarding-reference-overload)
+ explicit Expression(T&& data) noexcept : data_{std::forward<T>(data)} {}
[[nodiscard]] auto IsNone() const noexcept -> bool { return IsA<none_t>(); }
[[nodiscard]] auto IsBool() const noexcept -> bool { return IsA<bool>(); }
@@ -161,10 +160,10 @@ class Expression {
}
template <class T>
- requires(IsValidType<std::remove_cvref_t<T>>() or
- std::is_same_v<std::remove_cvref_t<T>, ExpressionPtr>)
- [[nodiscard]] auto Get(std::string const& key, T&& default_value) const
- -> ExpressionPtr {
+ requires(IsValidType<std::remove_cvref_t<T>>() or
+ std::is_same_v<std::remove_cvref_t<T>, ExpressionPtr>)
+ [[nodiscard]] auto Get(std::string const& key,
+ T&& default_value) const -> ExpressionPtr {
auto value = At(key);
if (value) {
return value->get();
@@ -178,7 +177,8 @@ class Expression {
}
template <class T>
- requires(IsValidType<T>()) [[nodiscard]] auto Value() const& noexcept
+ requires(IsValidType<T>())
+ [[nodiscard]] auto Value() const& noexcept
-> std::optional<std::reference_wrapper<T const>> {
if (GetIndexOf<T>() == data_.index()) {
return std::make_optional(std::ref(std::get<T>(data_)));
@@ -187,8 +187,8 @@ class Expression {
}
template <class T>
- requires(IsValidType<T>()) [[nodiscard]] auto Value() && noexcept
- -> std::optional<T> {
+ requires(IsValidType<T>())
+ [[nodiscard]] auto Value() && noexcept -> std::optional<T> {
if (GetIndexOf<T>() == data_.index()) {
return std::make_optional(std::move(std::get<T>(data_)));
}
@@ -268,8 +268,8 @@ class Expression {
AtomicValue<bool> is_cachable_{};
template <class T, std::size_t kIndex = 0>
- requires(IsValidType<T>()) [[nodiscard]] static consteval auto GetIndexOf()
- -> std::size_t {
+ requires(IsValidType<T>())
+ [[nodiscard]] static consteval auto GetIndexOf() -> std::size_t {
static_assert(kIndex < std::variant_size_v<decltype(data_)>,
"kIndex out of range");
if constexpr (std::is_same_v<
@@ -313,8 +313,8 @@ class Expression {
}
template <class T>
- requires(Expression::IsValidType<T>())
- [[nodiscard]] static auto TypeToString() noexcept -> std::string {
+ requires(Expression::IsValidType<T>())
+ [[nodiscard]] static auto TypeToString() noexcept -> std::string {
if constexpr (std::is_same_v<T, bool>) {
return "bool";
}
diff --git a/src/buildtool/build_engine/expression/expression_ptr.hpp b/src/buildtool/build_engine/expression/expression_ptr.hpp
index f8b9a77f..b1f698c6 100644
--- a/src/buildtool/build_engine/expression/expression_ptr.hpp
+++ b/src/buildtool/build_engine/expression/expression_ptr.hpp
@@ -37,9 +37,9 @@ class ExpressionPtr {
// Initialize from Expression's variant type or Expression
template <class T>
- requires(not std::is_same_v<std::remove_cvref_t<T>, ExpressionPtr>)
- // NOLINTNEXTLINE(bugprone-forwarding-reference-overload)
- explicit ExpressionPtr(T&& data) noexcept
+ requires(not std::is_same_v<std::remove_cvref_t<T>, ExpressionPtr>)
+ // NOLINTNEXTLINE(bugprone-forwarding-reference-overload)
+ explicit ExpressionPtr(T&& data) noexcept
: ptr_{std::make_shared<Expression>(std::forward<T>(data))} {}
ExpressionPtr() noexcept;
diff --git a/src/buildtool/build_engine/expression/target_node.hpp b/src/buildtool/build_engine/expression/target_node.hpp
index 39c1b4dd..feed94d6 100644
--- a/src/buildtool/build_engine/expression/target_node.hpp
+++ b/src/buildtool/build_engine/expression/target_node.hpp
@@ -34,9 +34,9 @@ class TargetNode {
};
template <class NodeType>
- requires(
- std::is_same_v<NodeType, Value> or
- std::is_same_v<NodeType, Abstract>) explicit TargetNode(NodeType node)
+ requires(std::is_same_v<NodeType, Value> or
+ std::is_same_v<NodeType, Abstract>)
+ explicit TargetNode(NodeType node)
: data_{std::move(node)},
is_cacheable_{std::get<NodeType>(data_).IsCacheable()} {}
diff --git a/src/buildtool/build_engine/target_map/built_in_rules.cpp b/src/buildtool/build_engine/target_map/built_in_rules.cpp
index 94da5991..0237e450 100644
--- a/src/buildtool/build_engine/target_map/built_in_rules.cpp
+++ b/src/buildtool/build_engine/target_map/built_in_rules.cpp
@@ -1660,16 +1660,15 @@ auto IsBuiltInRule(nlohmann::json const& rule_type) -> bool {
return kBuiltIns.contains(rule_name);
}
-auto HandleBuiltin(
- const gsl::not_null<AnalyseContext*>& context,
- const nlohmann::json& rule_type,
- const nlohmann::json& desc,
- const BuildMaps::Target::ConfiguredTarget& key,
- const BuildMaps::Target::TargetMap::SubCallerPtr& subcaller,
- const BuildMaps::Target::TargetMap::SetterPtr& setter,
- const BuildMaps::Target::TargetMap::LoggerPtr& logger,
- const gsl::not_null<BuildMaps::Target::ResultTargetMap*>& result_map)
- -> bool {
+auto HandleBuiltin(const gsl::not_null<AnalyseContext*>& context,
+ const nlohmann::json& rule_type,
+ const nlohmann::json& desc,
+ const BuildMaps::Target::ConfiguredTarget& key,
+ const BuildMaps::Target::TargetMap::SubCallerPtr& subcaller,
+ const BuildMaps::Target::TargetMap::SetterPtr& setter,
+ const BuildMaps::Target::TargetMap::LoggerPtr& logger,
+ const gsl::not_null<BuildMaps::Target::ResultTargetMap*>&
+ result_map) -> bool {
if (not rule_type.is_string()) {
// Names for built-in rules are always strings
return false;
diff --git a/src/buildtool/build_engine/target_map/built_in_rules.hpp b/src/buildtool/build_engine/target_map/built_in_rules.hpp
index 6790148a..653344f2 100644
--- a/src/buildtool/build_engine/target_map/built_in_rules.hpp
+++ b/src/buildtool/build_engine/target_map/built_in_rules.hpp
@@ -23,15 +23,14 @@
#include "src/buildtool/main/analyse_context.hpp"
namespace BuildMaps::Target {
-auto HandleBuiltin(
- const gsl::not_null<AnalyseContext*>& context,
- const nlohmann::json& rule_type,
- const nlohmann::json& desc,
- const BuildMaps::Target::ConfiguredTarget& key,
- const BuildMaps::Target::TargetMap::SubCallerPtr& subcaller,
- const BuildMaps::Target::TargetMap::SetterPtr& setter,
- const BuildMaps::Target::TargetMap::LoggerPtr& logger,
- const gsl::not_null<BuildMaps::Target::ResultTargetMap*>& result_map)
- -> bool;
+auto HandleBuiltin(const gsl::not_null<AnalyseContext*>& context,
+ const nlohmann::json& rule_type,
+ const nlohmann::json& desc,
+ const BuildMaps::Target::ConfiguredTarget& key,
+ const BuildMaps::Target::TargetMap::SubCallerPtr& subcaller,
+ const BuildMaps::Target::TargetMap::SetterPtr& setter,
+ const BuildMaps::Target::TargetMap::LoggerPtr& logger,
+ const gsl::not_null<BuildMaps::Target::ResultTargetMap*>&
+ result_map) -> bool;
} // namespace BuildMaps::Target
#endif
diff --git a/src/buildtool/build_engine/target_map/configured_target.hpp b/src/buildtool/build_engine/target_map/configured_target.hpp
index 9a374b5a..88c59cf2 100644
--- a/src/buildtool/build_engine/target_map/configured_target.hpp
+++ b/src/buildtool/build_engine/target_map/configured_target.hpp
@@ -32,9 +32,8 @@ struct ConfiguredTarget {
static constexpr std::size_t kConfigLength = 320;
- [[nodiscard]] auto operator==(
- BuildMaps::Target::ConfiguredTarget const& other) const noexcept
- -> bool {
+ [[nodiscard]] auto operator==(BuildMaps::Target::ConfiguredTarget const&
+ other) const noexcept -> bool {
return target == other.target and config == other.config;
}
diff --git a/src/buildtool/crypto/hash_function.cpp b/src/buildtool/crypto/hash_function.cpp
index 6f240e50..4be9033d 100644
--- a/src/buildtool/crypto/hash_function.cpp
+++ b/src/buildtool/crypto/hash_function.cpp
@@ -57,15 +57,13 @@ auto HashFunction::HashTaggedLine(std::string const& data,
return std::move(hasher).Finalize();
}
-auto HashFunction::HashBlobFile(
- std::filesystem::path const& path) const noexcept
- -> std::optional<std::pair<Hasher::HashDigest, std::uintmax_t>> {
+auto HashFunction::HashBlobFile(std::filesystem::path const& path) const
+ noexcept -> std::optional<std::pair<Hasher::HashDigest, std::uintmax_t>> {
return HashTaggedFile(path, CreateGitBlobTag);
}
-auto HashFunction::HashTreeFile(
- std::filesystem::path const& path) const noexcept
- -> std::optional<std::pair<Hasher::HashDigest, std::uintmax_t>> {
+auto HashFunction::HashTreeFile(std::filesystem::path const& path) const
+ noexcept -> std::optional<std::pair<Hasher::HashDigest, std::uintmax_t>> {
return HashTaggedFile(path, CreateGitTreeTag);
}
diff --git a/src/buildtool/execution_api/execution_service/execution_server.hpp b/src/buildtool/execution_api/execution_service/execution_server.hpp
index e0c4f4fe..01ede03e 100644
--- a/src/buildtool/execution_api/execution_service/execution_server.hpp
+++ b/src/buildtool/execution_api/execution_service/execution_server.hpp
@@ -124,11 +124,10 @@ class ExecutionServiceImpl final : public bazel_re::Execution::Service {
// operation. The server MAY choose to stream additional updates as
// execution progresses, such as to provide an update as to the state of the
// execution.
- auto WaitExecution(
- ::grpc::ServerContext* context,
- const ::bazel_re::WaitExecutionRequest* request,
- ::grpc::ServerWriter<::google::longrunning::Operation>* writer)
- -> ::grpc::Status override;
+ auto WaitExecution(::grpc::ServerContext* context,
+ const ::bazel_re::WaitExecutionRequest* request,
+ ::grpc::ServerWriter<::google::longrunning::Operation>*
+ writer) -> ::grpc::Status override;
private:
StorageConfig const& storage_config_;
diff --git a/src/buildtool/execution_engine/dag/dag.hpp b/src/buildtool/execution_engine/dag/dag.hpp
index 422e42c6..99a35f4b 100644
--- a/src/buildtool/execution_engine/dag/dag.hpp
+++ b/src/buildtool/execution_engine/dag/dag.hpp
@@ -134,8 +134,8 @@ class DirectedAcyclicGraph {
NodeTraversalState() noexcept = default;
NodeTraversalState(NodeTraversalState const&) = delete;
NodeTraversalState(NodeTraversalState&&) = delete;
- auto operator=(NodeTraversalState const&)
- -> NodeTraversalState& = delete;
+ auto operator=(NodeTraversalState const&) -> NodeTraversalState& =
+ delete;
auto operator=(NodeTraversalState&&) -> NodeTraversalState& = delete;
~NodeTraversalState() noexcept = default;
diff --git a/src/buildtool/execution_engine/traverser/traverser.hpp b/src/buildtool/execution_engine/traverser/traverser.hpp
index e99c2565..8cfb991f 100644
--- a/src/buildtool/execution_engine/traverser/traverser.hpp
+++ b/src/buildtool/execution_engine/traverser/traverser.hpp
@@ -31,10 +31,8 @@ template <class T>
concept Runnable = requires(T const r,
DependencyGraph::ActionNode const* action,
DependencyGraph::ArtifactNode const* artifact) {
- { r.Process(action) }
- ->same_as<bool>;
- { r.Process(artifact) }
- ->same_as<bool>;
+ { r.Process(action) } -> same_as<bool>;
+ { r.Process(artifact) } -> same_as<bool>;
};
/// \brief Class to traverse the dependency graph executing necessary actions
@@ -67,9 +65,8 @@ class Traverser {
// Traverse starting by the artifacts with the given identifiers, avoiding
// executing actions that are not strictly needed to build the given
// artifacts
- [[nodiscard]] auto Traverse(
- std::unordered_set<ArtifactIdentifier> const& target_ids) noexcept
- -> bool;
+ [[nodiscard]] auto Traverse(std::unordered_set<ArtifactIdentifier> const&
+ target_ids) noexcept -> bool;
private:
Executor const& runner_{};
diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp
index 0e00537a..6cf8f256 100644
--- a/src/buildtool/file_system/file_system_manager.hpp
+++ b/src/buildtool/file_system/file_system_manager.hpp
@@ -246,11 +246,11 @@ class FileSystemManager {
}
template <ObjectType kType, bool kSetEpochTime = false>
- requires(IsFileObject(kType))
- [[nodiscard]] static auto CreateFileHardlinkAs(
- std::filesystem::path const& file_path,
- std::filesystem::path const& link_path,
- LogLevel log_failure_at = LogLevel::Error) noexcept -> bool {
+ requires(IsFileObject(kType))
+ [[nodiscard]] static auto CreateFileHardlinkAs(
+ std::filesystem::path const& file_path,
+ std::filesystem::path const& link_path,
+ LogLevel log_failure_at = LogLevel::Error) noexcept -> bool {
// Set permissions first (permissions are a property of the file) so
// that the created link has the correct permissions as soon as the link
// creation is finished.
@@ -354,7 +354,8 @@ class FileSystemManager {
template <ObjectType kType,
bool kSetEpochTime = false,
bool kSetWritable = false>
- requires(IsFileObject(kType)) [[nodiscard]] static auto CopyFileAs(
+ requires(IsFileObject(kType))
+ [[nodiscard]] static auto CopyFileAs(
std::filesystem::path const& src,
std::filesystem::path const& dst,
bool fd_less = false,
@@ -929,10 +930,10 @@ class FileSystemManager {
template <ObjectType kType,
bool kSetEpochTime = false,
bool kSetWritable = false>
- requires(IsFileObject(kType))
- [[nodiscard]] static auto WriteFileAs(std::string const& content,
- std::filesystem::path const& file,
- bool fd_less = false) noexcept
+ requires(IsFileObject(kType))
+ [[nodiscard]] static auto WriteFileAs(std::string const& content,
+ std::filesystem::path const& file,
+ bool fd_less = false) noexcept
-> bool {
return WriteFile(content, file, fd_less) and
SetFilePermissions<kSetWritable>(file,
@@ -1336,6 +1337,6 @@ class FileSystemManager {
}
}; // class LowLevel
-}; // class FileSystemManager
+}; // class FileSystemManager
#endif // INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_FILE_SYSTEM_MANAGER_HPP
diff --git a/src/buildtool/file_system/git_cas.hpp b/src/buildtool/file_system/git_cas.hpp
index f01d5617..c1223411 100644
--- a/src/buildtool/file_system/git_cas.hpp
+++ b/src/buildtool/file_system/git_cas.hpp
@@ -48,9 +48,8 @@ class GitCAS {
/// \brief Read object from CAS.
/// \param id The object id.
/// \param is_hex_id Specify whether `id` is hex string or raw.
- [[nodiscard]] auto ReadObject(std::string const& id,
- bool is_hex_id = false) const noexcept
- -> std::optional<std::string>;
+ [[nodiscard]] auto ReadObject(std::string const& id, bool is_hex_id = false)
+ const noexcept -> std::optional<std::string>;
/// \brief Read object header from CAS.
/// \param id The object id.
@@ -59,9 +58,8 @@ class GitCAS {
// Note that most backends do not support reading only the header of an
// object, so the whole object will be read and then the header will be
// returned.
- [[nodiscard]] auto ReadHeader(std::string const& id,
- bool is_hex_id = false) const noexcept
- -> std::optional<std::pair<std::size_t, ObjectType>>;
+ [[nodiscard]] auto ReadHeader(std::string const& id, bool is_hex_id = false)
+ const noexcept -> std::optional<std::pair<std::size_t, ObjectType>>;
private:
std::unique_ptr<git_odb, decltype(&odb_closer)> odb_{nullptr, odb_closer};
diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp
index 5ab010d4..c75029ee 100644
--- a/src/buildtool/file_system/git_repo.cpp
+++ b/src/buildtool/file_system/git_repo.cpp
@@ -264,8 +264,8 @@ struct InMemoryODBBackend {
return GIT_ERROR;
}
-[[nodiscard]] auto backend_exists(git_odb_backend* _backend, const git_oid* oid)
- -> int {
+[[nodiscard]] auto backend_exists(git_odb_backend* _backend,
+ const git_oid* oid) -> int {
if (_backend != nullptr and oid != nullptr) {
auto* b = reinterpret_cast<InMemoryODBBackend*>(_backend); // NOLINT
if (auto id = ToRawString(*oid)) {
diff --git a/src/buildtool/file_system/git_utils.cpp b/src/buildtool/file_system/git_utils.cpp
index 8e45671b..8fed7d7b 100644
--- a/src/buildtool/file_system/git_utils.cpp
+++ b/src/buildtool/file_system/git_utils.cpp
@@ -40,8 +40,8 @@ auto GitLastError() noexcept -> std::string {
return "<unknown error>";
}
-auto GitObjectID(std::string const& id, bool is_hex_id) noexcept
- -> std::optional<git_oid> {
+auto GitObjectID(std::string const& id,
+ bool is_hex_id) noexcept -> std::optional<git_oid> {
#ifdef BOOTSTRAP_BUILD_TOOL
return std::nullopt;
#else
diff --git a/src/buildtool/logging/log_sink_cmdline.hpp b/src/buildtool/logging/log_sink_cmdline.hpp
index 89990f1c..a30aee56 100644
--- a/src/buildtool/logging/log_sink_cmdline.hpp
+++ b/src/buildtool/logging/log_sink_cmdline.hpp
@@ -93,9 +93,8 @@ class LogSinkCmdLine final : public ILogSink {
bool colored_{};
std::optional<LogLevel> restrict_level_{};
- [[nodiscard]] auto FormatPrefix(LogLevel level,
- std::string const& prefix) const noexcept
- -> std::string {
+ [[nodiscard]] auto FormatPrefix(LogLevel level, std::string const& prefix)
+ const noexcept -> std::string {
fmt::text_style style{};
if (colored_) {
switch (level) {
diff --git a/src/buildtool/main/cli.hpp b/src/buildtool/main/cli.hpp
index e03e9bec..4c28b1f6 100644
--- a/src/buildtool/main/cli.hpp
+++ b/src/buildtool/main/cli.hpp
@@ -57,7 +57,7 @@ struct CommandLineArguments {
ToAddArguments to_add;
};
-auto ParseCommandLineArguments(int argc, char const* const* argv)
- -> CommandLineArguments;
+auto ParseCommandLineArguments(int argc,
+ char const* const* argv) -> CommandLineArguments;
#endif
diff --git a/src/buildtool/progress_reporting/progress.hpp b/src/buildtool/progress_reporting/progress.hpp
index 303617e1..f04a4657 100644
--- a/src/buildtool/progress_reporting/progress.hpp
+++ b/src/buildtool/progress_reporting/progress.hpp
@@ -33,10 +33,11 @@ class Progress {
// Return a reference to the origin map. It is the responsibility of the
// caller to ensure that access only happens in a single-threaded context.
- [[nodiscard]] auto OriginMap() noexcept -> std::unordered_map<
- std::string,
- std::vector<
- std::pair<BuildMaps::Target::ConfiguredTarget, std::size_t>>>& {
+ [[nodiscard]] auto OriginMap() noexcept
+ -> std::unordered_map<
+ std::string,
+ std::vector<
+ std::pair<BuildMaps::Target::ConfiguredTarget, std::size_t>>>& {
return origin_map_;
}
diff --git a/src/buildtool/storage/compactifier.cpp b/src/buildtool/storage/compactifier.cpp
index e6f9a344..1e6033ed 100644
--- a/src/buildtool/storage/compactifier.cpp
+++ b/src/buildtool/storage/compactifier.cpp
@@ -59,9 +59,9 @@ template <ObjectType kType>
/// \return True if the entry directory doesn't contain spliced
/// entries.
template <ObjectType kLargeType, ObjectType... kType>
-requires(sizeof...(kType) != 0)
- [[nodiscard]] auto RemoveSpliced(CompactificationTask const& task,
- std::filesystem::path const& key) noexcept
+ requires(sizeof...(kType) != 0)
+[[nodiscard]] auto RemoveSpliced(CompactificationTask const& task,
+ std::filesystem::path const& key) noexcept
-> bool;
/// \brief Split and remove a key entry from the kType storage. Results of
@@ -211,9 +211,9 @@ template <ObjectType kType>
}
template <ObjectType kLargeType, ObjectType... kType>
-requires(sizeof...(kType) != 0)
- [[nodiscard]] auto RemoveSpliced(CompactificationTask const& task,
- std::filesystem::path const& key) noexcept
+ requires(sizeof...(kType) != 0)
+[[nodiscard]] auto RemoveSpliced(CompactificationTask const& task,
+ std::filesystem::path const& key) noexcept
-> bool {
static constexpr bool kLarge = true;
auto const directory = task.cas.StorageRoot(kLargeType, kLarge) / key;
diff --git a/src/buildtool/storage/large_object_cas.hpp b/src/buildtool/storage/large_object_cas.hpp
index 70f1e7d8..971b943d 100644
--- a/src/buildtool/storage/large_object_cas.hpp
+++ b/src/buildtool/storage/large_object_cas.hpp
@@ -163,7 +163,8 @@ class LargeObjectCAS final {
/// \param digest The digest of the large entry to uplink.
/// \returns True if the large entry was successfully uplinked.
template <bool kIsLocalGeneration = not kDoGlobalUplink>
- requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplink(
+ requires(kIsLocalGeneration)
+ [[nodiscard]] auto LocalUplink(
LocalCAS<false> const& latest,
LargeObjectCAS<false, kType> const& latest_large,
bazel_re::Digest const& digest) const noexcept -> bool;
diff --git a/src/buildtool/storage/large_object_cas.tpp b/src/buildtool/storage/large_object_cas.tpp
index dae1d696..5fbfee07 100644
--- a/src/buildtool/storage/large_object_cas.tpp
+++ b/src/buildtool/storage/large_object_cas.tpp
@@ -243,10 +243,11 @@ auto LargeObjectCAS<kDoGlobalUplink, kType>::Splice(
template <bool kDoGlobalUplink, ObjectType kType>
template <bool kIsLocalGeneration>
-requires(kIsLocalGeneration) auto LargeObjectCAS<kDoGlobalUplink, kType>::
- LocalUplink(LocalCAS<false> const& latest,
- LargeObjectCAS<false, kType> const& latest_large,
- bazel_re::Digest const& digest) const noexcept -> bool {
+ requires(kIsLocalGeneration)
+auto LargeObjectCAS<kDoGlobalUplink, kType>::LocalUplink(
+ LocalCAS<false> const& latest,
+ LargeObjectCAS<false, kType> const& latest_large,
+ bazel_re::Digest const& digest) const noexcept -> bool {
// Check the large entry in the youngest generation:
if (latest_large.GetEntryPath(digest)) {
return true;
diff --git a/src/buildtool/storage/local_ac.hpp b/src/buildtool/storage/local_ac.hpp
index a93130a5..b39c63dd 100644
--- a/src/buildtool/storage/local_ac.hpp
+++ b/src/buildtool/storage/local_ac.hpp
@@ -82,7 +82,8 @@ class LocalAC {
/// \param action_id The id of the action used as entry key.
/// \returns True if entry was successfully uplinked.
template <bool kIsLocalGeneration = not kDoGlobalUplink>
- requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkEntry(
+ requires(kIsLocalGeneration)
+ [[nodiscard]] auto LocalUplinkEntry(
LocalGenerationAC const& latest,
bazel_re::Digest const& action_id) const noexcept -> bool;
diff --git a/src/buildtool/storage/local_ac.tpp b/src/buildtool/storage/local_ac.tpp
index 5fee10ff..ee21e86a 100644
--- a/src/buildtool/storage/local_ac.tpp
+++ b/src/buildtool/storage/local_ac.tpp
@@ -54,7 +54,8 @@ auto LocalAC<kDoGlobalUplink>::CachedResult(bazel_re::Digest const& action_id)
template <bool kDoGlobalUplink>
template <bool kIsLocalGeneration>
-requires(kIsLocalGeneration) auto LocalAC<kDoGlobalUplink>::LocalUplinkEntry(
+ requires(kIsLocalGeneration)
+auto LocalAC<kDoGlobalUplink>::LocalUplinkEntry(
LocalGenerationAC const& latest,
bazel_re::Digest const& action_id) const noexcept -> bool {
// Determine action cache key path in latest generation.
diff --git a/src/buildtool/storage/local_cas.hpp b/src/buildtool/storage/local_cas.hpp
index 287b1d7b..86bfc0e4 100644
--- a/src/buildtool/storage/local_cas.hpp
+++ b/src/buildtool/storage/local_cas.hpp
@@ -71,9 +71,8 @@ class LocalCAS {
/// \brief Obtain path to the storage root.
/// \param type Type of the storage to be obtained.
/// \param large True if a large storage is needed.
- [[nodiscard]] auto StorageRoot(ObjectType type,
- bool large = false) const noexcept
- -> std::filesystem::path const& {
+ [[nodiscard]] auto StorageRoot(ObjectType type, bool large = false)
+ const noexcept -> std::filesystem::path const& {
if (large) {
return IsTreeObject(type) ? cas_tree_large_.StorageRoot()
: cas_file_large_.StorageRoot();
@@ -226,7 +225,8 @@ class LocalCAS {
/// generation.
/// \returns True if blob was successfully uplinked.
template <bool kIsLocalGeneration = not kDoGlobalUplink>
- requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkBlob(
+ requires(kIsLocalGeneration)
+ [[nodiscard]] auto LocalUplinkBlob(
LocalGenerationCAS const& latest,
bazel_re::Digest const& digest,
bool is_executable,
@@ -248,7 +248,8 @@ class LocalCAS {
/// generation.
/// \returns True if tree was successfully uplinked.
template <bool kIsLocalGeneration = not kDoGlobalUplink>
- requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkTree(
+ requires(kIsLocalGeneration)
+ [[nodiscard]] auto LocalUplinkTree(
LocalGenerationCAS const& latest,
bazel_re::Digest const& digest,
bool splice_result = false) const noexcept -> bool;
@@ -263,7 +264,8 @@ class LocalCAS {
/// \param digest The digest of the large entry to uplink.
/// \returns True if the large entry was successfully uplinked.
template <ObjectType kType, bool kIsLocalGeneration = not kDoGlobalUplink>
- requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkLargeObject(
+ requires(kIsLocalGeneration)
+ [[nodiscard]] auto LocalUplinkLargeObject(
LocalGenerationCAS const& latest,
bazel_re::Digest const& digest) const noexcept -> bool;
@@ -311,21 +313,23 @@ class LocalCAS {
}
template <bool kIsLocalGeneration = not kDoGlobalUplink>
- requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkGitTree(
+ requires(kIsLocalGeneration)
+ [[nodiscard]] auto LocalUplinkGitTree(
LocalGenerationCAS const& latest,
bazel_re::Digest const& digest,
bool splice_result = false) const noexcept -> bool;
template <bool kIsLocalGeneration = not kDoGlobalUplink>
- requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkBazelDirectory(
+ requires(kIsLocalGeneration)
+ [[nodiscard]] auto LocalUplinkBazelDirectory(
LocalGenerationCAS const& latest,
bazel_re::Digest const& digest,
gsl::not_null<std::unordered_set<bazel_re::Digest>*> const& seen,
bool splice_result = false) const noexcept -> bool;
template <ObjectType kType, bool kIsLocalGeneration = not kDoGlobalUplink>
- requires(kIsLocalGeneration) [[nodiscard]] auto TrySplice(
- bazel_re::Digest const& digest) const noexcept
+ requires(kIsLocalGeneration)
+ [[nodiscard]] auto TrySplice(bazel_re::Digest const& digest) const noexcept
-> std::optional<LargeObject>;
template <ObjectType kType>
diff --git a/src/buildtool/storage/local_cas.tpp b/src/buildtool/storage/local_cas.tpp
index eba99a67..96224c3c 100644
--- a/src/buildtool/storage/local_cas.tpp
+++ b/src/buildtool/storage/local_cas.tpp
@@ -41,7 +41,8 @@ namespace detail {
template <bool kDoGlobalUplink>
template <bool kIsLocalGeneration>
-requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkBlob(
+ requires(kIsLocalGeneration)
+auto LocalCAS<kDoGlobalUplink>::LocalUplinkBlob(
LocalGenerationCAS const& latest,
bazel_re::Digest const& digest,
bool is_executable,
@@ -92,7 +93,8 @@ requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkBlob(
template <bool kDoGlobalUplink>
template <bool kIsLocalGeneration>
-requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkTree(
+ requires(kIsLocalGeneration)
+auto LocalCAS<kDoGlobalUplink>::LocalUplinkTree(
LocalGenerationCAS const& latest,
bazel_re::Digest const& digest,
bool splice_result) const noexcept -> bool {
@@ -105,7 +107,8 @@ requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkTree(
template <bool kDoGlobalUplink>
template <bool kIsLocalGeneration>
-requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkGitTree(
+ requires(kIsLocalGeneration)
+auto LocalCAS<kDoGlobalUplink>::LocalUplinkGitTree(
LocalGenerationCAS const& latest,
bazel_re::Digest const& digest,
bool splice_result) const noexcept -> bool {
@@ -199,12 +202,12 @@ requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::LocalUplinkGitTree(
template <bool kDoGlobalUplink>
template <bool kIsLocalGeneration>
-requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::
- LocalUplinkBazelDirectory(
- LocalGenerationCAS const& latest,
- bazel_re::Digest const& digest,
- gsl::not_null<std::unordered_set<bazel_re::Digest>*> const& seen,
- bool splice_result) const noexcept -> bool {
+ requires(kIsLocalGeneration)
+auto LocalCAS<kDoGlobalUplink>::LocalUplinkBazelDirectory(
+ LocalGenerationCAS const& latest,
+ bazel_re::Digest const& digest,
+ gsl::not_null<std::unordered_set<bazel_re::Digest>*> const& seen,
+ bool splice_result) const noexcept -> bool {
// Skip already uplinked directories
if (seen->contains(digest)) {
return true;
@@ -271,10 +274,10 @@ requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::
template <bool kDoGlobalUplink>
template <ObjectType kType, bool kIsLocalGeneration>
-requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::
- LocalUplinkLargeObject(LocalGenerationCAS const& latest,
- bazel_re::Digest const& digest) const noexcept
- -> bool {
+ requires(kIsLocalGeneration)
+auto LocalCAS<kDoGlobalUplink>::LocalUplinkLargeObject(
+ LocalGenerationCAS const& latest,
+ bazel_re::Digest const& digest) const noexcept -> bool {
if constexpr (IsTreeObject(kType)) {
return cas_tree_large_.LocalUplink(
latest, latest.cas_tree_large_, digest);
@@ -287,9 +290,9 @@ requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::
template <bool kDoGlobalUplink>
template <ObjectType kType, bool kIsLocalGeneration>
-requires(kIsLocalGeneration) auto LocalCAS<kDoGlobalUplink>::TrySplice(
- bazel_re::Digest const& digest) const noexcept
- -> std::optional<LargeObject> {
+ requires(kIsLocalGeneration)
+auto LocalCAS<kDoGlobalUplink>::TrySplice(bazel_re::Digest const& digest)
+ const noexcept -> std::optional<LargeObject> {
auto spliced = IsTreeObject(kType) ? cas_tree_large_.TrySplice(digest)
: cas_file_large_.TrySplice(digest);
return spliced and spliced->IsValid() ? std::optional{std::move(*spliced)}
diff --git a/src/buildtool/storage/target_cache.hpp b/src/buildtool/storage/target_cache.hpp
index 2f52e100..6feff6a2 100644
--- a/src/buildtool/storage/target_cache.hpp
+++ b/src/buildtool/storage/target_cache.hpp
@@ -112,7 +112,8 @@ class TargetCache {
/// \param key The target-cache key for the entry to uplink.
/// \returns True if entry was successfully uplinked.
template <bool kIsLocalGeneration = not kDoGlobalUplink>
- requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkEntry(
+ requires(kIsLocalGeneration)
+ [[nodiscard]] auto LocalUplinkEntry(
LocalGenerationTC const& latest,
TargetCacheKey const& key) const noexcept -> bool;
@@ -140,7 +141,8 @@ class TargetCache {
explicit_shard_{explicit_shard} {}
template <bool kIsLocalGeneration = not kDoGlobalUplink>
- requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkEntry(
+ requires(kIsLocalGeneration)
+ [[nodiscard]] auto LocalUplinkEntry(
LocalGenerationTC const& latest,
std::string const& key_digest) const noexcept -> bool;
diff --git a/src/buildtool/storage/target_cache.tpp b/src/buildtool/storage/target_cache.tpp
index 9ddd19d2..502c346a 100644
--- a/src/buildtool/storage/target_cache.tpp
+++ b/src/buildtool/storage/target_cache.tpp
@@ -113,18 +113,19 @@ auto TargetCache<kDoGlobalUplink>::Read(
template <bool kDoGlobalUplink>
template <bool kIsLocalGeneration>
-requires(kIsLocalGeneration) auto TargetCache<
- kDoGlobalUplink>::LocalUplinkEntry(LocalGenerationTC const& latest,
- TargetCacheKey const& key) const noexcept
- -> bool {
+ requires(kIsLocalGeneration)
+auto TargetCache<kDoGlobalUplink>::LocalUplinkEntry(
+ LocalGenerationTC const& latest,
+ TargetCacheKey const& key) const noexcept -> bool {
return LocalUplinkEntry(latest, key.Id().digest.hash());
}
template <bool kDoGlobalUplink>
template <bool kIsLocalGeneration>
-requires(kIsLocalGeneration) auto TargetCache<kDoGlobalUplink>::
- LocalUplinkEntry(LocalGenerationTC const& latest,
- std::string const& key_digest) const noexcept -> bool {
+ requires(kIsLocalGeneration)
+auto TargetCache<kDoGlobalUplink>::LocalUplinkEntry(
+ LocalGenerationTC const& latest,
+ std::string const& key_digest) const noexcept -> bool {
// Determine target cache key path of given generation.
if (FileSystemManager::IsFile(latest.file_store_.GetPath(key_digest))) {
return true;
diff --git a/src/other_tools/just_mr/mirrors.hpp b/src/other_tools/just_mr/mirrors.hpp
index 8b7dae30..f3fa8b14 100644
--- a/src/other_tools/just_mr/mirrors.hpp
+++ b/src/other_tools/just_mr/mirrors.hpp
@@ -113,9 +113,8 @@ namespace MirrorsUtils {
hostnames.begin(),
hostnames.end(),
std::inserter(mirrors_by_hostname, mirrors_by_hostname.end()),
- [](auto const& hostname) -> typename map_t::value_type {
- return {hostname, {/*empty*/}};
- });
+ [](auto const& hostname) ->
+ typename map_t::value_type { return {hostname, {/*empty*/}}; });
// fill mirrors list per hostname
for (auto const& mirror : mirrors) {
diff --git a/src/utils/archive/archive_ops.cpp b/src/utils/archive/archive_ops.cpp
index 59b1d8a0..8e70c814 100644
--- a/src/utils/archive/archive_ops.cpp
+++ b/src/utils/archive/archive_ops.cpp
@@ -95,8 +95,8 @@ auto enable_read_filter(archive* ar, ArchiveType type) -> bool {
} // namespace
#endif // BOOTSTRAP_BUILD_TOOL
-auto ArchiveOps::WriteEntry(archive_entry* entry, archive* aw)
- -> std::optional<std::string> {
+auto ArchiveOps::WriteEntry(archive_entry* entry,
+ archive* aw) -> std::optional<std::string> {
#ifndef BOOTSTRAP_BUILD_TOOL
std::filesystem::path entry_path{archive_entry_sourcepath(entry)};
// only write to archive if entry is file
@@ -115,8 +115,8 @@ auto ArchiveOps::WriteEntry(archive_entry* entry, archive* aw)
return std::nullopt;
}
-auto ArchiveOps::CopyData(archive* ar, archive* aw)
- -> std::optional<std::string> {
+auto ArchiveOps::CopyData(archive* ar,
+ archive* aw) -> std::optional<std::string> {
#ifndef BOOTSTRAP_BUILD_TOOL
int r{};
const void* buff{nullptr};
diff --git a/src/utils/cpp/atomic.hpp b/src/utils/cpp/atomic.hpp
index 13dc8ca9..4ef7e40c 100644
--- a/src/utils/cpp/atomic.hpp
+++ b/src/utils/cpp/atomic.hpp
@@ -102,8 +102,8 @@ class atomic_shared_ptr {
atomic_shared_ptr(atomic_shared_ptr&& other) = delete;
~atomic_shared_ptr() = default;
- auto operator=(atomic_shared_ptr const& other)
- -> atomic_shared_ptr& = delete;
+ auto operator=(atomic_shared_ptr const& other) -> atomic_shared_ptr& =
+ delete;
auto operator=(atomic_shared_ptr&& other) -> atomic_shared_ptr& = delete;
auto operator=(ptr_t desired) -> ptr_t { // NOLINT
std::shared_lock lock(mutex_);
diff --git a/src/utils/cpp/concepts.hpp b/src/utils/cpp/concepts.hpp
index 548fb960..90946762 100644
--- a/src/utils/cpp/concepts.hpp
+++ b/src/utils/cpp/concepts.hpp
@@ -22,71 +22,72 @@
// TODO(modernize): remove this once std::derived_from is shipped with libcxx
template <class T, class U>
-concept derived_from = std::is_base_of_v<U, T>&&
+concept derived_from =
+ std::is_base_of_v<U, T> &&
std::is_convertible_v<const volatile T*, const volatile U*>;
// TODO(modernize): remove this once std::same_as is shipped with libcxx
template <class T, class U>
-concept same_as = std::is_same_v<T, U>and std::is_same_v<U, T>;
+concept same_as = std::is_same_v<T, U> and std::is_same_v<U, T>;
template <class T>
-concept ContainsString = requires {
- typename T::value_type;
-}
-and std::is_same_v<typename T::value_type, std::string>;
+concept ContainsString = requires { typename T::value_type; } and
+ std::is_same_v<typename T::value_type, std::string>;
template <class T>
concept HasSize = requires(T const c) {
- { c.size() }
- ->same_as<std::size_t>; // TODO(modernize): replace by std::same_as
+ {
+ c.size()
+ } -> same_as<std::size_t>; // TODO(modernize): replace by std::same_as
};
template <typename T>
concept HasToString = requires(T const t) {
- { t.ToString() }
- ->same_as<std::string>; // TODO(modernize): replace by std::same_as
+ {
+ t.ToString()
+ } -> same_as<std::string>; // TODO(modernize): replace by std::same_as
};
template <class T>
concept InputIterableContainer = requires(T const c) {
- { c.begin() }
- ->same_as<typename T::const_iterator>; // TODO(modernize): replace by
- // std::input_iterator
- { c.end() }
- ->same_as<typename T::const_iterator>; // TODO(modernize): replace by
- // std::input_iterator
+ {
+ c.begin()
+ } -> same_as<typename T::const_iterator>; // TODO(modernize): replace by
+ // std::input_iterator
+ {
+ c.end()
+ } -> same_as<typename T::const_iterator>; // TODO(modernize): replace by
+ // std::input_iterator
};
template <class T>
-concept OutputIterableContainer = InputIterableContainer<T>and requires(T c) {
- { std::inserter(c, c.begin()) }
- ->same_as<std::insert_iterator<T>>; // TODO(modernize): replace by
- // std::output_iterator
+concept OutputIterableContainer = InputIterableContainer<T> and requires(T c) {
+ {
+ std::inserter(c, c.begin())
+ } -> same_as<std::insert_iterator<T>>; // TODO(modernize): replace by
+ // std::output_iterator
};
template <class T>
concept InputIterableStringContainer =
- InputIterableContainer<T>and ContainsString<T>;
+ InputIterableContainer<T> and ContainsString<T>;
// TODO(modernize): remove this once we require clang version >= 14.0.0
template <typename T>
concept ClockHasFromSys =
requires(std::chrono::time_point<std::chrono::system_clock> const tp) {
- T::from_sys(tp);
-};
+ T::from_sys(tp);
+ };
// TODO(modernize): remove this once we require clang version >= 14.0.0
template <typename T>
-concept ClockHasFromTime = requires(std::time_t const t) {
- T::from_time_t(t);
-};
+concept ClockHasFromTime = requires(std::time_t const t) { T::from_time_t(t); };
template <typename T>
concept StrMapConstForwardIterator = requires(T const c) {
{
- std::remove_reference_t<decltype((*c).first)> { (*c).first }
- }
- ->same_as<std::string const>;
+ std::remove_reference_t<decltype((*c).first)>{(*c).first}
+ } -> same_as<std::string const>;
};
#endif // INCLUDED_SRC_UTILS_CPP_CONCEPTS_HPP
diff --git a/src/utils/cpp/hash_combine.hpp b/src/utils/cpp/hash_combine.hpp
index a09c9985..78fed417 100644
--- a/src/utils/cpp/hash_combine.hpp
+++ b/src/utils/cpp/hash_combine.hpp
@@ -22,8 +22,8 @@
// Taken from Boost, as hash_combine did not yet make it to STL.
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0814r0.pdf
template <class T>
-inline auto hash_combine(gsl::not_null<std::size_t*> const& seed, T const& v)
- -> void {
+inline auto hash_combine(gsl::not_null<std::size_t*> const& seed,
+ T const& v) -> void {
*seed ^=
std::hash<T>{}(v) + 0x9e3779b9 + (*seed << 6) + (*seed >> 2); // NOLINT
}
diff --git a/src/utils/cpp/json.hpp b/src/utils/cpp/json.hpp
index 64c208a7..1fe4df3f 100644
--- a/src/utils/cpp/json.hpp
+++ b/src/utils/cpp/json.hpp
@@ -33,8 +33,8 @@ auto ExtractValueAs(
nlohmann::json const& j,
std::string const& key,
std::function<void(std::string const& error)>&& logger =
- [](std::string const& /*unused*/) -> void {}) noexcept
- -> std::optional<ValueT> {
+ [](std::string const& /*unused*/) -> void {
+ }) noexcept -> std::optional<ValueT> {
try {
auto it = j.find(key);
if (it == j.end()) {
diff --git a/src/utils/cpp/type_safe_arithmetic.hpp b/src/utils/cpp/type_safe_arithmetic.hpp
index 373f76fc..be2ca405 100644
--- a/src/utils/cpp/type_safe_arithmetic.hpp
+++ b/src/utils/cpp/type_safe_arithmetic.hpp
@@ -70,10 +70,10 @@ class type_safe_arithmetic {
type_safe_arithmetic(type_safe_arithmetic const&) = default;
type_safe_arithmetic(type_safe_arithmetic&&) noexcept = default;
- auto operator=(type_safe_arithmetic const&)
- -> type_safe_arithmetic& = default;
- auto operator=(type_safe_arithmetic&&) noexcept
- -> type_safe_arithmetic& = default;
+ auto operator=(type_safe_arithmetic const&) -> type_safe_arithmetic& =
+ default;
+ auto operator=(type_safe_arithmetic&&) noexcept -> type_safe_arithmetic& =
+ default;
~type_safe_arithmetic() = default;
auto operator=(value_t value) -> type_safe_arithmetic& {
@@ -138,8 +138,8 @@ class type_safe_arithmetic {
// }
template <typename TAG>
-auto operator+=(type_safe_arithmetic<TAG>& lhs, type_safe_arithmetic<TAG> rhs)
- -> type_safe_arithmetic<TAG>& {
+auto operator+=(type_safe_arithmetic<TAG>& lhs,
+ type_safe_arithmetic<TAG> rhs) -> type_safe_arithmetic<TAG>& {
lhs.set(lhs.get() + rhs.get());
return lhs;
}
@@ -189,8 +189,8 @@ auto operator+=(type_safe_arithmetic<TAG>& lhs, type_safe_arithmetic<TAG> rhs)
// }
template <typename TAG>
-auto operator++(type_safe_arithmetic<TAG>& a, int)
- -> type_safe_arithmetic<TAG> {
+auto operator++(type_safe_arithmetic<TAG>& a,
+ int) -> type_safe_arithmetic<TAG> {
auto r = a;
a += type_safe_arithmetic<TAG>{1};
return r;