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()) {
return {};
}
return Source{where->second};
return Source{where->second };
}
bool ParserImpl::ParseInternalModuleExceptFunctions() {

View File

@ -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;
^^^
)");

View File

@ -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) {

View File

@ -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)");
}

View File

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

View File

@ -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);

View File

@ -91,7 +91,7 @@ struct UniqueVector {
ConstReverseIterator rend() const { return vector.rend(); }
/// @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
/// @returns the popped element