Run clang-format on the entire repo
This patch clang-formats the entire repo. Third-party code is
excluded.
I needed to fix up the .clang-format file so that all the header
includes are ordered properly. I could have sworn that it used to work
without the extra modification, but I guess not.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I64bb9f2c795401393f9dfe2fefc4f04cb36b52f6
diff --git a/aos/util/config_validator_lib.h b/aos/util/config_validator_lib.h
index 61658e5..30a956a 100644
--- a/aos/util/config_validator_lib.h
+++ b/aos/util/config_validator_lib.h
@@ -1,9 +1,10 @@
#ifndef AOS_UTIL_CONFIG_VALIDATOR_H_
#define AOS_UTIL_CONFIG_VALIDATOR_H_
+#include "gtest/gtest.h"
+
#include "aos/configuration.h"
#include "aos/util/config_validator_config_generated.h"
-#include "gtest/gtest.h"
namespace aos::util {
void ConfigIsValid(const aos::Configuration *config,
diff --git a/aos/util/config_validator_lib_test.cc b/aos/util/config_validator_lib_test.cc
index c68695c..ee80ac4 100644
--- a/aos/util/config_validator_lib_test.cc
+++ b/aos/util/config_validator_lib_test.cc
@@ -1,8 +1,9 @@
#include "aos/util/config_validator_lib.h"
+#include "gtest/gtest-spi.h"
+
#include "aos/json_to_flatbuffer.h"
#include "aos/testing/path.h"
-#include "gtest/gtest-spi.h"
using aos::testing::ArtifactPath;
namespace aos::util::testing {
diff --git a/aos/util/error_counter_test.cc b/aos/util/error_counter_test.cc
index 567d71d..0a786bf 100644
--- a/aos/util/error_counter_test.cc
+++ b/aos/util/error_counter_test.cc
@@ -1,8 +1,9 @@
#include "aos/util/error_counter.h"
+#include "gtest/gtest.h"
+
#include "aos/events/event_loop_generated.h"
#include "aos/flatbuffers.h"
-#include "gtest/gtest.h"
namespace aos::util::testing {
// Exercises the basic API for the ErrorCounter class, ensuring that everything
diff --git a/aos/util/file.h b/aos/util/file.h
index ddd5d47..3b2231a 100644
--- a/aos/util/file.h
+++ b/aos/util/file.h
@@ -12,10 +12,11 @@
#include "absl/strings/numbers.h"
#include "absl/types/span.h"
-#include "aos/scoped/scoped_fd.h"
#include "flatbuffers/util.h"
#include "glog/logging.h"
+#include "aos/scoped/scoped_fd.h"
+
namespace aos {
namespace util {
diff --git a/aos/util/file_test.cc b/aos/util/file_test.cc
index ba03ea5..712447e 100644
--- a/aos/util/file_test.cc
+++ b/aos/util/file_test.cc
@@ -3,9 +3,10 @@
#include <cstdlib>
#include <string>
+#include "gtest/gtest.h"
+
#include "aos/realtime.h"
#include "aos/testing/tmpdir.h"
-#include "gtest/gtest.h"
namespace aos {
namespace util {
diff --git a/aos/util/foxglove_websocket.cc b/aos/util/foxglove_websocket.cc
index 77dca20..44e24c8 100644
--- a/aos/util/foxglove_websocket.cc
+++ b/aos/util/foxglove_websocket.cc
@@ -1,7 +1,8 @@
+#include "gflags/gflags.h"
+
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/util/foxglove_websocket_lib.h"
-#include "gflags/gflags.h"
DEFINE_string(config, "aos_config.json", "Path to the config.");
DEFINE_uint32(port, 8765, "Port to use for foxglove websocket server.");
diff --git a/aos/util/foxglove_websocket_lib.cc b/aos/util/foxglove_websocket_lib.cc
index 06c551e..ab99400 100644
--- a/aos/util/foxglove_websocket_lib.cc
+++ b/aos/util/foxglove_websocket_lib.cc
@@ -1,9 +1,10 @@
#include "aos/util/foxglove_websocket_lib.h"
#include "absl/strings/escaping.h"
+#include "gflags/gflags.h"
+
#include "aos/flatbuffer_merge.h"
#include "aos/util/mcap_logger.h"
-#include "gflags/gflags.h"
DEFINE_uint32(sorting_buffer_ms, 100,
"Amount of time to buffer messages to sort them before sending "
diff --git a/aos/util/foxglove_websocket_lib.h b/aos/util/foxglove_websocket_lib.h
index 7c326c2..2590e27 100644
--- a/aos/util/foxglove_websocket_lib.h
+++ b/aos/util/foxglove_websocket_lib.h
@@ -3,9 +3,10 @@
#include <map>
#include <set>
-#include "aos/events/event_loop.h"
#include "foxglove/websocket/server.hpp"
+#include "aos/events/event_loop.h"
+
namespace aos {
// This class implements a live AOS -> Foxglove Websocket Protocol connection,
// making use of the implementation at
diff --git a/aos/util/generate_test_log.cc b/aos/util/generate_test_log.cc
index 12cc260..dda7912 100644
--- a/aos/util/generate_test_log.cc
+++ b/aos/util/generate_test_log.cc
@@ -1,3 +1,5 @@
+#include "gflags/gflags.h"
+
#include "aos/configuration.h"
#include "aos/events/logging/log_writer.h"
#include "aos/events/ping_lib.h"
@@ -5,7 +7,6 @@
#include "aos/init.h"
#include "aos/json_to_flatbuffer.h"
#include "aos/testing/path.h"
-#include "gflags/gflags.h"
DEFINE_string(output_folder, "",
"Name of folder to write the generated logfile to.");
diff --git a/aos/util/mcap_logger.cc b/aos/util/mcap_logger.cc
index 111d784..4fb727c 100644
--- a/aos/util/mcap_logger.cc
+++ b/aos/util/mcap_logger.cc
@@ -1,12 +1,13 @@
#include "aos/util/mcap_logger.h"
#include "absl/strings/str_replace.h"
-#include "aos/configuration_schema.h"
-#include "aos/flatbuffer_merge.h"
#include "lz4/lz4.h"
#include "lz4/lz4frame.h"
#include "single_include/nlohmann/json.hpp"
+#include "aos/configuration_schema.h"
+#include "aos/flatbuffer_merge.h"
+
DEFINE_uint64(mcap_chunk_size, 10'000'000,
"Size, in bytes, of individual MCAP chunks");
DEFINE_bool(fetch, false,
diff --git a/aos/util/mcap_logger.h b/aos/util/mcap_logger.h
index 50e9300..8032c763 100644
--- a/aos/util/mcap_logger.h
+++ b/aos/util/mcap_logger.h
@@ -1,11 +1,12 @@
#ifndef AOS_UTIL_MCAP_LOGGER_H_
#define AOS_UTIL_MCAP_LOGGER_H_
+#include "single_include/nlohmann/json.hpp"
+
#include "aos/configuration_generated.h"
#include "aos/events/event_loop.h"
#include "aos/fast_string_builder.h"
#include "aos/flatbuffer_utils.h"
-#include "single_include/nlohmann/json.hpp"
namespace aos {
diff --git a/aos/util/phased_loop_test.cc b/aos/util/phased_loop_test.cc
index de4483c..cfe0107 100644
--- a/aos/util/phased_loop_test.cc
+++ b/aos/util/phased_loop_test.cc
@@ -1,9 +1,10 @@
#include "aos/util/phased_loop.h"
-#include "aos/time/time.h"
#include "glog/logging.h"
#include "gtest/gtest.h"
+#include "aos/time/time.h"
+
namespace aos {
namespace time {
namespace testing {
diff --git a/aos/util/simulation_logger.cc b/aos/util/simulation_logger.cc
index 1f55ece..24691ef 100644
--- a/aos/util/simulation_logger.cc
+++ b/aos/util/simulation_logger.cc
@@ -1,4 +1,5 @@
#include "aos/util/simulation_logger.h"
+
#include "aos/events/logging/logfile_utils.h"
namespace aos::util {
@@ -30,7 +31,8 @@
std::vector<std::unique_ptr<LoggerState>> MakeLoggersForAllNodes(
aos::SimulatedEventLoopFactory *factory, std::string_view output_folder) {
std::vector<std::unique_ptr<LoggerState>> loggers;
- for (const aos::Node *node : configuration::GetNodes(factory->configuration())) {
+ for (const aos::Node *node :
+ configuration::GetNodes(factory->configuration())) {
loggers.emplace_back(
std::make_unique<LoggerState>(factory, node, output_folder));
}
diff --git a/aos/util/threaded_queue.h b/aos/util/threaded_queue.h
index 0b06632..943609e 100644
--- a/aos/util/threaded_queue.h
+++ b/aos/util/threaded_queue.h
@@ -38,9 +38,8 @@
// get called after setting done to true.
bool done = false;
};
- ThreadedQueue(
- std::function<PushResult(SharedState)> push_request_handler,
- SharedState initial_state);
+ ThreadedQueue(std::function<PushResult(SharedState)> push_request_handler,
+ SharedState initial_state);
~ThreadedQueue();
// Sets state. Triggers a new call to push_request_handler.
void SetState(const SharedState &state);
diff --git a/aos/util/threaded_queue_test.cc b/aos/util/threaded_queue_test.cc
index 4f27c57..c97792c 100644
--- a/aos/util/threaded_queue_test.cc
+++ b/aos/util/threaded_queue_test.cc
@@ -86,7 +86,6 @@
ASSERT_EQ(state, 0);
}
-
// Tests that we can exit early without any issues.
TEST(ThreadedQueueTest, ExitEarly) {
// There used to exist a deadlock in this case where StopPushing would
diff --git a/aos/util/top_test.cc b/aos/util/top_test.cc
index 3292927..7d413a4 100644
--- a/aos/util/top_test.cc
+++ b/aos/util/top_test.cc
@@ -6,11 +6,12 @@
#include <string>
#include <thread>
+#include "gtest/gtest.h"
+
#include "aos/events/shm_event_loop.h"
#include "aos/json_to_flatbuffer.h"
#include "aos/testing/path.h"
#include "aos/testing/tmpdir.h"
-#include "gtest/gtest.h"
namespace aos::util::testing {
diff --git a/aos/util/trapezoid_profile.h b/aos/util/trapezoid_profile.h
index c5c957b..944c423 100644
--- a/aos/util/trapezoid_profile.h
+++ b/aos/util/trapezoid_profile.h
@@ -2,6 +2,7 @@
#define AOS_UTIL_TRAPEZOID_PROFILE_H_
#include "Eigen/Dense"
+
#include "aos/macros.h"
#include "aos/time/time.h"