tools/remote-compile: clang-format

This was using the old tint code style

Change-Id: I1aff541eb4cc0d7ec0e045b555710aa605c4da28
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105141
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2022-10-10 12:17:03 +00:00 committed by Dawn LUCI CQ
parent c8f1075310
commit 467e6e3fc6
6 changed files with 657 additions and 670 deletions

View File

@ -225,8 +225,7 @@ struct CompileRequest : Message { // Client -> Server
/// Writes the message `m` to the stream `s` /// Writes the message `m` to the stream `s`
template <typename MESSAGE> template <typename MESSAGE>
std::enable_if_t<std::is_base_of<Message, MESSAGE>::value, Stream>& operator<<( std::enable_if_t<std::is_base_of<Message, MESSAGE>::value, Stream>& operator<<(Stream& s,
Stream& s,
const MESSAGE& m) { const MESSAGE& m) {
s << m.type; s << m.type;
const_cast<MESSAGE&>(m).Serialize([&s](const auto& value) { s << value; }); const_cast<MESSAGE&>(m).Serialize([&s](const auto& value) { s << value; });
@ -235,8 +234,7 @@ std::enable_if_t<std::is_base_of<Message, MESSAGE>::value, Stream>& operator<<(
/// Reads the message `m` from the stream `s` /// Reads the message `m` from the stream `s`
template <typename MESSAGE> template <typename MESSAGE>
std::enable_if_t<std::is_base_of<Message, MESSAGE>::value, Stream>& operator>>( std::enable_if_t<std::is_base_of<Message, MESSAGE>::value, Stream>& operator>>(Stream& s,
Stream& s,
MESSAGE& m) { MESSAGE& m) {
Message::Type ty; Message::Type ty;
s >> ty; s >> ty;
@ -406,8 +404,7 @@ bool RunClient(std::string address, std::string port, std::string file) {
printf("Couldn't open '%s'\n", file.c_str()); printf("Couldn't open '%s'\n", file.c_str());
return false; return false;
} }
std::string source((std::istreambuf_iterator<char>(input)), std::string source((std::istreambuf_iterator<char>(input)), std::istreambuf_iterator<char>());
std::istreambuf_iterator<char>());
constexpr const int timeout_ms = 10000; constexpr const int timeout_ms = 10000;
DEBUG("Connecting to %s:%s...", address.c_str(), port.c_str()); DEBUG("Connecting to %s:%s...", address.c_str(), port.c_str());

View File

@ -35,8 +35,7 @@ CompileResult CompileMslUsingMetalAPI(const std::string& src) {
return result; return result;
} }
NSString* source = [NSString stringWithCString:src.c_str() NSString* source = [NSString stringWithCString:src.c_str() encoding:NSUTF8StringEncoding];
encoding:NSUTF8StringEncoding];
MTLCompileOptions* compileOptions = [MTLCompileOptions new]; MTLCompileOptions* compileOptions = [MTLCompileOptions new];
compileOptions.languageVersion = MTLLanguageVersion1_2; compileOptions.languageVersion = MTLLanguageVersion1_2;

View File

@ -99,14 +99,12 @@ class Impl : public Socket {
auto err = getaddrinfo(address, port, &hints, &info); auto err = getaddrinfo(address, port, &hints, &info);
#if !defined(_WIN32) #if !defined(_WIN32)
if (err) { if (err) {
printf("getaddrinfo(%s, %s) error: %s\n", address, port, printf("getaddrinfo(%s, %s) error: %s\n", address, port, gai_strerror(err));
gai_strerror(err));
} }
#endif #endif
if (info) { if (info) {
auto socket = auto socket = ::socket(info->ai_family, info->ai_socktype, info->ai_protocol);
::socket(info->ai_family, info->ai_socktype, info->ai_protocol);
auto out = std::make_shared<Impl>(info, socket); auto out = std::make_shared<Impl>(info, socket);
out->setOptions(); out->setOptions();
return out; return out;
@ -143,20 +141,17 @@ class Impl : public Socket {
#if !defined(_WIN32) #if !defined(_WIN32)
// Prevent sockets lingering after process termination, causing // Prevent sockets lingering after process termination, causing
// reconnection issues on the same port. // reconnection issues on the same port.
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char*>(&enable), setsockopt(s, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char*>(&enable), sizeof(enable));
sizeof(enable));
struct { struct {
int l_onoff; /* linger active */ int l_onoff; /* linger active */
int l_linger; /* how many seconds to linger for */ int l_linger; /* how many seconds to linger for */
} linger = {false, 0}; } linger = {false, 0};
setsockopt(s, SOL_SOCKET, SO_LINGER, reinterpret_cast<char*>(&linger), setsockopt(s, SOL_SOCKET, SO_LINGER, reinterpret_cast<char*>(&linger), sizeof(linger));
sizeof(linger));
#endif // !defined(_WIN32) #endif // !defined(_WIN32)
// Enable TCP_NODELAY. // Enable TCP_NODELAY.
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char*>(&enable), setsockopt(s, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char*>(&enable), sizeof(enable));
sizeof(enable));
} }
bool IsOpen() override { bool IsOpen() override {
@ -197,8 +192,7 @@ class Impl : public Socket {
if (s == InvalidSocket) { if (s == InvalidSocket) {
return 0; return 0;
} }
auto len = auto len = recv(s, reinterpret_cast<char*>(buffer), static_cast<int>(bytes), 0);
recv(s, reinterpret_cast<char*>(buffer), static_cast<int>(bytes), 0);
return (len < 0) ? 0 : len; return (len < 0) ? 0 : len;
} }
@ -210,8 +204,7 @@ class Impl : public Socket {
if (bytes == 0) { if (bytes == 0) {
return true; return true;
} }
return ::send(s, reinterpret_cast<const char*>(buffer), return ::send(s, reinterpret_cast<const char*>(buffer), static_cast<int>(bytes), 0) > 0;
static_cast<int>(bytes), 0) > 0;
} }
std::shared_ptr<Socket> Accept() override { std::shared_ptr<Socket> Accept() override {
@ -268,8 +261,7 @@ std::shared_ptr<Socket> Socket::Connect(const char* address,
} }
if (timeoutMillis == 0) { if (timeoutMillis == 0) {
if (::connect(socket, info->ai_addr, if (::connect(socket, info->ai_addr, static_cast<int>(info->ai_addrlen)) == 0) {
static_cast<int>(info->ai_addrlen)) == 0) {
out = impl; out = impl;
} }
return; return;
@ -279,8 +271,7 @@ std::shared_ptr<Socket> Socket::Connect(const char* address,
return; return;
} }
auto res = auto res = ::connect(socket, info->ai_addr, static_cast<int>(info->ai_addrlen));
::connect(socket, info->ai_addr, static_cast<int>(info->ai_addrlen));
if (res == 0) { if (res == 0) {
if (setBlocking(socket, true)) { if (setBlocking(socket, true)) {
out = impl; out = impl;