ast: Rename UnaryOp::kDereference to kIndirection
This is what it is (currently) called in the spec Bug: tint:727 Change-Id: Ie24f42499ed20c0c45ef4e9474bc6bb6a19bfa36 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51181 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
ac90829e1c
commit
85bdf1753e
|
@ -23,8 +23,8 @@ std::ostream& operator<<(std::ostream& out, UnaryOp mod) {
|
|||
out << "address-of";
|
||||
break;
|
||||
}
|
||||
case UnaryOp::kDereference: {
|
||||
out << "dereference";
|
||||
case UnaryOp::kIndirection: {
|
||||
out << "indirection";
|
||||
break;
|
||||
}
|
||||
case UnaryOp::kNegation: {
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace ast {
|
|||
/// The unary op
|
||||
enum class UnaryOp {
|
||||
kAddressOf, // &EXPR
|
||||
kDereference, // *EXPR
|
||||
kIndirection, // *EXPR
|
||||
kNegation, // -EXPR
|
||||
kNot, // !EXPR
|
||||
};
|
||||
|
|
|
@ -2325,7 +2325,7 @@ Maybe<ast::Expression*> ParserImpl::unary_expression() {
|
|||
} else if (match(Token::Type::kBang)) {
|
||||
op = ast::UnaryOp::kNot;
|
||||
} else if (match(Token::Type::kStar)) {
|
||||
op = ast::UnaryOp::kDereference;
|
||||
op = ast::UnaryOp::kIndirection;
|
||||
} else if (match(Token::Type::kAnd)) {
|
||||
op = ast::UnaryOp::kAddressOf;
|
||||
} else {
|
||||
|
|
|
@ -85,7 +85,7 @@ TEST_F(ParserImplTest, UnaryExpression_Dereference) {
|
|||
ASSERT_TRUE(e->Is<ast::UnaryOpExpression>());
|
||||
|
||||
auto* u = e->As<ast::UnaryOpExpression>();
|
||||
EXPECT_EQ(u->op(), ast::UnaryOp::kDereference);
|
||||
EXPECT_EQ(u->op(), ast::UnaryOp::kIndirection);
|
||||
EXPECT_TRUE(u->expr()->Is<ast::IdentifierExpression>());
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ TEST_F(ParserImplTest, UnaryExpression_Dereference_Precedence) {
|
|||
ASSERT_TRUE(e->Is<ast::UnaryOpExpression>());
|
||||
|
||||
auto* u = e->As<ast::UnaryOpExpression>();
|
||||
EXPECT_EQ(u->op(), ast::UnaryOp::kDereference);
|
||||
EXPECT_EQ(u->op(), ast::UnaryOp::kIndirection);
|
||||
EXPECT_TRUE(u->expr()->Is<ast::MemberAccessorExpression>());
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ void Hlsl::AddEmptyEntryPoint(CloneContext& ctx) const {
|
|||
return;
|
||||
}
|
||||
}
|
||||
ctx.dst->Func(ctx.dst->Symbols().New("tint_unused_entry_point"), {},
|
||||
ctx.dst->Func(ctx.dst->Symbols().New("unused_entry_point"), {},
|
||||
ctx.dst->ty.void_(), {},
|
||||
{ctx.dst->Stage(ast::PipelineStage::kCompute)});
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ TEST_F(HlslTest, AddEmptyEntryPoint) {
|
|||
|
||||
auto* expect = R"(
|
||||
[[stage(compute)]]
|
||||
fn tint_unused_entry_point() {
|
||||
fn unused_entry_point() {
|
||||
}
|
||||
)";
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ void Spirv::AddEmptyEntryPoint(CloneContext& ctx) const {
|
|||
return;
|
||||
}
|
||||
}
|
||||
ctx.dst->Func("_tint_unused_entry_point", {}, ctx.dst->ty.void_(), {},
|
||||
ctx.dst->Func(ctx.dst->Sym("unused_entry_point"), {}, ctx.dst->ty.void_(), {},
|
||||
{ctx.dst->Stage(ast::PipelineStage::kCompute)});
|
||||
}
|
||||
|
||||
|
|
|
@ -693,7 +693,7 @@ TEST_F(SpirvTest, AddEmptyEntryPoint) {
|
|||
|
||||
auto* expect = R"(
|
||||
[[stage(compute)]]
|
||||
fn _tint_unused_entry_point() {
|
||||
fn unused_entry_point() {
|
||||
}
|
||||
)";
|
||||
|
||||
|
|
|
@ -2599,7 +2599,7 @@ bool GeneratorImpl::EmitUnaryOp(std::ostream& pre,
|
|||
std::ostream& out,
|
||||
ast::UnaryOpExpression* expr) {
|
||||
switch (expr->op()) {
|
||||
case ast::UnaryOp::kDereference:
|
||||
case ast::UnaryOp::kIndirection:
|
||||
case ast::UnaryOp::kAddressOf:
|
||||
// TODO(crbug.com/tint/183) - support pointers
|
||||
return EmitExpression(pre, out, expr->expr());
|
||||
|
|
|
@ -46,7 +46,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
HlslGeneratorImplTest_UnaryOp,
|
||||
HlslUnaryOpTest,
|
||||
testing::Values(UnaryOpData{"", ast::UnaryOp::kAddressOf},
|
||||
UnaryOpData{"", ast::UnaryOp::kDereference},
|
||||
UnaryOpData{"", ast::UnaryOp::kIndirection},
|
||||
UnaryOpData{"!", ast::UnaryOp::kNot},
|
||||
UnaryOpData{"-", ast::UnaryOp::kNegation}));
|
||||
|
||||
|
|
|
@ -2151,12 +2151,12 @@ bool GeneratorImpl::EmitStructType(const sem::Struct* str) {
|
|||
|
||||
bool GeneratorImpl::EmitUnaryOp(ast::UnaryOpExpression* expr) {
|
||||
switch (expr->op()) {
|
||||
case ast::UnaryOp::kDereference:
|
||||
out_ << "*";
|
||||
break;
|
||||
case ast::UnaryOp::kAddressOf:
|
||||
out_ << "&";
|
||||
break;
|
||||
case ast::UnaryOp::kIndirection:
|
||||
out_ << "*";
|
||||
break;
|
||||
case ast::UnaryOp::kNot:
|
||||
out_ << "!";
|
||||
break;
|
||||
|
|
|
@ -44,7 +44,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
MslGeneratorImplTest,
|
||||
MslUnaryOpTest,
|
||||
testing::Values(UnaryOpData{"&", ast::UnaryOp::kAddressOf},
|
||||
UnaryOpData{"*", ast::UnaryOp::kDereference},
|
||||
UnaryOpData{"*", ast::UnaryOp::kIndirection},
|
||||
UnaryOpData{"!", ast::UnaryOp::kNot},
|
||||
UnaryOpData{"-", ast::UnaryOp::kNegation}));
|
||||
|
||||
|
|
|
@ -709,12 +709,12 @@ bool GeneratorImpl::EmitBinary(ast::BinaryExpression* expr) {
|
|||
|
||||
bool GeneratorImpl::EmitUnaryOp(ast::UnaryOpExpression* expr) {
|
||||
switch (expr->op()) {
|
||||
case ast::UnaryOp::kDereference:
|
||||
out_ << "*";
|
||||
break;
|
||||
case ast::UnaryOp::kAddressOf:
|
||||
out_ << "&";
|
||||
break;
|
||||
case ast::UnaryOp::kIndirection:
|
||||
out_ << "*";
|
||||
break;
|
||||
case ast::UnaryOp::kNot:
|
||||
out_ << "!";
|
||||
break;
|
||||
|
|
|
@ -48,7 +48,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
WgslGeneratorImplTest,
|
||||
WgslUnaryOpTest,
|
||||
testing::Values(UnaryOpData{"&", ast::UnaryOp::kAddressOf},
|
||||
UnaryOpData{"*", ast::UnaryOp::kDereference},
|
||||
UnaryOpData{"*", ast::UnaryOp::kIndirection},
|
||||
UnaryOpData{"!", ast::UnaryOp::kNot},
|
||||
UnaryOpData{"-", ast::UnaryOp::kNegation}));
|
||||
|
||||
|
|
Loading…
Reference in New Issue