mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 22:17:51 +00:00
Rename type::Struct to type::StructType
This is to avoid name conflicts once we move all classes from namespace `type` to `sem`. Bug: tint:724 Change-Id: I23cdec636cb5bcf0bbba03ee7bb7c44252ddade7 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48361 Commit-Queue: Antonio Maiorano <amaiorano@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
cf4057be01
commit
3aa226138e
@@ -947,7 +947,7 @@ type::Type* ParserImpl::ConvertType(
|
||||
namer_.SuggestSanitizedName(type_id, "S");
|
||||
|
||||
auto name = namer_.GetName(type_id);
|
||||
auto* result = builder_.create<type::Struct>(
|
||||
auto* result = builder_.create<type::StructType>(
|
||||
builder_.Symbols().Register(name), ast_struct);
|
||||
id_to_type_[type_id] = result;
|
||||
if (num_non_writable_members == members.size()) {
|
||||
@@ -1501,7 +1501,7 @@ ast::Expression* ParserImpl::MakeNullValue(type::Type* type) {
|
||||
return create<ast::TypeConstructorExpression>(Source{}, original_type,
|
||||
std::move(ast_components));
|
||||
}
|
||||
if (auto* struct_ty = type->As<type::Struct>()) {
|
||||
if (auto* struct_ty = type->As<type::StructType>()) {
|
||||
ast::ExpressionList ast_components;
|
||||
for (auto* member : struct_ty->impl()->members()) {
|
||||
ast_components.emplace_back(MakeNullValue(member->type()));
|
||||
|
||||
@@ -550,10 +550,10 @@ TEST_F(SpvParserTest, ConvertType_StructTwoMembers) {
|
||||
|
||||
auto* type = p->ConvertType(10);
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_TRUE(type->Is<type::Struct>());
|
||||
EXPECT_TRUE(type->Is<type::StructType>());
|
||||
|
||||
Program program = p->program();
|
||||
EXPECT_THAT(program.str(type->As<type::Struct>()->impl()), Eq(R"(Struct{
|
||||
EXPECT_THAT(program.str(type->As<type::StructType>()->impl()), Eq(R"(Struct{
|
||||
StructMember{field0: __u32}
|
||||
StructMember{field1: __f32}
|
||||
}
|
||||
@@ -571,10 +571,10 @@ TEST_F(SpvParserTest, ConvertType_StructWithBlockDecoration) {
|
||||
|
||||
auto* type = p->ConvertType(10);
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_TRUE(type->Is<type::Struct>());
|
||||
EXPECT_TRUE(type->Is<type::StructType>());
|
||||
|
||||
Program program = p->program();
|
||||
EXPECT_THAT(program.str(type->As<type::Struct>()->impl()), Eq(R"(Struct{
|
||||
EXPECT_THAT(program.str(type->As<type::StructType>()->impl()), Eq(R"(Struct{
|
||||
[[block]]
|
||||
StructMember{field0: __u32}
|
||||
}
|
||||
@@ -596,10 +596,10 @@ TEST_F(SpvParserTest, ConvertType_StructWithMemberDecorations) {
|
||||
|
||||
auto* type = p->ConvertType(10);
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_TRUE(type->Is<type::Struct>());
|
||||
EXPECT_TRUE(type->Is<type::StructType>());
|
||||
|
||||
Program program = p->program();
|
||||
EXPECT_THAT(program.str(type->As<type::Struct>()->impl()), Eq(R"(Struct{
|
||||
EXPECT_THAT(program.str(type->As<type::StructType>()->impl()), Eq(R"(Struct{
|
||||
StructMember{[[ offset 0 ]] field0: __f32}
|
||||
StructMember{[[ offset 8 ]] field1: __vec_2__f32}
|
||||
StructMember{[[ offset 16 ]] field2: __mat_2_2__f32}
|
||||
|
||||
@@ -1121,7 +1121,7 @@ Expect<ast::StorageClass> ParserImpl::expect_storage_class(
|
||||
|
||||
// struct_decl
|
||||
// : struct_decoration_decl* STRUCT IDENT struct_body_decl
|
||||
Maybe<type::Struct*> ParserImpl::struct_decl(ast::DecorationList& decos) {
|
||||
Maybe<type::StructType*> ParserImpl::struct_decl(ast::DecorationList& decos) {
|
||||
auto t = peek();
|
||||
auto source = t.source();
|
||||
|
||||
@@ -1136,7 +1136,7 @@ Maybe<type::Struct*> ParserImpl::struct_decl(ast::DecorationList& decos) {
|
||||
if (body.errored)
|
||||
return Failure::kErrored;
|
||||
|
||||
return create<type::Struct>(
|
||||
return create<type::StructType>(
|
||||
builder_.Symbols().Register(name.value),
|
||||
create<ast::Struct>(source, std::move(body.value), std::move(decos)));
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ class ParserImpl {
|
||||
/// `struct_decoration_decl*` provided as `decos`.
|
||||
/// @returns the struct type or nullptr on error
|
||||
/// @param decos the list of decorations for the struct declaration.
|
||||
Maybe<type::Struct*> struct_decl(ast::DecorationList& decos);
|
||||
Maybe<type::StructType*> struct_decl(ast::DecorationList& decos);
|
||||
/// Parses a `struct_body_decl` grammar element, erroring on parse failure.
|
||||
/// @returns the struct members
|
||||
Expect<ast::StructMemberList> expect_struct_body_decl();
|
||||
|
||||
@@ -102,8 +102,8 @@ type B = A;)");
|
||||
|
||||
auto program = p->program();
|
||||
ASSERT_EQ(program.AST().ConstructedTypes().size(), 2u);
|
||||
ASSERT_TRUE(program.AST().ConstructedTypes()[0]->Is<type::Struct>());
|
||||
auto* str = program.AST().ConstructedTypes()[0]->As<type::Struct>();
|
||||
ASSERT_TRUE(program.AST().ConstructedTypes()[0]->Is<type::StructType>());
|
||||
auto* str = program.AST().ConstructedTypes()[0]->As<type::StructType>();
|
||||
EXPECT_EQ(str->symbol(), program.Symbols().Get("A"));
|
||||
|
||||
ASSERT_TRUE(program.AST().ConstructedTypes()[1]->Is<type::Alias>());
|
||||
@@ -165,9 +165,9 @@ TEST_F(ParserImplTest, GlobalDecl_ParsesStruct) {
|
||||
|
||||
auto* t = program.AST().ConstructedTypes()[0];
|
||||
ASSERT_NE(t, nullptr);
|
||||
ASSERT_TRUE(t->Is<type::Struct>());
|
||||
ASSERT_TRUE(t->Is<type::StructType>());
|
||||
|
||||
auto* str = t->As<type::Struct>();
|
||||
auto* str = t->As<type::StructType>();
|
||||
EXPECT_EQ(str->symbol(), program.Symbols().Get("A"));
|
||||
EXPECT_EQ(str->impl()->members().size(), 2u);
|
||||
}
|
||||
@@ -183,9 +183,9 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithStride) {
|
||||
|
||||
auto* t = program.AST().ConstructedTypes()[0];
|
||||
ASSERT_NE(t, nullptr);
|
||||
ASSERT_TRUE(t->Is<type::Struct>());
|
||||
ASSERT_TRUE(t->Is<type::StructType>());
|
||||
|
||||
auto* str = t->As<type::Struct>();
|
||||
auto* str = t->As<type::StructType>();
|
||||
EXPECT_EQ(str->symbol(), program.Symbols().Get("A"));
|
||||
EXPECT_EQ(str->impl()->members().size(), 1u);
|
||||
EXPECT_FALSE(str->IsBlockDecorated());
|
||||
@@ -210,9 +210,9 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithDecoration) {
|
||||
|
||||
auto* t = program.AST().ConstructedTypes()[0];
|
||||
ASSERT_NE(t, nullptr);
|
||||
ASSERT_TRUE(t->Is<type::Struct>());
|
||||
ASSERT_TRUE(t->Is<type::StructType>());
|
||||
|
||||
auto* str = t->As<type::Struct>();
|
||||
auto* str = t->As<type::StructType>();
|
||||
EXPECT_EQ(str->symbol(), program.Symbols().Get("A"));
|
||||
EXPECT_EQ(str->impl()->members().size(), 1u);
|
||||
EXPECT_TRUE(str->IsBlockDecorated());
|
||||
|
||||
@@ -38,7 +38,7 @@ TEST_F(ParserImplTest, TypeDecl_ParsesType) {
|
||||
TEST_F(ParserImplTest, TypeDecl_ParsesStruct_Ident) {
|
||||
auto p = parser("type a = B");
|
||||
|
||||
type::Struct str(p->builder().Symbols().Get("B"), {});
|
||||
type::StructType str(p->builder().Symbols().Get("B"), {});
|
||||
p->register_constructed("B", &str);
|
||||
|
||||
auto t = p->type_alias();
|
||||
@@ -49,9 +49,9 @@ TEST_F(ParserImplTest, TypeDecl_ParsesStruct_Ident) {
|
||||
ASSERT_TRUE(t->Is<type::Alias>());
|
||||
auto* alias = t->As<type::Alias>();
|
||||
EXPECT_EQ(p->builder().Symbols().NameFor(alias->symbol()), "a");
|
||||
ASSERT_TRUE(alias->type()->Is<type::Struct>());
|
||||
ASSERT_TRUE(alias->type()->Is<type::StructType>());
|
||||
|
||||
auto* s = alias->type()->As<type::Struct>();
|
||||
auto* s = alias->type()->As<type::StructType>();
|
||||
EXPECT_EQ(s->symbol(), p->builder().Symbols().Get("B"));
|
||||
EXPECT_EQ(s->symbol(), p->builder().Symbols().Get("B"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user