summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy5
-rw-r--r--src/buildtool/common/repository_config.hpp2
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_action.cpp3
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp4
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp6
-rw-r--r--src/buildtool/file_system/git_repo.cpp4
-rw-r--r--src/other_tools/utils/parse_git_tree.cpp13
-rw-r--r--src/utils/automata/dfa_minimizer.hpp2
-rw-r--r--test/buildtool/build_engine/expression/expression.test.cpp6
9 files changed, 26 insertions, 19 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 4c945a05..a8040be0 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -35,6 +35,9 @@
# readability-identifier-length: We would like to enable this check, but it
# would require significant refactoring effort.
+# readability-redundant-member-init: Those are not redundant for structs, but
+# clang-tidy keeps reporting this as an error.
+
FormatStyle: Google
Checks: >-
*,-abseil-*,-altera-*,-android-*,-boost-*,-cert-*,-darwin-*,-fuchsia-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-zircon-*,
@@ -46,7 +49,7 @@ Checks: >-
-misc-const-correctness,-misc-include-cleaner,-misc-use-anonymous-namespace,-misc-no-recursion,
-modernize-return-braced-init-list,
-performance-avoid-endl,
- -readability-function-cognitive-complexity,-readability-identifier-length
+ -readability-function-cognitive-complexity,-readability-identifier-length,-readability-redundant-member-init
WarningsAsErrors: '*'
CheckOptions:
- { key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic, value: '1' }
diff --git a/src/buildtool/common/repository_config.hpp b/src/buildtool/common/repository_config.hpp
index 218cd14d..1d4a7ce6 100644
--- a/src/buildtool/common/repository_config.hpp
+++ b/src/buildtool/common/repository_config.hpp
@@ -43,7 +43,7 @@ class RepositoryConfig {
FileRoot target_root{workspace_root};
FileRoot rule_root{target_root};
FileRoot expression_root{rule_root};
- std::map<std::string, std::string> name_mapping;
+ std::map<std::string, std::string> name_mapping{};
std::string target_file_name{"TARGETS"};
std::string rule_file_name{"RULES"};
std::string expression_file_name{"EXPRESSIONS"};
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp
index 62df5b6a..17ad10a2 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp
@@ -101,7 +101,8 @@ auto BazelAction::Execute(Logger const* logger) noexcept
logger,
action->hash(),
network_,
- BazelExecutionClient::ExecutionOutput{*result, true});
+ BazelExecutionClient::ExecutionOutput{
+ .action_result = *result, .cached_result = true});
}
}
}
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp
index 69e575e5..eca24d9c 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp
@@ -189,9 +189,9 @@ class BazelCasClient {
template <typename TContent>
struct RetryProcessBatchResponse {
bool ok{false};
- std::vector<TContent> result;
+ std::vector<TContent> result{};
bool exit_retry_loop{false};
- std::optional<std::string> error_msg;
+ std::optional<std::string> error_msg{};
};
// If this function is defined in the .cpp file, clang raises an error
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp
index 889ca7a3..872ab110 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp
@@ -41,9 +41,9 @@ class BazelExecutionClient {
struct ExecutionOutput {
bazel_re::ActionResult action_result;
bool cached_result{};
- grpc::Status status;
- std::unordered_map<std::string, bazel_re::Digest> server_logs;
- std::string message;
+ grpc::Status status{};
+ std::unordered_map<std::string, bazel_re::Digest> server_logs{};
+ std::string message{};
};
struct ExecutionResponse {
diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp
index fd49775d..12613007 100644
--- a/src/buildtool/file_system/git_repo.cpp
+++ b/src/buildtool/file_system/git_repo.cpp
@@ -197,8 +197,8 @@ std::unordered_set<git_filemode_t> const kNonSpecialGitFileModes{
struct InMemoryODBBackend {
git_odb_backend parent;
- GitRepo::tree_entries_t const* entries{nullptr}; // object headers
- std::unordered_map<std::string, std::string> trees; // solid tree objects
+ GitRepo::tree_entries_t const* entries{nullptr}; // object headers
+ std::unordered_map<std::string, std::string> trees{}; // solid tree objects
};
[[nodiscard]] auto backend_read_header(size_t* len_p,
diff --git a/src/other_tools/utils/parse_git_tree.cpp b/src/other_tools/utils/parse_git_tree.cpp
index c14f4c55..c8cd23e7 100644
--- a/src/other_tools/utils/parse_git_tree.cpp
+++ b/src/other_tools/utils/parse_git_tree.cpp
@@ -106,12 +106,11 @@
}
}
// populate struct
- auto info = GitTreeInfo{.tree_hash = *std::move(repo_desc_hash_info),
- .env_vars = std::move(env),
- .inherit_env = std::move(inherit_env),
- .command = std::move(cmd)};
- if (origin) {
- info.origin = *std::move(origin);
- }
+ auto info =
+ GitTreeInfo{.tree_hash = *std::move(repo_desc_hash_info),
+ .env_vars = std::move(env),
+ .inherit_env = std::move(inherit_env),
+ .command = std::move(cmd),
+ .origin = origin ? std::move(*origin) : std::string{}};
return info;
}
diff --git a/src/utils/automata/dfa_minimizer.hpp b/src/utils/automata/dfa_minimizer.hpp
index af0da1c9..c4201c97 100644
--- a/src/utils/automata/dfa_minimizer.hpp
+++ b/src/utils/automata/dfa_minimizer.hpp
@@ -48,7 +48,7 @@ class DFAMinimizer {
// Bucket of states with equal local properties (content and acceptance)
struct Bucket {
std::vector<std::string> symbols;
- states_t states;
+ states_t states{};
};
// Key used for state pairs. Reordering names will result in the same key.
diff --git a/test/buildtool/build_engine/expression/expression.test.cpp b/test/buildtool/build_engine/expression/expression.test.cpp
index 7276f0a4..02de11fa 100644
--- a/test/buildtool/build_engine/expression/expression.test.cpp
+++ b/test/buildtool/build_engine/expression/expression.test.cpp
@@ -1874,7 +1874,11 @@ TEST_CASE("Expression hash computation", "[expression]") {
CHECK_FALSE(result->ToHash().empty());
CHECK(result->ToHash() == Expression{result_t{}}.ToHash());
- CHECK_FALSE(result->ToHash() == Expression{result_t{boolean}}.ToHash());
+ CHECK_FALSE(
+ result->ToHash() ==
+ Expression{
+ result_t{.artifact_stage = boolean, .provides = {}, .runfiles = {}}}
+ .ToHash());
CHECK_FALSE(list->ToHash().empty());
CHECK(list->ToHash() == Expression{list_t{}}.ToHash());