summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-10-08 12:34:05 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-10-08 15:41:50 +0200
commitab9ff1405f9dd27addb6106e6d6e3ea45c730cc4 (patch)
treeb7f2c3787752fb16f73b16e9e3343d2bf5e59d0f /src
parent6f03f36201fa79f3802f3235779ec5a451287e21 (diff)
downloadjustbuild-ab9ff1405f9dd27addb6106e6d6e3ea45c730cc4.tar.gz
Name constexpr variables using kCamelCase.
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/build_engine/base_maps/expression_map.hpp11
-rw-r--r--src/buildtool/build_engine/base_maps/rule_map.hpp11
-rw-r--r--src/buildtool/build_engine/base_maps/targets_file_map.hpp12
-rw-r--r--src/buildtool/build_engine/expression/expression.cpp6
-rw-r--r--src/other_tools/just_mr/setup.cpp4
-rw-r--r--src/utils/cpp/type_safe_arithmetic.hpp14
6 files changed, 33 insertions, 25 deletions
diff --git a/src/buildtool/build_engine/base_maps/expression_map.hpp b/src/buildtool/build_engine/base_maps/expression_map.hpp
index ceb2cf2f..3acec531 100644
--- a/src/buildtool/build_engine/base_maps/expression_map.hpp
+++ b/src/buildtool/build_engine/base_maps/expression_map.hpp
@@ -33,10 +33,13 @@ namespace BuildMaps::Base {
using ExpressionFileMap = AsyncMapConsumer<ModuleName, nlohmann::json>;
-constexpr auto CreateExpressionFileMap =
- CreateJsonFileMap<&RepositoryConfig::ExpressionRoot,
- &RepositoryConfig::ExpressionFileName,
- /*kMandatory=*/true>;
+[[nodiscard]] static inline auto CreateExpressionFileMap(
+ gsl::not_null<const RepositoryConfig*> const& repo_config,
+ std::size_t jobs) -> JsonFileMap {
+ return CreateJsonFileMap<&RepositoryConfig::ExpressionRoot,
+ &RepositoryConfig::ExpressionFileName,
+ /*kMandatory=*/true>(repo_config, jobs);
+}
using ExpressionFunctionMap =
AsyncMapConsumer<EntityName, ExpressionFunctionPtr>;
diff --git a/src/buildtool/build_engine/base_maps/rule_map.hpp b/src/buildtool/build_engine/base_maps/rule_map.hpp
index 867f4c38..d911317c 100644
--- a/src/buildtool/build_engine/base_maps/rule_map.hpp
+++ b/src/buildtool/build_engine/base_maps/rule_map.hpp
@@ -33,10 +33,13 @@ namespace BuildMaps::Base {
using RuleFileMap = AsyncMapConsumer<ModuleName, nlohmann::json>;
-constexpr auto CreateRuleFileMap =
- CreateJsonFileMap<&RepositoryConfig::RuleRoot,
- &RepositoryConfig::RuleFileName,
- /*kMandatory=*/true>;
+[[nodiscard]] static inline auto CreateRuleFileMap(
+ gsl::not_null<const RepositoryConfig*> const& repo_config,
+ std::size_t jobs) -> JsonFileMap {
+ return CreateJsonFileMap<&RepositoryConfig::RuleRoot,
+ &RepositoryConfig::RuleFileName,
+ /*kMandatory=*/true>(repo_config, jobs);
+}
using UserRuleMap = AsyncMapConsumer<EntityName, UserRulePtr>;
diff --git a/src/buildtool/build_engine/base_maps/targets_file_map.hpp b/src/buildtool/build_engine/base_maps/targets_file_map.hpp
index f14ea7f1..8ff5d76c 100644
--- a/src/buildtool/build_engine/base_maps/targets_file_map.hpp
+++ b/src/buildtool/build_engine/base_maps/targets_file_map.hpp
@@ -27,11 +27,13 @@ namespace BuildMaps::Base {
using TargetsFileMap = AsyncMapConsumer<ModuleName, nlohmann::json>;
-constexpr auto CreateTargetsFileMap =
- CreateJsonFileMap<&RepositoryConfig::TargetRoot,
- &RepositoryConfig::TargetFileName,
- /*kMandatory=*/true>;
-
+[[nodiscard]] static inline auto CreateTargetsFileMap(
+ gsl::not_null<const RepositoryConfig*> const& repo_config,
+ std::size_t jobs) -> JsonFileMap {
+ return CreateJsonFileMap<&RepositoryConfig::TargetRoot,
+ &RepositoryConfig::TargetFileName,
+ /*kMandatory=*/true>(repo_config, jobs);
+}
} // namespace BuildMaps::Base
#endif // INCLUDED_SRC_BUILDTOOL_BUILD_ENGINE_BASE_MAPS_TARGETS_FILE_MAP_HPP
diff --git a/src/buildtool/build_engine/expression/expression.cpp b/src/buildtool/build_engine/expression/expression.cpp
index 963f20f9..4dd61a2d 100644
--- a/src/buildtool/build_engine/expression/expression.cpp
+++ b/src/buildtool/build_engine/expression/expression.cpp
@@ -216,11 +216,11 @@ auto Expression::TypeStringForIndex() const noexcept -> std::string {
if (kIndex == data_.index()) {
return TypeToString<std::variant_alternative_t<kIndex, var_t>>();
}
- constexpr auto size = std::variant_size_v<var_t>;
- if constexpr (kIndex < size - 1) {
+ constexpr auto kSize = std::variant_size_v<var_t>;
+ if constexpr (kIndex < kSize - 1) {
return TypeStringForIndex<kIndex + 1>();
}
- return TypeToString<std::variant_alternative_t<size - 1, var_t>>();
+ return TypeToString<std::variant_alternative_t<kSize - 1, var_t>>();
}
auto Expression::TypeString() const noexcept -> std::string {
diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp
index 0c884d86..1629402b 100644
--- a/src/other_tools/just_mr/setup.cpp
+++ b/src/other_tools/just_mr/setup.cpp
@@ -370,7 +370,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
mr_repos[repo] = *values[i];
}
// populate ALT_DIRS
- constexpr auto err_msg_format =
+ constexpr auto kErrMsgFormat =
"While performing {} {}:\nWhile populating fields for "
"repository {}:\nExpected value for key \"{}\" to be a "
"string, but found {}";
@@ -386,7 +386,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
// we expect a string
if (not val->IsString()) {
Logger::Log(LogLevel::Error,
- err_msg_format,
+ kErrMsgFormat,
multi_repo_tool_name,
interactive
? "setup-env"
diff --git a/src/utils/cpp/type_safe_arithmetic.hpp b/src/utils/cpp/type_safe_arithmetic.hpp
index 52efd81c..c647996a 100644
--- a/src/utils/cpp/type_safe_arithmetic.hpp
+++ b/src/utils/cpp/type_safe_arithmetic.hpp
@@ -39,9 +39,9 @@ struct TypeSafeArithmeticTag {
using pointer_t = T*;
using const_pointer_t = T const*;
- static constexpr value_t max_value = MAX_VALUE;
- static constexpr value_t min_value = MIN_VALUE;
- static constexpr value_t smallest_value = SMALLEST_VALUE;
+ static constexpr value_t kMaxValue = MAX_VALUE;
+ static constexpr value_t kMinValue = MIN_VALUE;
+ static constexpr value_t kSmallestValue = SMALLEST_VALUE;
};
/// \class TypeSafeArithmetic
@@ -59,9 +59,9 @@ class TypeSafeArithmetic {
using pointer_t = typename tag_t::pointer_t;
using const_pointer_t = typename tag_t::const_pointer_t;
- static constexpr value_t max_value = tag_t::max_value;
- static constexpr value_t min_value = tag_t::min_value;
- static constexpr value_t smallest_value = tag_t::smallest_value;
+ static constexpr value_t kMaxValue = tag_t::kMaxValue;
+ static constexpr value_t kMinValue = tag_t::kMinValue;
+ static constexpr value_t kSmallestValue = tag_t::kSmallestValue;
constexpr TypeSafeArithmetic() = default;
@@ -86,7 +86,7 @@ class TypeSafeArithmetic {
constexpr auto get() const -> value_t { return m_value; }
constexpr void set(value_t value) {
- Expects(value >= min_value and value <= max_value and
+ Expects(value >= kMinValue and value <= kMaxValue and
"value output of range");
m_value = value;
}