Have TypesBuilder::void_() return ast::Void
Bug: tint:724 Change-Id: Ie4876c06f9b67601a9601b77bdcaeec94145938e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51661 Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@chromium.org> Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
parent
c03d3bdc94
commit
cc98b4f9aa
|
@ -373,7 +373,7 @@ TEST_F(IntrinsicTableTest, MatchWOStorageTexture) {
|
|||
ASSERT_NE(result.intrinsic, nullptr);
|
||||
ASSERT_EQ(result.diagnostics.str(), "");
|
||||
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kTextureStore);
|
||||
EXPECT_THAT(result.intrinsic->ReturnType(), ty.void_());
|
||||
EXPECT_TRUE(result.intrinsic->ReturnType()->Is<sem::Void>());
|
||||
EXPECT_THAT(result.intrinsic->Parameters(),
|
||||
ElementsAre(Parameter{tex, Parameter::Usage::kTexture},
|
||||
Parameter{vec2_i32, Parameter::Usage::kCoords},
|
||||
|
|
|
@ -391,14 +391,12 @@ class ProgramBuilder {
|
|||
}
|
||||
|
||||
/// @returns a void type
|
||||
typ::Void void_() const {
|
||||
return {builder->create<ast::Void>(), builder->create<sem::Void>()};
|
||||
}
|
||||
typ::Void void_() const { return {builder->create<ast::Void>()}; }
|
||||
|
||||
/// @param source the Source of the node
|
||||
/// @returns a void type
|
||||
typ::Void void_(const Source& source) const {
|
||||
return {builder->create<ast::Void>(source), builder->create<sem::Void>()};
|
||||
return {builder->create<ast::Void>(source)};
|
||||
}
|
||||
|
||||
/// @param type vector subtype
|
||||
|
|
|
@ -1964,7 +1964,7 @@ TEST_P(ResolverIntrinsicTest_Texture, Call) {
|
|||
} else if (std::string(param.function) == "textureNumSamples") {
|
||||
EXPECT_TRUE(TypeOf(call)->Is<sem::I32>());
|
||||
} else if (std::string(param.function) == "textureStore") {
|
||||
EXPECT_EQ(TypeOf(call), ty.void_());
|
||||
EXPECT_TRUE(TypeOf(call)->Is<sem::Void>());
|
||||
} else {
|
||||
switch (param.texture_kind) {
|
||||
case ast::intrinsic::test::TextureKind::kRegular:
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace {
|
|||
using ResolverIsHostShareable = ResolverTest;
|
||||
|
||||
TEST_F(ResolverIsHostShareable, Void) {
|
||||
EXPECT_FALSE(r()->IsHostShareable(ty.void_()));
|
||||
EXPECT_FALSE(r()->IsHostShareable(create<sem::Void>()));
|
||||
}
|
||||
|
||||
TEST_F(ResolverIsHostShareable, Bool) {
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace {
|
|||
using ResolverIsStorableTest = ResolverTest;
|
||||
|
||||
TEST_F(ResolverIsStorableTest, Void) {
|
||||
EXPECT_FALSE(r()->IsStorable(ty.void_()));
|
||||
EXPECT_FALSE(r()->IsStorable(create<sem::Void>()));
|
||||
}
|
||||
|
||||
TEST_F(ResolverIsStorableTest, Scalar) {
|
||||
|
|
|
@ -2948,7 +2948,7 @@ bool Resolver::ValidateReturn(const ast::ReturnStatement* ret) {
|
|||
auto* func_type = current_function_->return_type;
|
||||
|
||||
auto* ret_type = ret->has_value() ? TypeOf(ret->value())->UnwrapRef()
|
||||
: builder_->ty.void_();
|
||||
: builder_->create<sem::Void>();
|
||||
|
||||
if (func_type->UnwrapRef() != ret_type) {
|
||||
diagnostics_.add_error("v-000y",
|
||||
|
|
|
@ -250,12 +250,12 @@ using StorageTexture = TypePair<ast::StorageTexture, sem::StorageTexture>;
|
|||
using Struct = TypePair<ast::Struct, sem::Struct>;
|
||||
using Texture = TypePair<ast::Texture, sem::Texture>;
|
||||
using Vector = TypePair<ast::Vector, sem::Vector>;
|
||||
using Void = TypePair<ast::Void, sem::Void>;
|
||||
|
||||
using Bool = Ptr<ast::Bool>;
|
||||
using U32 = Ptr<ast::U32>;
|
||||
using I32 = Ptr<ast::I32>;
|
||||
using F32 = Ptr<ast::F32>;
|
||||
using Void = Ptr<ast::Void>;
|
||||
|
||||
// Helpers
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Vector) {
|
|||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Type, EmitType_Void) {
|
||||
auto void_ = ty.void_();
|
||||
auto* void_ = create<sem::Void>();
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
|
@ -319,22 +319,22 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Void) {
|
|||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Type, EmitSampler) {
|
||||
sem::Sampler sampler(ast::SamplerKind::kSampler);
|
||||
auto* sampler = create<sem::Sampler>(ast::SamplerKind::kSampler);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
ASSERT_TRUE(gen.EmitType(out, &sampler, ast::StorageClass::kNone,
|
||||
ASSERT_TRUE(gen.EmitType(out, sampler, ast::StorageClass::kNone,
|
||||
ast::AccessControl::kInvalid, ""))
|
||||
<< gen.error();
|
||||
EXPECT_EQ(result(), "SamplerState");
|
||||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Type, EmitSamplerComparison) {
|
||||
sem::Sampler sampler(ast::SamplerKind::kComparisonSampler);
|
||||
auto* sampler = create<sem::Sampler>(ast::SamplerKind::kComparisonSampler);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
ASSERT_TRUE(gen.EmitType(out, &sampler, ast::StorageClass::kNone,
|
||||
ASSERT_TRUE(gen.EmitType(out, sampler, ast::StorageClass::kNone,
|
||||
ast::AccessControl::kInvalid, ""))
|
||||
<< gen.error();
|
||||
EXPECT_EQ(result(), "SamplerComparisonState");
|
||||
|
|
|
@ -647,7 +647,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Vector) {
|
|||
}
|
||||
|
||||
TEST_F(MslGeneratorImplTest, EmitType_Void) {
|
||||
auto void_ = ty.void_();
|
||||
auto* void_ = create<sem::Void>();
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
|
|
Loading…
Reference in New Issue