From 198417097fbf0338d54e9917db9a2720c0b139c9 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Thu, 20 Jan 2022 20:40:18 +0000 Subject: [PATCH] Clang format the entire tint codebase Change-Id: I8e6ae93d0d4449e38cd32672e714ef07e1075d75 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77441 Auto-Submit: Ben Clayton Reviewed-by: James Price Kokoro: Kokoro Commit-Queue: Ben Clayton --- src/reader/spirv/parser_impl.cc | 2 +- src/reader/wgsl/parser_impl_error_msg_test.cc | 55 ++++++++----------- ...parser_impl_struct_decoration_decl_test.cc | 6 +- ...impl_struct_member_decoration_decl_test.cc | 12 +++- src/sem/intrinsic_type.h | 2 +- src/transform/decompose_memory_access.cc | 2 +- src/utils/unique_vector.h | 2 +- 7 files changed, 37 insertions(+), 44 deletions(-) diff --git a/src/reader/spirv/parser_impl.cc b/src/reader/spirv/parser_impl.cc index 287b0a8e2a..226fa2573e 100644 --- a/src/reader/spirv/parser_impl.cc +++ b/src/reader/spirv/parser_impl.cc @@ -610,7 +610,7 @@ Source ParserImpl::GetSourceForInst( if (where == inst_source_.end()) { return {}; } - return Source{where->second}; + return Source{where->second }; } bool ParserImpl::ParseInternalModuleExceptFunctions() { diff --git a/src/reader/wgsl/parser_impl_error_msg_test.cc b/src/reader/wgsl/parser_impl_error_msg_test.cc index 417c1ebc5c..dfb5c57de5 100644 --- a/src/reader/wgsl/parser_impl_error_msg_test.cc +++ b/src/reader/wgsl/parser_impl_error_msg_test.cc @@ -54,9 +54,8 @@ fn f() { return 1 & >; } } TEST_F(ParserImplErrorTest, AliasDeclInvalidDeco) { - EXPECT( - "@override type e=u32;", - R"(test.wgsl:1:2 error: unexpected decorations + EXPECT("@override type e=u32;", + R"(test.wgsl:1:2 error: unexpected decorations @override type e=u32; ^^^^^^^^ )"); @@ -324,18 +323,16 @@ fn f() { for (var i : i32 = 0; i < 8; i=i+1) { } TEST_F(ParserImplErrorTest, FunctionDeclDecoStageMissingLParen) { - EXPECT( - "@stage vertex) fn f() {}", - R"(test.wgsl:1:8 error: expected '(' for stage decoration + EXPECT("@stage vertex) fn f() {}", + R"(test.wgsl:1:8 error: expected '(' for stage decoration @stage vertex) fn f() {} ^^^^^^ )"); } TEST_F(ParserImplErrorTest, FunctionDeclDecoStageMissingRParen) { - EXPECT( - "@stage(vertex fn f() {}", - R"(test.wgsl:1:15 error: expected ')' for stage decoration + EXPECT("@stage(vertex fn f() {}", + R"(test.wgsl:1:15 error: expected ')' for stage decoration @stage(vertex fn f() {} ^^ )"); @@ -1135,18 +1132,16 @@ test.wgsl:1:15 error: expected ']]' for decoration list } TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationMissingLParen) { - EXPECT( - "@location 1) var i : i32;", - R"(test.wgsl:1:11 error: expected '(' for location decoration + EXPECT("@location 1) var i : i32;", + R"(test.wgsl:1:11 error: expected '(' for location decoration @location 1) var i : i32; ^ )"); } TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationMissingRParen) { - EXPECT( - "@location (1 var i : i32;", - R"(test.wgsl:1:14 error: expected ')' for location decoration + EXPECT("@location (1 var i : i32;", + R"(test.wgsl:1:14 error: expected ')' for location decoration @location (1 var i : i32; ^^^ )"); @@ -1190,18 +1185,16 @@ TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationInvalidValue) { } TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinMissingLParen) { - EXPECT( - "@builtin position) var i : i32;", - R"(test.wgsl:1:10 error: expected '(' for builtin decoration + EXPECT("@builtin position) var i : i32;", + R"(test.wgsl:1:10 error: expected '(' for builtin decoration @builtin position) var i : i32; ^^^^^^^^ )"); } TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinMissingRParen) { - EXPECT( - "@builtin(position var i : i32;", - R"(test.wgsl:1:19 error: expected ')' for builtin decoration + EXPECT("@builtin(position var i : i32;", + R"(test.wgsl:1:19 error: expected ')' for builtin decoration @builtin(position var i : i32; ^^^ )"); @@ -1252,18 +1245,16 @@ TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinInvalidValue) { } TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingMissingLParen) { - EXPECT( - "@binding 1) var i : i32;", - R"(test.wgsl:1:10 error: expected '(' for binding decoration + EXPECT("@binding 1) var i : i32;", + R"(test.wgsl:1:10 error: expected '(' for binding decoration @binding 1) var i : i32; ^ )"); } TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingMissingRParen) { - EXPECT( - "@binding(1 var i : i32;", - R"(test.wgsl:1:12 error: expected ')' for binding decoration + EXPECT("@binding(1 var i : i32;", + R"(test.wgsl:1:12 error: expected ')' for binding decoration @binding(1 var i : i32; ^^^ )"); @@ -1307,18 +1298,16 @@ TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingInvalidValue) { } TEST_F(ParserImplErrorTest, GlobalDeclVarDecoGroupMissingLParen) { - EXPECT( - "@group 1) var i : i32;", - R"(test.wgsl:1:8 error: expected '(' for group decoration + EXPECT("@group 1) var i : i32;", + R"(test.wgsl:1:8 error: expected '(' for group decoration @group 1) var i : i32; ^ )"); } TEST_F(ParserImplErrorTest, GlobalDeclVarDecoGroupMissingRParen) { - EXPECT( - "@group(1 var i : i32;", - R"(test.wgsl:1:10 error: expected ')' for group decoration + EXPECT("@group(1 var i : i32;", + R"(test.wgsl:1:10 error: expected ')' for group decoration @group(1 var i : i32; ^^^ )"); diff --git a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc index b4acaed2ae..be9866e9e7 100644 --- a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc @@ -38,8 +38,7 @@ TEST_F(ParserImplTest, DecorationDecl_MissingParenLeft) { EXPECT_TRUE(decos.errored); EXPECT_FALSE(decos.matched); EXPECT_TRUE(decos.value.empty()); - EXPECT_EQ(p->error(), - "1:11: expected '(' for location decoration"); + EXPECT_EQ(p->error(), "1:11: expected '(' for location decoration"); } TEST_F(ParserImplTest, DecorationDecl_MissingValue) { @@ -60,8 +59,7 @@ TEST_F(ParserImplTest, DecorationDecl_MissingParenRight) { EXPECT_TRUE(decos.errored); EXPECT_FALSE(decos.matched); EXPECT_TRUE(decos.value.empty()); - EXPECT_EQ(p->error(), - "1:12: expected ')' for location decoration"); + EXPECT_EQ(p->error(), "1:12: expected ')' for location decoration"); } TEST_F(ParserImplTest, DecorationDecl_InvalidDecoration) { diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc index a7c1383555..cc4f4650d5 100644 --- a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc @@ -36,7 +36,9 @@ TEST_F(ParserImplTest, DEPRECATED_DecorationDecl_EmptyBlock) { EXPECT_TRUE(decos.errored); EXPECT_FALSE(decos.matched); EXPECT_EQ(decos.value.size(), 0u); - EXPECT_EQ(p->error(), R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style + EXPECT_EQ( + p->error(), + R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style 1:3: empty decoration list)"); } @@ -68,7 +70,9 @@ TEST_F(ParserImplTest, DecorationDecl_MissingClose) { EXPECT_TRUE(p->has_error()) << p->error(); EXPECT_TRUE(decos.errored); EXPECT_FALSE(decos.matched); - EXPECT_EQ(p->error(), R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style + EXPECT_EQ( + p->error(), + R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style 1:10: expected ']]' for decoration list)"); } @@ -78,7 +82,9 @@ TEST_F(ParserImplTest, StructMemberDecorationDecl_SizeMissingClose) { EXPECT_TRUE(p->has_error()) << p->error(); EXPECT_TRUE(decos.errored); EXPECT_FALSE(decos.matched); - EXPECT_EQ(p->error(), R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style + EXPECT_EQ( + p->error(), + R"(1:1: use of deprecated language feature: [[decoration]] style decorations have been replaced with @decoration style 1:10: expected ']]' for decoration list)"); } diff --git a/src/sem/intrinsic_type.h b/src/sem/intrinsic_type.h index c976f90f16..873a9eff72 100644 --- a/src/sem/intrinsic_type.h +++ b/src/sem/intrinsic_type.h @@ -25,8 +25,8 @@ #ifndef SRC_SEM_INTRINSIC_TYPE_H_ #define SRC_SEM_INTRINSIC_TYPE_H_ -#include #include +#include namespace tint { namespace sem { diff --git a/src/transform/decompose_memory_access.cc b/src/transform/decompose_memory_access.cc index 1281ccb521..af20c6d1fb 100644 --- a/src/transform/decompose_memory_access.cc +++ b/src/transform/decompose_memory_access.cc @@ -35,8 +35,8 @@ #include "src/sem/statement.h" #include "src/sem/struct.h" #include "src/sem/variable.h" -#include "src/utils/map.h" #include "src/utils/hash.h" +#include "src/utils/map.h" TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeMemoryAccess); TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeMemoryAccess::Intrinsic); diff --git a/src/utils/unique_vector.h b/src/utils/unique_vector.h index 1c3fc4d15f..ea29109aea 100644 --- a/src/utils/unique_vector.h +++ b/src/utils/unique_vector.h @@ -91,7 +91,7 @@ struct UniqueVector { ConstReverseIterator rend() const { return vector.rend(); } /// @returns a const reference to the internal vector - operator const std::vector &() const { return vector; } + operator const std::vector&() const { return vector; } /// Removes the last element from the vector /// @returns the popped element