Clang format the entire tint codebase

Change-Id: I8e6ae93d0d4449e38cd32672e714ef07e1075d75
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77441
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2022-01-20 20:40:18 +00:00 committed by Tint LUCI CQ
parent 01e4b6fc18
commit 198417097f
7 changed files with 37 additions and 44 deletions

View File

@ -610,7 +610,7 @@ Source ParserImpl::GetSourceForInst(
if (where == inst_source_.end()) { if (where == inst_source_.end()) {
return {}; return {};
} }
return Source{where->second}; return Source{where->second };
} }
bool ParserImpl::ParseInternalModuleExceptFunctions() { bool ParserImpl::ParseInternalModuleExceptFunctions() {

View File

@ -54,8 +54,7 @@ fn f() { return 1 & >; }
} }
TEST_F(ParserImplErrorTest, AliasDeclInvalidDeco) { TEST_F(ParserImplErrorTest, AliasDeclInvalidDeco) {
EXPECT( EXPECT("@override type e=u32;",
"@override type e=u32;",
R"(test.wgsl:1:2 error: unexpected decorations R"(test.wgsl:1:2 error: unexpected decorations
@override type e=u32; @override type e=u32;
^^^^^^^^ ^^^^^^^^
@ -324,8 +323,7 @@ fn f() { for (var i : i32 = 0; i < 8; i=i+1) {
} }
TEST_F(ParserImplErrorTest, FunctionDeclDecoStageMissingLParen) { TEST_F(ParserImplErrorTest, FunctionDeclDecoStageMissingLParen) {
EXPECT( EXPECT("@stage vertex) fn f() {}",
"@stage vertex) fn f() {}",
R"(test.wgsl:1:8 error: expected '(' for stage decoration R"(test.wgsl:1:8 error: expected '(' for stage decoration
@stage vertex) fn f() {} @stage vertex) fn f() {}
^^^^^^ ^^^^^^
@ -333,8 +331,7 @@ TEST_F(ParserImplErrorTest, FunctionDeclDecoStageMissingLParen) {
} }
TEST_F(ParserImplErrorTest, FunctionDeclDecoStageMissingRParen) { TEST_F(ParserImplErrorTest, FunctionDeclDecoStageMissingRParen) {
EXPECT( EXPECT("@stage(vertex fn f() {}",
"@stage(vertex fn f() {}",
R"(test.wgsl:1:15 error: expected ')' for stage decoration R"(test.wgsl:1:15 error: expected ')' for stage decoration
@stage(vertex fn f() {} @stage(vertex fn f() {}
^^ ^^
@ -1135,8 +1132,7 @@ test.wgsl:1:15 error: expected ']]' for decoration list
} }
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationMissingLParen) { TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationMissingLParen) {
EXPECT( EXPECT("@location 1) var i : i32;",
"@location 1) var i : i32;",
R"(test.wgsl:1:11 error: expected '(' for location decoration R"(test.wgsl:1:11 error: expected '(' for location decoration
@location 1) var i : i32; @location 1) var i : i32;
^ ^
@ -1144,8 +1140,7 @@ TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationMissingLParen) {
} }
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationMissingRParen) { TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationMissingRParen) {
EXPECT( EXPECT("@location (1 var i : i32;",
"@location (1 var i : i32;",
R"(test.wgsl:1:14 error: expected ')' for location decoration R"(test.wgsl:1:14 error: expected ')' for location decoration
@location (1 var i : i32; @location (1 var i : i32;
^^^ ^^^
@ -1190,8 +1185,7 @@ TEST_F(ParserImplErrorTest, GlobalDeclVarDecoLocationInvalidValue) {
} }
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinMissingLParen) { TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinMissingLParen) {
EXPECT( EXPECT("@builtin position) var i : i32;",
"@builtin position) var i : i32;",
R"(test.wgsl:1:10 error: expected '(' for builtin decoration R"(test.wgsl:1:10 error: expected '(' for builtin decoration
@builtin position) var i : i32; @builtin position) var i : i32;
^^^^^^^^ ^^^^^^^^
@ -1199,8 +1193,7 @@ TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinMissingLParen) {
} }
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinMissingRParen) { TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinMissingRParen) {
EXPECT( EXPECT("@builtin(position var i : i32;",
"@builtin(position var i : i32;",
R"(test.wgsl:1:19 error: expected ')' for builtin decoration R"(test.wgsl:1:19 error: expected ')' for builtin decoration
@builtin(position var i : i32; @builtin(position var i : i32;
^^^ ^^^
@ -1252,8 +1245,7 @@ TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBuiltinInvalidValue) {
} }
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingMissingLParen) { TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingMissingLParen) {
EXPECT( EXPECT("@binding 1) var i : i32;",
"@binding 1) var i : i32;",
R"(test.wgsl:1:10 error: expected '(' for binding decoration R"(test.wgsl:1:10 error: expected '(' for binding decoration
@binding 1) var i : i32; @binding 1) var i : i32;
^ ^
@ -1261,8 +1253,7 @@ TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingMissingLParen) {
} }
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingMissingRParen) { TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingMissingRParen) {
EXPECT( EXPECT("@binding(1 var i : i32;",
"@binding(1 var i : i32;",
R"(test.wgsl:1:12 error: expected ')' for binding decoration R"(test.wgsl:1:12 error: expected ')' for binding decoration
@binding(1 var i : i32; @binding(1 var i : i32;
^^^ ^^^
@ -1307,8 +1298,7 @@ TEST_F(ParserImplErrorTest, GlobalDeclVarDecoBindingInvalidValue) {
} }
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoGroupMissingLParen) { TEST_F(ParserImplErrorTest, GlobalDeclVarDecoGroupMissingLParen) {
EXPECT( EXPECT("@group 1) var i : i32;",
"@group 1) var i : i32;",
R"(test.wgsl:1:8 error: expected '(' for group decoration R"(test.wgsl:1:8 error: expected '(' for group decoration
@group 1) var i : i32; @group 1) var i : i32;
^ ^
@ -1316,8 +1306,7 @@ TEST_F(ParserImplErrorTest, GlobalDeclVarDecoGroupMissingLParen) {
} }
TEST_F(ParserImplErrorTest, GlobalDeclVarDecoGroupMissingRParen) { TEST_F(ParserImplErrorTest, GlobalDeclVarDecoGroupMissingRParen) {
EXPECT( EXPECT("@group(1 var i : i32;",
"@group(1 var i : i32;",
R"(test.wgsl:1:10 error: expected ')' for group decoration R"(test.wgsl:1:10 error: expected ')' for group decoration
@group(1 var i : i32; @group(1 var i : i32;
^^^ ^^^

View File

@ -38,8 +38,7 @@ TEST_F(ParserImplTest, DecorationDecl_MissingParenLeft) {
EXPECT_TRUE(decos.errored); EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched); EXPECT_FALSE(decos.matched);
EXPECT_TRUE(decos.value.empty()); EXPECT_TRUE(decos.value.empty());
EXPECT_EQ(p->error(), EXPECT_EQ(p->error(), "1:11: expected '(' for location decoration");
"1:11: expected '(' for location decoration");
} }
TEST_F(ParserImplTest, DecorationDecl_MissingValue) { TEST_F(ParserImplTest, DecorationDecl_MissingValue) {
@ -60,8 +59,7 @@ TEST_F(ParserImplTest, DecorationDecl_MissingParenRight) {
EXPECT_TRUE(decos.errored); EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched); EXPECT_FALSE(decos.matched);
EXPECT_TRUE(decos.value.empty()); EXPECT_TRUE(decos.value.empty());
EXPECT_EQ(p->error(), EXPECT_EQ(p->error(), "1:12: expected ')' for location decoration");
"1:12: expected ')' for location decoration");
} }
TEST_F(ParserImplTest, DecorationDecl_InvalidDecoration) { TEST_F(ParserImplTest, DecorationDecl_InvalidDecoration) {

View File

@ -36,7 +36,9 @@ TEST_F(ParserImplTest, DEPRECATED_DecorationDecl_EmptyBlock) {
EXPECT_TRUE(decos.errored); EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched); EXPECT_FALSE(decos.matched);
EXPECT_EQ(decos.value.size(), 0u); 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)"); 1:3: empty decoration list)");
} }
@ -68,7 +70,9 @@ TEST_F(ParserImplTest, DecorationDecl_MissingClose) {
EXPECT_TRUE(p->has_error()) << p->error(); EXPECT_TRUE(p->has_error()) << p->error();
EXPECT_TRUE(decos.errored); EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched); 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)"); 1:10: expected ']]' for decoration list)");
} }
@ -78,7 +82,9 @@ TEST_F(ParserImplTest, StructMemberDecorationDecl_SizeMissingClose) {
EXPECT_TRUE(p->has_error()) << p->error(); EXPECT_TRUE(p->has_error()) << p->error();
EXPECT_TRUE(decos.errored); EXPECT_TRUE(decos.errored);
EXPECT_FALSE(decos.matched); 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)"); 1:10: expected ']]' for decoration list)");
} }

View File

@ -25,8 +25,8 @@
#ifndef SRC_SEM_INTRINSIC_TYPE_H_ #ifndef SRC_SEM_INTRINSIC_TYPE_H_
#define SRC_SEM_INTRINSIC_TYPE_H_ #define SRC_SEM_INTRINSIC_TYPE_H_
#include <string>
#include <sstream> #include <sstream>
#include <string>
namespace tint { namespace tint {
namespace sem { namespace sem {

View File

@ -35,8 +35,8 @@
#include "src/sem/statement.h" #include "src/sem/statement.h"
#include "src/sem/struct.h" #include "src/sem/struct.h"
#include "src/sem/variable.h" #include "src/sem/variable.h"
#include "src/utils/map.h"
#include "src/utils/hash.h" #include "src/utils/hash.h"
#include "src/utils/map.h"
TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeMemoryAccess); TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeMemoryAccess);
TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeMemoryAccess::Intrinsic); TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeMemoryAccess::Intrinsic);

View File

@ -91,7 +91,7 @@ struct UniqueVector {
ConstReverseIterator rend() const { return vector.rend(); } ConstReverseIterator rend() const { return vector.rend(); }
/// @returns a const reference to the internal vector /// @returns a const reference to the internal vector
operator const std::vector<T> &() const { return vector; } operator const std::vector<T>&() const { return vector; }
/// Removes the last element from the vector /// Removes the last element from the vector
/// @returns the popped element /// @returns the popped element