diff --git a/.clang-format b/.clang-format index 32f7f3ab3c..6847e23056 100644 --- a/.clang-format +++ b/.clang-format @@ -3,6 +3,8 @@ BasedOnStyle: Google +Standard: Cpp11 # TODO(strager): c++20 + IncludeBlocks: Merge IncludeCategories: [ # These headers must be included after : diff --git a/src/quick-lint-js/configuration/change-detecting-filesystem.h b/src/quick-lint-js/configuration/change-detecting-filesystem.h index 04a5e09c1e..338bb9054a 100644 --- a/src/quick-lint-js/configuration/change-detecting-filesystem.h +++ b/src/quick-lint-js/configuration/change-detecting-filesystem.h @@ -211,9 +211,9 @@ class Change_Detecting_Filesystem_Win32 : public Configuration_Filesystem { Windows_Handle_File_Ref io_completion_port_; ::ULONG_PTR completion_key_; - Hash_Map > + Hash_Map> watched_directories_; - std::vector > + std::vector> cancelling_watched_directories_; std::vector watch_errors_; }; diff --git a/src/quick-lint-js/io/event-loop-poll.h b/src/quick-lint-js/io/event-loop-poll.h index 18a9e542eb..70069af608 100644 --- a/src/quick-lint-js/io/event-loop-poll.h +++ b/src/quick-lint-js/io/event-loop-poll.h @@ -42,7 +42,7 @@ class Poll_Event_Loop : public Event_Loop_Base { Platform_File_Ref pipe = this->const_derived().get_readable_pipe(); QLJS_SLOW_ASSERT(pipe.is_pipe_non_blocking()); - Fixed_Vector< ::pollfd, 3> pollfds; + Fixed_Vector<::pollfd, 3> pollfds; Fixed_Vector_Size read_pipe_index = pollfds.size(); pollfds.push_back( @@ -73,7 +73,7 @@ class Poll_Event_Loop : public Event_Loop_Base { #endif QLJS_ASSERT(pollfds.size() > 0); - int rc = ::poll(pollfds.data(), narrow_cast< ::nfds_t>(pollfds.size()), + int rc = ::poll(pollfds.data(), narrow_cast<::nfds_t>(pollfds.size()), /*timeout=*/-1); if (rc == -1) { QLJS_UNIMPLEMENTED(); diff --git a/src/quick-lint-js/logging/trace-flusher.h b/src/quick-lint-js/logging/trace-flusher.h index 726ff0b520..208a86f0a3 100644 --- a/src/quick-lint-js/logging/trace-flusher.h +++ b/src/quick-lint-js/logging/trace-flusher.h @@ -161,7 +161,7 @@ class Trace_Flusher { struct Shared_State { std::vector backends; - std::vector > registered_threads; + std::vector> registered_threads; Trace_Flusher_Thread_Index next_thread_index = 1; bool stop_flushing_thread = false; diff --git a/src/quick-lint-js/lsp/lsp-json-rpc-message-parser.cpp b/src/quick-lint-js/lsp/lsp-json-rpc-message-parser.cpp index 4c03975e77..fb8d200e6d 100644 --- a/src/quick-lint-js/lsp/lsp-json-rpc-message-parser.cpp +++ b/src/quick-lint-js/lsp/lsp-json-rpc-message-parser.cpp @@ -31,7 +31,7 @@ JSON_RPC_Message_Handler::~JSON_RPC_Message_Handler() = default; LSP_JSON_RPC_Message_Parser::LSP_JSON_RPC_Message_Parser( JSON_RPC_Message_Handler* handler) : handler_(handler), - json_parser_(std::make_unique< ::simdjson::ondemand::parser>()) {} + json_parser_(std::make_unique<::simdjson::ondemand::parser>()) {} LSP_JSON_RPC_Message_Parser::~LSP_JSON_RPC_Message_Parser() = default; diff --git a/src/quick-lint-js/lsp/lsp-json-rpc-message-parser.h b/src/quick-lint-js/lsp/lsp-json-rpc-message-parser.h index fe5e135c50..0bcedf9ff3 100644 --- a/src/quick-lint-js/lsp/lsp-json-rpc-message-parser.h +++ b/src/quick-lint-js/lsp/lsp-json-rpc-message-parser.h @@ -83,7 +83,7 @@ class LSP_JSON_RPC_Message_Parser void write_invalid_request_error_response(); JSON_RPC_Message_Handler* handler_; - std::unique_ptr< ::simdjson::ondemand::parser> json_parser_; + std::unique_ptr<::simdjson::ondemand::parser> json_parser_; Outgoing_JSON_RPC_Message_Queue error_responses_; friend Message_Parser; diff --git a/src/quick-lint-js/lsp/lsp-server.h b/src/quick-lint-js/lsp/lsp-server.h index 8b1e8551fe..ec59fe73d5 100644 --- a/src/quick-lint-js/lsp/lsp-server.h +++ b/src/quick-lint-js/lsp/lsp-server.h @@ -120,7 +120,7 @@ struct LSP_Documents { }; // Key: URI - Hash_Map > documents; + Hash_Map> documents; }; // A Linting_LSP_Server_Handler listens for JavaScript code changes and notifies diff --git a/src/quick-lint-js/lsp/lsp-workspace-configuration.cpp b/src/quick-lint-js/lsp/lsp-workspace-configuration.cpp index d96093bbf6..ea8ca177e6 100644 --- a/src/quick-lint-js/lsp/lsp-workspace-configuration.cpp +++ b/src/quick-lint-js/lsp/lsp-workspace-configuration.cpp @@ -82,7 +82,7 @@ bool LSP_Workspace_Configuration::process_response( bool LSP_Workspace_Configuration::process_notification( ::simdjson::ondemand::object settings) { - for (simdjson::simdjson_result< ::simdjson::ondemand::field> setting_field : + for (simdjson::simdjson_result<::simdjson::ondemand::field> setting_field : settings) { std::string_view name; if (setting_field.unescaped_key().get(name) != ::simdjson::SUCCESS) { diff --git a/test/quick-lint-js/fake-configuration-filesystem.h b/test/quick-lint-js/fake-configuration-filesystem.h index b4738addbb..3a6f66bbe1 100644 --- a/test/quick-lint-js/fake-configuration-filesystem.h +++ b/test/quick-lint-js/fake-configuration-filesystem.h @@ -45,7 +45,7 @@ class Fake_Configuration_Filesystem : public Configuration_Filesystem { void clear(); private: - Hash_Map > files_; + Hash_Map> files_; }; } diff --git a/test/test-lsp-json-rpc-message-parser.cpp b/test/test-lsp-json-rpc-message-parser.cpp index 69ea90f6d9..e9fc98fd50 100644 --- a/test/test-lsp-json-rpc-message-parser.cpp +++ b/test/test-lsp-json-rpc-message-parser.cpp @@ -49,7 +49,7 @@ struct Test_JSON_RPC_Message_Handler : public JSON_RPC_Message_Handler { }; std::string json_get_string( - ::simdjson::simdjson_result< ::simdjson::ondemand::value>&& value) { + ::simdjson::simdjson_result<::simdjson::ondemand::value>&& value) { std::string_view s = ""; EXPECT_EQ(value.get(s), ::simdjson::error_code::SUCCESS); return std::string(s); @@ -285,7 +285,7 @@ TEST(Test_LSP_JSON_RPC_Message_Parser, single_notification_with_reply) { this->pending_notifications.push_back(reply); } - std::vector< ::boost::json::value> pending_notifications; + std::vector<::boost::json::value> pending_notifications; }; Mock_LSP_Server_Handler handler; Spy_LSP_Endpoint_Remote remote; diff --git a/test/test-lsp-server.cpp b/test/test-lsp-server.cpp index 9e88d2de98..523cca5c23 100644 --- a/test/test-lsp-server.cpp +++ b/test/test-lsp-server.cpp @@ -151,7 +151,7 @@ TEST_F(Test_Linting_LSP_Server, initialize) { this->server->flush_error_responses(*this->client); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> responses = this->client->responses(); + std::vector<::boost::json::object> responses = this->client->responses(); ASSERT_EQ(responses.size(), 1); ::boost::json::object response = responses[0]; EXPECT_EQ(response["id"], 1); @@ -215,7 +215,7 @@ TEST_F(Test_Linting_LSP_Server, initialize_with_different_request_ids) { this->server->flush_error_responses(*this->client); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> responses = this->client->responses(); + std::vector<::boost::json::object> responses = this->client->responses(); ASSERT_EQ(responses.size(), 1); EXPECT_EQ(responses[0]["id"], test.id); } @@ -243,7 +243,7 @@ TEST_F(Test_Linting_LSP_Server, loads_config_after_client_initialization) { this->server->flush_error_responses(*this->client); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> requests = this->client->requests(); + std::vector<::boost::json::object> requests = this->client->requests(); ASSERT_EQ(requests.size(), 1); ::boost::json::object request = requests[0]; EXPECT_EQ(look_up(request, "method"), "workspace/configuration"); @@ -269,7 +269,7 @@ TEST_F(Test_Linting_LSP_Server, stores_config_values_after_config_response) { this->server->flush_error_responses(*this->client); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> requests = this->client->requests(); + std::vector<::boost::json::object> requests = this->client->requests(); ASSERT_EQ(requests.size(), 1); ::boost::json::object config_request = requests[0]; ::boost::json::value config_request_id = look_up(config_request, "id"); @@ -322,7 +322,7 @@ TEST_F(Test_Linting_LSP_Server, config_can_be_set_with_initialize_request) { this->server->flush_error_responses(*this->client); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> responses = this->client->responses(); + std::vector<::boost::json::object> responses = this->client->responses(); ASSERT_EQ(responses.size(), 1); EXPECT_EQ(responses[0]["id"], 100); @@ -485,7 +485,7 @@ TEST_F(Test_Linting_LSP_Server, shutdown) { this->server->flush_error_responses(*this->client); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> responses = this->client->responses(); + std::vector<::boost::json::object> responses = this->client->responses(); ASSERT_EQ(responses.size(), 1); ::boost::json::object response = responses[0]; EXPECT_EQ(response["id"], 10); @@ -593,7 +593,7 @@ TEST_F(Test_Linting_LSP_Server, opening_document_lints) { this->server->flush_error_responses(*this->client); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> notifications = + std::vector<::boost::json::object> notifications = this->client->notifications(); ASSERT_EQ(notifications.size(), 1); ::boost::json::object response = notifications[0]; @@ -1693,7 +1693,7 @@ TEST_F(Test_Linting_LSP_Server, EXPECT_TRUE(after_config_was_loaded); - std::vector< ::boost::json::object> notifications = + std::vector<::boost::json::object> notifications = this->client->notifications(); ASSERT_THAT(notifications, ElementsAreArray({::testing::_})); ::boost::json::object notification = notifications[0]; @@ -1885,7 +1885,7 @@ TEST_F(Test_Linting_LSP_Server, opening_js_file_with_unreadable_config_lints) { EXPECT_THAT(this->lint_calls, ElementsAreArray({u8"testjs"})) << "should have linted despite config file being unloadable"; - std::vector< ::boost::json::object> notifications = + std::vector<::boost::json::object> notifications = this->client->notifications(); ASSERT_EQ(notifications.size(), 2); std::size_t showMessageIndex = @@ -1949,7 +1949,7 @@ TEST_F(Test_Linting_LSP_Server, EXPECT_THAT(this->lint_calls, ElementsAreArray({u8"testjs"})) << "should have linted despite config file being unloadable"; - std::vector< ::boost::json::object> notifications = + std::vector<::boost::json::object> notifications = this->client->notifications(); ASSERT_EQ(notifications.size(), 2); std::size_t showMessageIndex = @@ -2024,7 +2024,7 @@ TEST_F(Test_Linting_LSP_Server, making_config_file_unreadable_relints) { << "should have linted twice: once on open, and once after config file " "changed"; - std::vector< ::boost::json::object> notifications = + std::vector<::boost::json::object> notifications = this->client->notifications(); ASSERT_EQ(notifications.size(), 2); std::size_t showMessageIndex = @@ -2057,7 +2057,7 @@ TEST_F(Test_Linting_LSP_Server, opening_broken_config_file_shows_diagnostics) { this->server->flush_error_responses(*this->client); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> notifications = + std::vector<::boost::json::object> notifications = this->client->notifications(); ASSERT_EQ(notifications.size(), 1); ::boost::json::object response = notifications[0]; @@ -2122,7 +2122,7 @@ TEST_F(Test_Linting_LSP_Server, this->server->flush_error_responses(*this->client); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> notifications = + std::vector<::boost::json::object> notifications = this->client->notifications(); ASSERT_EQ(notifications.size(), 1); ::boost::json::object response = notifications[0]; @@ -2355,7 +2355,7 @@ TEST_F(Test_Linting_LSP_Server, showing_io_errors_shows_only_first) { }); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> notifications = + std::vector<::boost::json::object> notifications = this->client->notifications(); ASSERT_EQ(notifications.size(), 1); ::boost::json::object show_message_message = notifications[0]; @@ -2385,7 +2385,7 @@ TEST_F(Test_Linting_LSP_Server, showing_io_errors_shows_only_first_ever) { }); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> notifications = + std::vector<::boost::json::object> notifications = this->client->notifications(); ASSERT_EQ(notifications.size(), 1); ::boost::json::object show_message_message = notifications[0]; @@ -2437,7 +2437,7 @@ TEST_F(Test_Linting_LSP_Server, unimplemented_method_in_request_returns_error) { this->server->flush_error_responses(*this->client); this->handler->flush_pending_notifications(*this->client); - std::vector< ::boost::json::object> responses = this->client->responses(); + std::vector<::boost::json::object> responses = this->client->responses(); ASSERT_EQ(responses.size(), 1); ::boost::json::object response = responses[0]; EXPECT_EQ(look_up(response, "id"), 10); @@ -2650,7 +2650,7 @@ TEST(Test_LSP_JavaScript_Linter, server.flush_error_responses(client); handler.flush_pending_notifications(client); - std::vector< ::boost::json::object> notifications = client.notifications(); + std::vector<::boost::json::object> notifications = client.notifications(); ASSERT_EQ(notifications.size(), 1); ::boost::json::object notification = notifications[0]; EXPECT_EQ(look_up(notification, "method"), "textDocument/publishDiagnostics"); @@ -2683,7 +2683,7 @@ TEST(Test_LSP_JavaScript_Linter, server.flush_error_responses(client); handler.flush_pending_notifications(client); - std::vector< ::boost::json::object> notifications = client.notifications(); + std::vector<::boost::json::object> notifications = client.notifications(); ASSERT_EQ(notifications.size(), 1); ::boost::json::object notification = notifications[0]; EXPECT_EQ(look_up(notification, "method"), "textDocument/publishDiagnostics"); diff --git a/test/test-pipe-writer.cpp b/test/test-pipe-writer.cpp index 652d76566c..a04657ae94 100644 --- a/test/test-pipe-writer.cpp +++ b/test/test-pipe-writer.cpp @@ -53,7 +53,7 @@ Byte_Buffer byte_buffer_of(String8_View data) { } TEST_F(Test_Pipe_Writer, large_write_sends_fully) { - std::future > data_future = + std::future> data_future = std::async(std::launch::async, [this] { return read_file("", this->pipe.reader.ref()); });