Skip to content

Commit 53052e8

Browse files
committed
refactor: fix clang-format formatting of templates
clang-format's auto-detection of the language version is inconsistent, causing different files to be formatted differently. Specify the language version explicitly, fixing formatting in some files.
1 parent aa337b9 commit 53052e8

12 files changed

+33
-31
lines changed

.clang-format

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
BasedOnStyle: Google
55

6+
Standard: Cpp11 # TODO(strager): c++20
7+
68
IncludeBlocks: Merge
79
IncludeCategories: [
810
# These headers must be included after <Windows.h>:

src/quick-lint-js/configuration/change-detecting-filesystem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ class Change_Detecting_Filesystem_Win32 : public Configuration_Filesystem {
211211
Windows_Handle_File_Ref io_completion_port_;
212212
::ULONG_PTR completion_key_;
213213

214-
Hash_Map<Canonical_Path, std::unique_ptr<Watched_Directory> >
214+
Hash_Map<Canonical_Path, std::unique_ptr<Watched_Directory>>
215215
watched_directories_;
216-
std::vector<std::unique_ptr<Watched_Directory> >
216+
std::vector<std::unique_ptr<Watched_Directory>>
217217
cancelling_watched_directories_;
218218
std::vector<Watch_IO_Error> watch_errors_;
219219
};

src/quick-lint-js/io/event-loop-poll.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Poll_Event_Loop : public Event_Loop_Base<Derived> {
4242
Platform_File_Ref pipe = this->const_derived().get_readable_pipe();
4343
QLJS_SLOW_ASSERT(pipe.is_pipe_non_blocking());
4444

45-
Fixed_Vector< ::pollfd, 3> pollfds;
45+
Fixed_Vector<::pollfd, 3> pollfds;
4646

4747
Fixed_Vector_Size read_pipe_index = pollfds.size();
4848
pollfds.push_back(
@@ -73,7 +73,7 @@ class Poll_Event_Loop : public Event_Loop_Base<Derived> {
7373
#endif
7474

7575
QLJS_ASSERT(pollfds.size() > 0);
76-
int rc = ::poll(pollfds.data(), narrow_cast< ::nfds_t>(pollfds.size()),
76+
int rc = ::poll(pollfds.data(), narrow_cast<::nfds_t>(pollfds.size()),
7777
/*timeout=*/-1);
7878
if (rc == -1) {
7979
QLJS_UNIMPLEMENTED();

src/quick-lint-js/logging/trace-flusher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class Trace_Flusher {
161161

162162
struct Shared_State {
163163
std::vector<Trace_Flusher_Backend*> backends;
164-
std::vector<std::unique_ptr<Registered_Thread> > registered_threads;
164+
std::vector<std::unique_ptr<Registered_Thread>> registered_threads;
165165
Trace_Flusher_Thread_Index next_thread_index = 1;
166166
bool stop_flushing_thread = false;
167167

src/quick-lint-js/lsp/lsp-json-rpc-message-parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ JSON_RPC_Message_Handler::~JSON_RPC_Message_Handler() = default;
3131
LSP_JSON_RPC_Message_Parser::LSP_JSON_RPC_Message_Parser(
3232
JSON_RPC_Message_Handler* handler)
3333
: handler_(handler),
34-
json_parser_(std::make_unique< ::simdjson::ondemand::parser>()) {}
34+
json_parser_(std::make_unique<::simdjson::ondemand::parser>()) {}
3535

3636
LSP_JSON_RPC_Message_Parser::~LSP_JSON_RPC_Message_Parser() = default;
3737

src/quick-lint-js/lsp/lsp-json-rpc-message-parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class LSP_JSON_RPC_Message_Parser
8383
void write_invalid_request_error_response();
8484

8585
JSON_RPC_Message_Handler* handler_;
86-
std::unique_ptr< ::simdjson::ondemand::parser> json_parser_;
86+
std::unique_ptr<::simdjson::ondemand::parser> json_parser_;
8787
Outgoing_JSON_RPC_Message_Queue error_responses_;
8888

8989
friend Message_Parser;

src/quick-lint-js/lsp/lsp-server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct LSP_Documents {
120120
};
121121

122122
// Key: URI
123-
Hash_Map<String8, std::unique_ptr<Document_Base> > documents;
123+
Hash_Map<String8, std::unique_ptr<Document_Base>> documents;
124124
};
125125

126126
// A Linting_LSP_Server_Handler listens for JavaScript code changes and notifies

src/quick-lint-js/lsp/lsp-workspace-configuration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ bool LSP_Workspace_Configuration::process_response(
8282

8383
bool LSP_Workspace_Configuration::process_notification(
8484
::simdjson::ondemand::object settings) {
85-
for (simdjson::simdjson_result< ::simdjson::ondemand::field> setting_field :
85+
for (simdjson::simdjson_result<::simdjson::ondemand::field> setting_field :
8686
settings) {
8787
std::string_view name;
8888
if (setting_field.unescaped_key().get(name) != ::simdjson::SUCCESS) {

test/quick-lint-js/fake-configuration-filesystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Fake_Configuration_Filesystem : public Configuration_Filesystem {
4545
void clear();
4646

4747
private:
48-
Hash_Map<Canonical_Path, Heap_Function<Read_File_Result()> > files_;
48+
Hash_Map<Canonical_Path, Heap_Function<Read_File_Result()>> files_;
4949
};
5050
}
5151

test/test-lsp-json-rpc-message-parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct Test_JSON_RPC_Message_Handler : public JSON_RPC_Message_Handler {
4949
};
5050

5151
std::string json_get_string(
52-
::simdjson::simdjson_result< ::simdjson::ondemand::value>&& value) {
52+
::simdjson::simdjson_result<::simdjson::ondemand::value>&& value) {
5353
std::string_view s = "<not found>";
5454
EXPECT_EQ(value.get(s), ::simdjson::error_code::SUCCESS);
5555
return std::string(s);
@@ -285,7 +285,7 @@ TEST(Test_LSP_JSON_RPC_Message_Parser, single_notification_with_reply) {
285285
this->pending_notifications.push_back(reply);
286286
}
287287

288-
std::vector< ::boost::json::value> pending_notifications;
288+
std::vector<::boost::json::value> pending_notifications;
289289
};
290290
Mock_LSP_Server_Handler handler;
291291
Spy_LSP_Endpoint_Remote remote;

test/test-lsp-server.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ TEST_F(Test_Linting_LSP_Server, initialize) {
151151
this->server->flush_error_responses(*this->client);
152152
this->handler->flush_pending_notifications(*this->client);
153153

154-
std::vector< ::boost::json::object> responses = this->client->responses();
154+
std::vector<::boost::json::object> responses = this->client->responses();
155155
ASSERT_EQ(responses.size(), 1);
156156
::boost::json::object response = responses[0];
157157
EXPECT_EQ(response["id"], 1);
@@ -215,7 +215,7 @@ TEST_F(Test_Linting_LSP_Server, initialize_with_different_request_ids) {
215215
this->server->flush_error_responses(*this->client);
216216
this->handler->flush_pending_notifications(*this->client);
217217

218-
std::vector< ::boost::json::object> responses = this->client->responses();
218+
std::vector<::boost::json::object> responses = this->client->responses();
219219
ASSERT_EQ(responses.size(), 1);
220220
EXPECT_EQ(responses[0]["id"], test.id);
221221
}
@@ -243,7 +243,7 @@ TEST_F(Test_Linting_LSP_Server, loads_config_after_client_initialization) {
243243
this->server->flush_error_responses(*this->client);
244244
this->handler->flush_pending_notifications(*this->client);
245245

246-
std::vector< ::boost::json::object> requests = this->client->requests();
246+
std::vector<::boost::json::object> requests = this->client->requests();
247247
ASSERT_EQ(requests.size(), 1);
248248
::boost::json::object request = requests[0];
249249
EXPECT_EQ(look_up(request, "method"), "workspace/configuration");
@@ -269,7 +269,7 @@ TEST_F(Test_Linting_LSP_Server, stores_config_values_after_config_response) {
269269
this->server->flush_error_responses(*this->client);
270270
this->handler->flush_pending_notifications(*this->client);
271271

272-
std::vector< ::boost::json::object> requests = this->client->requests();
272+
std::vector<::boost::json::object> requests = this->client->requests();
273273
ASSERT_EQ(requests.size(), 1);
274274
::boost::json::object config_request = requests[0];
275275
::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) {
322322
this->server->flush_error_responses(*this->client);
323323
this->handler->flush_pending_notifications(*this->client);
324324

325-
std::vector< ::boost::json::object> responses = this->client->responses();
325+
std::vector<::boost::json::object> responses = this->client->responses();
326326
ASSERT_EQ(responses.size(), 1);
327327
EXPECT_EQ(responses[0]["id"], 100);
328328

@@ -485,7 +485,7 @@ TEST_F(Test_Linting_LSP_Server, shutdown) {
485485
this->server->flush_error_responses(*this->client);
486486
this->handler->flush_pending_notifications(*this->client);
487487

488-
std::vector< ::boost::json::object> responses = this->client->responses();
488+
std::vector<::boost::json::object> responses = this->client->responses();
489489
ASSERT_EQ(responses.size(), 1);
490490
::boost::json::object response = responses[0];
491491
EXPECT_EQ(response["id"], 10);
@@ -593,7 +593,7 @@ TEST_F(Test_Linting_LSP_Server, opening_document_lints) {
593593
this->server->flush_error_responses(*this->client);
594594
this->handler->flush_pending_notifications(*this->client);
595595

596-
std::vector< ::boost::json::object> notifications =
596+
std::vector<::boost::json::object> notifications =
597597
this->client->notifications();
598598
ASSERT_EQ(notifications.size(), 1);
599599
::boost::json::object response = notifications[0];
@@ -1693,7 +1693,7 @@ TEST_F(Test_Linting_LSP_Server,
16931693

16941694
EXPECT_TRUE(after_config_was_loaded);
16951695

1696-
std::vector< ::boost::json::object> notifications =
1696+
std::vector<::boost::json::object> notifications =
16971697
this->client->notifications();
16981698
ASSERT_THAT(notifications, ElementsAreArray({::testing::_}));
16991699
::boost::json::object notification = notifications[0];
@@ -1885,7 +1885,7 @@ TEST_F(Test_Linting_LSP_Server, opening_js_file_with_unreadable_config_lints) {
18851885
EXPECT_THAT(this->lint_calls, ElementsAreArray({u8"testjs"}))
18861886
<< "should have linted despite config file being unloadable";
18871887

1888-
std::vector< ::boost::json::object> notifications =
1888+
std::vector<::boost::json::object> notifications =
18891889
this->client->notifications();
18901890
ASSERT_EQ(notifications.size(), 2);
18911891
std::size_t showMessageIndex =
@@ -1949,7 +1949,7 @@ TEST_F(Test_Linting_LSP_Server,
19491949
EXPECT_THAT(this->lint_calls, ElementsAreArray({u8"testjs"}))
19501950
<< "should have linted despite config file being unloadable";
19511951

1952-
std::vector< ::boost::json::object> notifications =
1952+
std::vector<::boost::json::object> notifications =
19531953
this->client->notifications();
19541954
ASSERT_EQ(notifications.size(), 2);
19551955
std::size_t showMessageIndex =
@@ -2024,7 +2024,7 @@ TEST_F(Test_Linting_LSP_Server, making_config_file_unreadable_relints) {
20242024
<< "should have linted twice: once on open, and once after config file "
20252025
"changed";
20262026

2027-
std::vector< ::boost::json::object> notifications =
2027+
std::vector<::boost::json::object> notifications =
20282028
this->client->notifications();
20292029
ASSERT_EQ(notifications.size(), 2);
20302030
std::size_t showMessageIndex =
@@ -2057,7 +2057,7 @@ TEST_F(Test_Linting_LSP_Server, opening_broken_config_file_shows_diagnostics) {
20572057
this->server->flush_error_responses(*this->client);
20582058
this->handler->flush_pending_notifications(*this->client);
20592059

2060-
std::vector< ::boost::json::object> notifications =
2060+
std::vector<::boost::json::object> notifications =
20612061
this->client->notifications();
20622062
ASSERT_EQ(notifications.size(), 1);
20632063
::boost::json::object response = notifications[0];
@@ -2122,7 +2122,7 @@ TEST_F(Test_Linting_LSP_Server,
21222122
this->server->flush_error_responses(*this->client);
21232123
this->handler->flush_pending_notifications(*this->client);
21242124

2125-
std::vector< ::boost::json::object> notifications =
2125+
std::vector<::boost::json::object> notifications =
21262126
this->client->notifications();
21272127
ASSERT_EQ(notifications.size(), 1);
21282128
::boost::json::object response = notifications[0];
@@ -2355,7 +2355,7 @@ TEST_F(Test_Linting_LSP_Server, showing_io_errors_shows_only_first) {
23552355
});
23562356
this->handler->flush_pending_notifications(*this->client);
23572357

2358-
std::vector< ::boost::json::object> notifications =
2358+
std::vector<::boost::json::object> notifications =
23592359
this->client->notifications();
23602360
ASSERT_EQ(notifications.size(), 1);
23612361
::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) {
23852385
});
23862386
this->handler->flush_pending_notifications(*this->client);
23872387

2388-
std::vector< ::boost::json::object> notifications =
2388+
std::vector<::boost::json::object> notifications =
23892389
this->client->notifications();
23902390
ASSERT_EQ(notifications.size(), 1);
23912391
::boost::json::object show_message_message = notifications[0];
@@ -2437,7 +2437,7 @@ TEST_F(Test_Linting_LSP_Server, unimplemented_method_in_request_returns_error) {
24372437
this->server->flush_error_responses(*this->client);
24382438
this->handler->flush_pending_notifications(*this->client);
24392439

2440-
std::vector< ::boost::json::object> responses = this->client->responses();
2440+
std::vector<::boost::json::object> responses = this->client->responses();
24412441
ASSERT_EQ(responses.size(), 1);
24422442
::boost::json::object response = responses[0];
24432443
EXPECT_EQ(look_up(response, "id"), 10);
@@ -2650,7 +2650,7 @@ TEST(Test_LSP_JavaScript_Linter,
26502650
server.flush_error_responses(client);
26512651
handler.flush_pending_notifications(client);
26522652

2653-
std::vector< ::boost::json::object> notifications = client.notifications();
2653+
std::vector<::boost::json::object> notifications = client.notifications();
26542654
ASSERT_EQ(notifications.size(), 1);
26552655
::boost::json::object notification = notifications[0];
26562656
EXPECT_EQ(look_up(notification, "method"), "textDocument/publishDiagnostics");
@@ -2683,7 +2683,7 @@ TEST(Test_LSP_JavaScript_Linter,
26832683
server.flush_error_responses(client);
26842684
handler.flush_pending_notifications(client);
26852685

2686-
std::vector< ::boost::json::object> notifications = client.notifications();
2686+
std::vector<::boost::json::object> notifications = client.notifications();
26872687
ASSERT_EQ(notifications.size(), 1);
26882688
::boost::json::object notification = notifications[0];
26892689
EXPECT_EQ(look_up(notification, "method"), "textDocument/publishDiagnostics");

test/test-pipe-writer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Byte_Buffer byte_buffer_of(String8_View data) {
5353
}
5454

5555
TEST_F(Test_Pipe_Writer, large_write_sends_fully) {
56-
std::future<Result<Padded_String, Read_File_IO_Error> > data_future =
56+
std::future<Result<Padded_String, Read_File_IO_Error>> data_future =
5757
std::async(std::launch::async, [this] {
5858
return read_file("<pipe>", this->pipe.reader.ref());
5959
});

0 commit comments

Comments
 (0)