mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
tint: Merge [S|U]intLiteralExpression
Merge SintLiteralExpression and UintLiteralExpression with IntLiteralExpression. IntLiteralExpression has a new Suffix field which indicates whether the literal is either a: • 'i' suffixed integer literal • 'u' suffixed integer literal • no-suffix integer literal Have the SPIR-V reader produce no-suffixed literals for i32 types, to keep this change small. In future changes the SPIR-V reader will produce 'i' suffixed types for these. Have all consumers of IntLiteralExpression treat unsuffixed integers the same as 'i'-suffixed literals. Unsuffixed will be treated as abstract in future changes. Removed SemHelper::TypeOf(const ast::LiteralExpression* lit). Fixed: tint:1510 Bug: tint:1504 Change-Id: I443f41984e637ddd948182ee756af1010c5f8226 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88842 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
5afd422e44
commit
8822e2966a
@@ -320,11 +320,9 @@ struct DecomposeMemoryAccess::State {
|
||||
/// @param expr the expression to convert to an Offset
|
||||
/// @returns an Offset for the given ast::Expression
|
||||
const Offset* ToOffset(const ast::Expression* expr) {
|
||||
if (auto* u32 = expr->As<ast::UintLiteralExpression>()) {
|
||||
return offsets_.Create<OffsetLiteral>(u32->value);
|
||||
} else if (auto* i32 = expr->As<ast::SintLiteralExpression>()) {
|
||||
if (i32->value > 0) {
|
||||
return offsets_.Create<OffsetLiteral>(i32->value);
|
||||
if (auto* lit = expr->As<ast::IntLiteralExpression>()) {
|
||||
if (lit->value > 0) {
|
||||
return offsets_.Create<OffsetLiteral>(static_cast<uint32_t>(lit->value));
|
||||
}
|
||||
}
|
||||
return offsets_.Create<OffsetExpr>(expr);
|
||||
|
||||
@@ -73,7 +73,7 @@ TEST_F(CreateASTTypeForTest, ArrayImplicitStride) {
|
||||
|
||||
auto* size = arr->As<ast::Array>()->count->As<ast::IntLiteralExpression>();
|
||||
ASSERT_NE(size, nullptr);
|
||||
EXPECT_EQ(size->ValueAsI32(), 2);
|
||||
EXPECT_EQ(size->value, 2);
|
||||
}
|
||||
|
||||
TEST_F(CreateASTTypeForTest, ArrayNonImplicitStride) {
|
||||
@@ -88,7 +88,7 @@ TEST_F(CreateASTTypeForTest, ArrayNonImplicitStride) {
|
||||
|
||||
auto* size = arr->As<ast::Array>()->count->As<ast::IntLiteralExpression>();
|
||||
ASSERT_NE(size, nullptr);
|
||||
EXPECT_EQ(size->ValueAsI32(), 2);
|
||||
EXPECT_EQ(size->value, 2);
|
||||
}
|
||||
|
||||
TEST_F(CreateASTTypeForTest, Struct) {
|
||||
|
||||
Reference in New Issue
Block a user