UintLiteral::to_str() suffix with 'u'

Fixed: tint:673
Change-Id: I5a58d9e504446ccff724e368b5ea2cf835d2271b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47768
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
Ben Clayton 2021-04-16 10:44:54 +00:00 committed by Commit Bot service account
parent 98b084e4a4
commit 316dcd4166
16 changed files with 726 additions and 727 deletions

View File

@ -156,7 +156,7 @@ TEST_F(CaseStatementTest, ToStr_WithSelectors_u32) {
});
auto* c = create<CaseStatement>(CaseSelectorList{b}, body);
EXPECT_EQ(str(c), R"(Case 2{
EXPECT_EQ(str(c), R"(Case 2u{
Discard{}
}
)");

View File

@ -30,7 +30,7 @@ UintLiteral::UintLiteral(ProgramID program_id,
UintLiteral::~UintLiteral() = default;
std::string UintLiteral::to_str(const semantic::Info&) const {
return std::to_string(value());
return std::to_string(value()) + "u";
}
std::string UintLiteral::name() const {

View File

@ -35,8 +35,8 @@ TEST_F(UintLiteralTest, Is) {
}
TEST_F(UintLiteralTest, ToStr) {
auto* u = create<UintLiteral>(ty.u32(), 42);
EXPECT_EQ(str(u), "42");
auto* u = create<UintLiteral>(ty.u32(), 42u);
EXPECT_EQ(str(u), "42u");
}
} // namespace

View File

@ -70,15 +70,15 @@ std::string AstFor(std::string assembly) {
if (assembly == "v2uint_10_20") {
return R"(TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
})";
}
if (assembly == "v2uint_20_10") {
return R"(TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20u}
ScalarConstructor[not set]{10u}
})";
}
if (assembly == "v2int_30_40") {
@ -99,8 +99,8 @@ std::string AstFor(std::string assembly) {
return R"(Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
})";
}
@ -179,7 +179,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) {
UnaryOp[not set]{
negation
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
}
@ -236,7 +236,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) {
UnaryOp[not set]{
negation
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
}
@ -297,8 +297,8 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) {
Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}
@ -362,8 +362,8 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) {
Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}
@ -526,8 +526,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpIAdd", "uint_20", "__u32",
"ScalarConstructor[not set]{10}", "add",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "add",
"ScalarConstructor[not set]{20u}"},
// Both int
BinaryData{"int", "int_30", "OpIAdd", "int_40", "__i32",
"ScalarConstructor[not set]{30}", "add",
@ -554,7 +554,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
add
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
}
@ -567,7 +567,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
add
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -576,7 +576,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(__u32
{
Binary[not set]{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
add
Bitcast[not set]<__u32>{
ScalarConstructor[not set]{30}
@ -589,9 +589,9 @@ INSTANTIATE_TEST_SUITE_P(
{
Bitcast[not set]<__i32>{
Binary[not set]{
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{20u}
add
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -610,8 +610,8 @@ INSTANTIATE_TEST_SUITE_P(
Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}
@ -625,8 +625,8 @@ INSTANTIATE_TEST_SUITE_P(
Binary[not set]{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
add
Bitcast[not set]<__vec_2__u32>{
@ -659,8 +659,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpISub", "uint_20", "__u32",
"ScalarConstructor[not set]{10}", "subtract",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "subtract",
"ScalarConstructor[not set]{20u}"},
// Both int
BinaryData{"int", "int_30", "OpISub", "int_40", "__i32",
"ScalarConstructor[not set]{30}", "subtract",
@ -687,7 +687,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
subtract
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
}
@ -700,7 +700,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
subtract
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -709,7 +709,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(__u32
{
Binary[not set]{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
subtract
Bitcast[not set]<__u32>{
ScalarConstructor[not set]{30}
@ -722,9 +722,9 @@ INSTANTIATE_TEST_SUITE_P(
{
Bitcast[not set]<__i32>{
Binary[not set]{
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{20u}
subtract
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -743,8 +743,8 @@ INSTANTIATE_TEST_SUITE_P(
Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}
@ -758,8 +758,8 @@ INSTANTIATE_TEST_SUITE_P(
Binary[not set]{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
subtract
Bitcast[not set]<__vec_2__u32>{
@ -792,8 +792,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpIMul", "uint_20", "__u32",
"ScalarConstructor[not set]{10}", "multiply",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "multiply",
"ScalarConstructor[not set]{20u}"},
// Both int
BinaryData{"int", "int_30", "OpIMul", "int_40", "__i32",
"ScalarConstructor[not set]{30}", "multiply",
@ -820,7 +820,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
multiply
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
}
@ -833,7 +833,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
multiply
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -842,7 +842,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(__u32
{
Binary[not set]{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
multiply
Bitcast[not set]<__u32>{
ScalarConstructor[not set]{30}
@ -855,9 +855,9 @@ INSTANTIATE_TEST_SUITE_P(
{
Bitcast[not set]<__i32>{
Binary[not set]{
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{20u}
multiply
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -876,8 +876,8 @@ INSTANTIATE_TEST_SUITE_P(
Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}
@ -891,8 +891,8 @@ INSTANTIATE_TEST_SUITE_P(
Binary[not set]{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
multiply
Bitcast[not set]<__vec_2__u32>{
@ -925,8 +925,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpUDiv", "uint_20", "__u32",
"ScalarConstructor[not set]{10}", "divide",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "divide",
"ScalarConstructor[not set]{20u}"},
// Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpUDiv", "v2uint_20_10",
"__vec_2__u32", AstFor("v2uint_10_20"), "divide",
@ -953,12 +953,12 @@ INSTANTIATE_TEST_SUITE_P(
BinaryData{"int", "int_30", "OpSDiv", "uint_10", "__i32",
"ScalarConstructor[not set]{30}", "divide",
R"(Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
})"},
// Mixed, returning int, first arg uint
BinaryData{"int", "uint_10", "OpSDiv", "int_30", "__i32",
R"(Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
})",
"divide", "ScalarConstructor[not set]{30}"},
// Mixed, returning v2int, first arg v2uint
@ -1067,8 +1067,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpUMod", "uint_20", "__u32",
"ScalarConstructor[not set]{10}", "modulo",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "modulo",
"ScalarConstructor[not set]{20u}"},
// Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpUMod", "v2uint_20_10",
"__vec_2__u32", AstFor("v2uint_10_20"), "modulo",
@ -1098,12 +1098,12 @@ INSTANTIATE_TEST_SUITE_P(
BinaryData{"int", "int_30", "OpSMod", "uint_10", "__i32",
"ScalarConstructor[not set]{30}", "modulo",
R"(Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
})"},
// Mixed, returning int, first arg uint
BinaryData{"int", "uint_10", "OpSMod", "int_30", "__i32",
R"(Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
})",
"modulo", "ScalarConstructor[not set]{30}"},
// Mixed, returning v2int, first arg v2uint

View File

@ -61,15 +61,15 @@ std::string AstFor(std::string assembly) {
if (assembly == "v2uint_10_20") {
return R"(TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
})";
}
if (assembly == "v2uint_20_10") {
return R"(TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20u}
ScalarConstructor[not set]{10u}
})";
}
if (assembly == "v2int_30_40") {
@ -90,8 +90,8 @@ std::string AstFor(std::string assembly) {
return R"(Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
})";
}
@ -212,8 +212,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpShiftLeftLogical", "uint_20", "__u32",
"ScalarConstructor[not set]{10}", "shift_left",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "shift_left",
"ScalarConstructor[not set]{20u}"},
// Both int
BinaryData{"int", "int_30", "OpShiftLeftLogical", "int_40", "__i32",
"ScalarConstructor[not set]{30}", "shift_left",
@ -221,11 +221,11 @@ INSTANTIATE_TEST_SUITE_P(
// Mixed, returning uint
BinaryData{"uint", "int_30", "OpShiftLeftLogical", "uint_10", "__u32",
"ScalarConstructor[not set]{30}", "shift_left",
"ScalarConstructor[not set]{10}"},
"ScalarConstructor[not set]{10u}"},
// Mixed, returning int
BinaryData{"int", "int_30", "OpShiftLeftLogical", "uint_10", "__i32",
"ScalarConstructor[not set]{30}", "shift_left",
"ScalarConstructor[not set]{10}"},
"ScalarConstructor[not set]{10u}"},
// Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpShiftLeftLogical",
"v2uint_20_10", "__vec_2__u32", AstFor("v2uint_10_20"),
@ -249,8 +249,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpShiftRightLogical", "uint_20", "__u32",
"ScalarConstructor[not set]{10}", "shift_right",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "shift_right",
"ScalarConstructor[not set]{20u}"},
// Both int
BinaryData{"int", "int_30", "OpShiftRightLogical", "int_40", "__i32",
"ScalarConstructor[not set]{30}", "shift_right",
@ -258,11 +258,11 @@ INSTANTIATE_TEST_SUITE_P(
// Mixed, returning uint
BinaryData{"uint", "int_30", "OpShiftRightLogical", "uint_10", "__u32",
"ScalarConstructor[not set]{30}", "shift_right",
"ScalarConstructor[not set]{10}"},
"ScalarConstructor[not set]{10u}"},
// Mixed, returning int
BinaryData{"int", "int_30", "OpShiftRightLogical", "uint_10", "__i32",
"ScalarConstructor[not set]{30}", "shift_right",
"ScalarConstructor[not set]{10}"},
"ScalarConstructor[not set]{10u}"},
// Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpShiftRightLogical",
"v2uint_20_10", "__vec_2__u32", AstFor("v2uint_10_20"),
@ -286,8 +286,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpShiftRightArithmetic", "uint_20",
"__u32", "ScalarConstructor[not set]{10}", "shift_right",
"ScalarConstructor[not set]{20}"},
"__u32", "ScalarConstructor[not set]{10u}", "shift_right",
"ScalarConstructor[not set]{20u}"},
// Both int
BinaryData{"int", "int_30", "OpShiftRightArithmetic", "int_40", "__i32",
"ScalarConstructor[not set]{30}", "shift_right",
@ -295,11 +295,11 @@ INSTANTIATE_TEST_SUITE_P(
// Mixed, returning uint
BinaryData{"uint", "int_30", "OpShiftRightArithmetic", "uint_10",
"__u32", "ScalarConstructor[not set]{30}", "shift_right",
"ScalarConstructor[not set]{10}"},
"ScalarConstructor[not set]{10u}"},
// Mixed, returning int
BinaryData{"int", "int_30", "OpShiftRightArithmetic", "uint_10",
"__i32", "ScalarConstructor[not set]{30}", "shift_right",
"ScalarConstructor[not set]{10}"},
"ScalarConstructor[not set]{10u}"},
// Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpShiftRightArithmetic",
"v2uint_20_10", "__vec_2__u32", AstFor("v2uint_10_20"),
@ -323,8 +323,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpBitwiseAnd", "uint_20", "__u32",
"ScalarConstructor[not set]{10}", "and",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "and",
"ScalarConstructor[not set]{20u}"},
// Both int
BinaryData{"int", "int_30", "OpBitwiseAnd", "int_40", "__i32",
"ScalarConstructor[not set]{30}", "and",
@ -351,7 +351,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
and
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
}
@ -364,7 +364,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
and
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -373,7 +373,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(__u32
{
Binary[not set]{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
and
Bitcast[not set]<__u32>{
ScalarConstructor[not set]{30}
@ -386,9 +386,9 @@ INSTANTIATE_TEST_SUITE_P(
{
Bitcast[not set]<__i32>{
Binary[not set]{
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{20u}
and
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -408,8 +408,8 @@ INSTANTIATE_TEST_SUITE_P(
Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}
@ -424,8 +424,8 @@ INSTANTIATE_TEST_SUITE_P(
Binary[not set]{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
and
Bitcast[not set]<__vec_2__u32>{
@ -445,8 +445,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpBitwiseOr", "uint_20", "__u32",
"ScalarConstructor[not set]{10}", "or",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "or",
"ScalarConstructor[not set]{20u}"},
// Both int
BinaryData{"int", "int_30", "OpBitwiseOr", "int_40", "__i32",
"ScalarConstructor[not set]{30}", "or",
@ -473,7 +473,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
or
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
}
@ -486,7 +486,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
or
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -495,7 +495,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(__u32
{
Binary[not set]{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
or
Bitcast[not set]<__u32>{
ScalarConstructor[not set]{30}
@ -508,9 +508,9 @@ INSTANTIATE_TEST_SUITE_P(
{
Bitcast[not set]<__i32>{
Binary[not set]{
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{20u}
or
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -530,8 +530,8 @@ INSTANTIATE_TEST_SUITE_P(
Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}
@ -545,8 +545,8 @@ INSTANTIATE_TEST_SUITE_P(
Binary[not set]{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
or
Bitcast[not set]<__vec_2__u32>{
@ -566,8 +566,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"uint", "uint_10", "OpBitwiseXor", "uint_20", "__u32",
"ScalarConstructor[not set]{10}", "xor",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "xor",
"ScalarConstructor[not set]{20u}"},
// Both int
BinaryData{"int", "int_30", "OpBitwiseXor", "int_40", "__i32",
"ScalarConstructor[not set]{30}", "xor",
@ -594,7 +594,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
xor
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
}
@ -607,7 +607,7 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{30}
xor
Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -616,7 +616,7 @@ INSTANTIATE_TEST_SUITE_P(
R"(__u32
{
Binary[not set]{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
xor
Bitcast[not set]<__u32>{
ScalarConstructor[not set]{30}
@ -629,9 +629,9 @@ INSTANTIATE_TEST_SUITE_P(
{
Bitcast[not set]<__i32>{
Binary[not set]{
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{20u}
xor
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"},
@ -651,8 +651,8 @@ INSTANTIATE_TEST_SUITE_P(
Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}
@ -667,8 +667,8 @@ INSTANTIATE_TEST_SUITE_P(
Binary[not set]{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
xor
Bitcast[not set]<__vec_2__u32>{
@ -729,7 +729,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Uint) {
Bitcast[not set]<__i32>{
UnaryOp[not set]{
not
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
}
@ -784,7 +784,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Uint) {
{
UnaryOp[not set]{
not
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
}
})"));
@ -843,8 +843,8 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) {
not
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}
@ -905,8 +905,8 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) {
not
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}

View File

@ -110,7 +110,7 @@ Return{})"));
EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(p->builder(), fe.ast_body()), HasSubstr(R"(Return{
{
ScalarConstructor[not set]{42}
ScalarConstructor[not set]{42u}
}
})"));
}
@ -180,7 +180,7 @@ Return{})"));
EXPECT_TRUE(fe.EmitBody()) << p->error();
EXPECT_THAT(ToString(p->builder(), fe.ast_body()), HasSubstr(R"(Return{
{
ScalarConstructor[not set]{42}
ScalarConstructor[not set]{42u}
}
})"));
}
@ -249,8 +249,8 @@ TEST_F(SpvParserTest, EmitStatement_CallWithParams) {
Call[not set]{
Identifier[not set]{x_50}
(
ScalarConstructor[not set]{42}
ScalarConstructor[not set]{84}
ScalarConstructor[not set]{42u}
ScalarConstructor[not set]{84u}
)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -96,8 +96,8 @@ TEST_F(SpvParserTest_Composite_Construct, Vector) {
{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}
@ -192,11 +192,11 @@ TEST_F(SpvParserTest_Composite_Construct, Array) {
{
TypeConstructor[not set]{
__array__u32_5
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{3}
ScalarConstructor[not set]{4}
ScalarConstructor[not set]{5}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
ScalarConstructor[not set]{3u}
ScalarConstructor[not set]{4u}
ScalarConstructor[not set]{5u}
}
}
})"));
@ -227,7 +227,7 @@ TEST_F(SpvParserTest_Composite_Construct, Struct) {
ScalarConstructor[not set]{50.000000}
ScalarConstructor[not set]{60.000000}
}
ScalarConstructor[not set]{5}
ScalarConstructor[not set]{5u}
ScalarConstructor[not set]{30}
}
}
@ -306,7 +306,7 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix) {
{
ArrayAccessor[not set]{
Identifier[not set]{x_1}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{2u}
}
}
})"));
@ -357,7 +357,7 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix_Vector) {
MemberAccessor[not set]{
ArrayAccessor[not set]{
Identifier[not set]{x_1}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{2u}
}
Identifier[not set]{y}
}
@ -389,7 +389,7 @@ TEST_F(SpvParserTest_CompositeExtract, Array) {
{
ArrayAccessor[not set]{
Identifier[not set]{x_1}
ScalarConstructor[not set]{3}
ScalarConstructor[not set]{3u}
}
}
})"));
@ -553,9 +553,9 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_Array_Matrix_Vector) {
Identifier[not set]{x_1}
Identifier[not set]{field1}
}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{2u}
}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
Identifier[not set]{y}
}
@ -657,7 +657,7 @@ TEST_F(SpvParserTest_CompositeInsert, Matrix) {
Assignment{
ArrayAccessor[not set]{
Identifier[not set]{x_2_1}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{2u}
}
TypeConstructor[not set]{
__vec_2__f32
@ -727,7 +727,7 @@ TEST_F(SpvParserTest_CompositeInsert, Matrix_Vector) {
Assignment{
ArrayAccessor[not set]{
Identifier[not set]{x_2_1}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{2u}
}
TypeConstructor[not set]{
__vec_2__f32
@ -777,9 +777,9 @@ TEST_F(SpvParserTest_CompositeInsert, Array) {
Assignment{
ArrayAccessor[not set]{
Identifier[not set]{x_2_1}
ScalarConstructor[not set]{3}
ScalarConstructor[not set]{3u}
}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{20u}
}
VariableDeclStatement{
VariableConst{
@ -903,7 +903,7 @@ Assignment{
Identifier[not set]{x_2_1}
Identifier[not set]{algo}
}
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
VariableDeclStatement{
VariableConst{
@ -931,7 +931,7 @@ Assignment{
Identifier[not set]{x_4_1}
Identifier[not set]{rithm}
}
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
}
VariableDeclStatement{
VariableConst{
@ -1002,9 +1002,9 @@ Assignment{
Identifier[not set]{x_2_1}
Identifier[not set]{field1}
}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{2u}
}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
Identifier[not set]{y}
}
@ -1044,7 +1044,7 @@ TEST_F(SpvParserTest_CopyObject, Scalar) {
none
__u32
{
ScalarConstructor[not set]{3}
ScalarConstructor[not set]{3u}
}
}
}
@ -1169,32 +1169,32 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_UseBoth) {
MemberAccessor[not set]{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{4}
ScalarConstructor[not set]{3}
ScalarConstructor[not set]{4u}
ScalarConstructor[not set]{3u}
}
Identifier[not set]{y}
}
MemberAccessor[not set]{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{4}
ScalarConstructor[not set]{3}
ScalarConstructor[not set]{4u}
ScalarConstructor[not set]{3u}
}
Identifier[not set]{x}
}
MemberAccessor[not set]{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{3}
ScalarConstructor[not set]{4}
ScalarConstructor[not set]{3u}
ScalarConstructor[not set]{4u}
}
Identifier[not set]{y}
}
MemberAccessor[not set]{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{3}
ScalarConstructor[not set]{4}
ScalarConstructor[not set]{3u}
ScalarConstructor[not set]{4u}
}
Identifier[not set]{x}
}
@ -1224,7 +1224,7 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_AllOnesMapToNull) {
{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
MemberAccessor[not set]{
Identifier[not set]{x_1}
Identifier[not set]{y}

View File

@ -112,8 +112,8 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Vector) {
Bitcast[not set]<__vec_2__f32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
}
}

View File

@ -83,42 +83,42 @@ std::string AstFor(std::string assembly) {
if (assembly == "v2uint_10_20") {
return R"(TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
})";
}
if (assembly == "cast_uint_10") {
return R"(Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
})";
}
if (assembly == "cast_uint_20") {
return R"(Bitcast[not set]<__i32>{
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{20u}
})";
}
if (assembly == "cast_v2uint_10_20") {
return R"(Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
})";
}
if (assembly == "v2uint_20_10") {
return R"(TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20u}
ScalarConstructor[not set]{10u}
})";
}
if (assembly == "cast_v2uint_20_10") {
return R"(Bitcast[not set]<__vec_2__i32>{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20u}
ScalarConstructor[not set]{10u}
}
})";
}
@ -300,15 +300,15 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// uint uint
BinaryData{"bool", "uint_10", "OpIEqual", "uint_20", "__bool",
"ScalarConstructor[not set]{10}", "equal",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "equal",
"ScalarConstructor[not set]{20u}"},
// int int
BinaryData{"bool", "int_30", "OpIEqual", "int_40", "__bool",
"ScalarConstructor[not set]{30}", "equal",
"ScalarConstructor[not set]{40}"},
// uint int
BinaryData{"bool", "uint_10", "OpIEqual", "int_40", "__bool",
"ScalarConstructor[not set]{10}", "equal",
"ScalarConstructor[not set]{10u}", "equal",
R"(Bitcast[not set]<__u32>{
ScalarConstructor[not set]{40}
})"},
@ -316,7 +316,7 @@ INSTANTIATE_TEST_SUITE_P(
BinaryData{"bool", "int_40", "OpIEqual", "uint_10", "__bool",
"ScalarConstructor[not set]{40}", "equal",
R"(Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
})"},
// v2uint v2uint
BinaryData{"v2bool", "v2uint_10_20", "OpIEqual", "v2uint_20_10",
@ -344,15 +344,15 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both uint
BinaryData{"bool", "uint_10", "OpINotEqual", "uint_20", "__bool",
"ScalarConstructor[not set]{10}", "not_equal",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "not_equal",
"ScalarConstructor[not set]{20u}"},
// Both int
BinaryData{"bool", "int_30", "OpINotEqual", "int_40", "__bool",
"ScalarConstructor[not set]{30}", "not_equal",
"ScalarConstructor[not set]{40}"},
// uint int
BinaryData{"bool", "uint_10", "OpINotEqual", "int_40", "__bool",
"ScalarConstructor[not set]{10}", "not_equal",
"ScalarConstructor[not set]{10u}", "not_equal",
R"(Bitcast[not set]<__u32>{
ScalarConstructor[not set]{40}
})"},
@ -360,7 +360,7 @@ INSTANTIATE_TEST_SUITE_P(
BinaryData{"bool", "int_40", "OpINotEqual", "uint_10", "__bool",
"ScalarConstructor[not set]{40}", "not_equal",
R"(Bitcast[not set]<__i32>{
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{10u}
})"},
// Both v2uint
BinaryData{"v2bool", "v2uint_10_20", "OpINotEqual", "v2uint_20_10",
@ -480,15 +480,15 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both unsigned
BinaryData{"bool", "uint_10", "OpUGreaterThan", "uint_20", "__bool",
"ScalarConstructor[not set]{10}", "greater_than",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "greater_than",
"ScalarConstructor[not set]{20u}"},
// First arg signed
BinaryData{"bool", "int_30", "OpUGreaterThan", "uint_20", "__bool",
AstFor("cast_int_30"), "greater_than",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{20u}"},
// Second arg signed
BinaryData{"bool", "uint_10", "OpUGreaterThan", "int_40", "__bool",
"ScalarConstructor[not set]{10}", "greater_than",
"ScalarConstructor[not set]{10u}", "greater_than",
AstFor("cast_int_40")},
// Vector, both unsigned
BinaryData{"v2bool", "v2uint_10_20", "OpUGreaterThan", "v2uint_20_10",
@ -509,15 +509,15 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both unsigned
BinaryData{"bool", "uint_10", "OpUGreaterThanEqual", "uint_20",
"__bool", "ScalarConstructor[not set]{10}",
"greater_than_equal", "ScalarConstructor[not set]{20}"},
"__bool", "ScalarConstructor[not set]{10u}",
"greater_than_equal", "ScalarConstructor[not set]{20u}"},
// First arg signed
BinaryData{"bool", "int_30", "OpUGreaterThanEqual", "uint_20", "__bool",
AstFor("cast_int_30"), "greater_than_equal",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{20u}"},
// Second arg signed
BinaryData{"bool", "uint_10", "OpUGreaterThanEqual", "int_40", "__bool",
"ScalarConstructor[not set]{10}", "greater_than_equal",
"ScalarConstructor[not set]{10u}", "greater_than_equal",
AstFor("cast_int_40")},
// Vector, both unsigned
BinaryData{"v2bool", "v2uint_10_20", "OpUGreaterThanEqual",
@ -538,15 +538,15 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both unsigned
BinaryData{"bool", "uint_10", "OpULessThan", "uint_20", "__bool",
"ScalarConstructor[not set]{10}", "less_than",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "less_than",
"ScalarConstructor[not set]{20u}"},
// First arg signed
BinaryData{"bool", "int_30", "OpULessThan", "uint_20", "__bool",
AstFor("cast_int_30"), "less_than",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{20u}"},
// Second arg signed
BinaryData{"bool", "uint_10", "OpULessThan", "int_40", "__bool",
"ScalarConstructor[not set]{10}", "less_than",
"ScalarConstructor[not set]{10u}", "less_than",
AstFor("cast_int_40")},
// Vector, both unsigned
BinaryData{"v2bool", "v2uint_10_20", "OpULessThan", "v2uint_20_10",
@ -567,15 +567,15 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
// Both unsigned
BinaryData{"bool", "uint_10", "OpULessThanEqual", "uint_20", "__bool",
"ScalarConstructor[not set]{10}", "less_than_equal",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{10u}", "less_than_equal",
"ScalarConstructor[not set]{20u}"},
// First arg signed
BinaryData{"bool", "int_30", "OpULessThanEqual", "uint_20", "__bool",
AstFor("cast_int_30"), "less_than_equal",
"ScalarConstructor[not set]{20}"},
"ScalarConstructor[not set]{20u}"},
// Second arg signed
BinaryData{"bool", "uint_10", "OpULessThanEqual", "int_40", "__bool",
"ScalarConstructor[not set]{10}", "less_than_equal",
"ScalarConstructor[not set]{10u}", "less_than_equal",
AstFor("cast_int_40")},
// Vector, both unsigned
BinaryData{"v2bool", "v2uint_10_20", "OpULessThanEqual", "v2uint_20_10",
@ -1170,8 +1170,8 @@ TEST_F(SpvFUnordTest, Select_BoolCond_IntScalarParams) {
Call[not set]{
Identifier[not set]{select}
(
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
ScalarConstructor[not set]{true}
)
}
@ -1236,13 +1236,13 @@ TEST_F(SpvFUnordTest, Select_BoolCond_VectorParams) {
(
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20u}
ScalarConstructor[not set]{10u}
}
ScalarConstructor[not set]{true}
)
@ -1276,13 +1276,13 @@ TEST_F(SpvFUnordTest, Select_VecBoolCond_VectorParams) {
(
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10u}
ScalarConstructor[not set]{20u}
}
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{20}
ScalarConstructor[not set]{10}
ScalarConstructor[not set]{20u}
ScalarConstructor[not set]{10u}
}
TypeConstructor[not set]{
__vec_2__bool

View File

@ -80,11 +80,11 @@ TEST_F(SpvParserTest, EmitStatement_StoreUintConst) {
EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(p->builder(), fe.ast_body()), HasSubstr(R"(Assignment{
Identifier[not set]{x_1}
ScalarConstructor[not set]{42}
ScalarConstructor[not set]{42u}
}
Assignment{
Identifier[not set]{x_1}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
})"));
}
@ -274,7 +274,7 @@ TEST_F(SpvParserTest, EmitStatement_StoreToModuleScopeVar) {
EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(p->builder(), fe.ast_body()), HasSubstr(R"(Assignment{
Identifier[not set]{x_1}
ScalarConstructor[not set]{42}
ScalarConstructor[not set]{42u}
})"));
}
@ -344,7 +344,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorSwizzle) {
Identifier[not set]{myvar}
Identifier[not set]{z}
}
ScalarConstructor[not set]{42}
ScalarConstructor[not set]{42u}
})"));
}
@ -407,7 +407,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorNonConstIndex) {
Identifier[not set]{myvar}
Identifier[not set]{x_11}
}
ScalarConstructor[not set]{42}
ScalarConstructor[not set]{42u}
})"));
}
@ -442,7 +442,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Matrix) {
EXPECT_THAT(ToString(p->builder(), fe.ast_body()), HasSubstr(R"(Assignment{
ArrayAccessor[not set]{
Identifier[not set]{myvar}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{2u}
}
TypeConstructor[not set]{
__vec_4__f32
@ -485,7 +485,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Array) {
EXPECT_THAT(ToString(p->builder(), fe.ast_body()), HasSubstr(R"(Assignment{
ArrayAccessor[not set]{
Identifier[not set]{myvar}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{2u}
}
TypeConstructor[not set]{
__vec_4__f32
@ -688,7 +688,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Struct_RuntimeArray) {
Identifier[not set]{myvar}
Identifier[not set]{age}
}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{2u}
}
ScalarConstructor[not set]{42.000000}
})"));
@ -726,7 +726,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Compound_Matrix_Vector) {
MemberAccessor[not set]{
ArrayAccessor[not set]{
Identifier[not set]{myvar}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{2u}
}
Identifier[not set]{w}
}
@ -836,7 +836,7 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughAccessChain_NonCascaded) {
Identifier[not set]{myvar}
Identifier[not set]{field0}
}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
Assignment{
ArrayAccessor[not set]{
@ -844,9 +844,9 @@ Assignment{
Identifier[not set]{myvar}
Identifier[not set]{field1}
}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
})"));
}
@ -878,7 +878,7 @@ TEST_F(SpvParserTest,
Identifier[not set]{myvar}
Identifier[not set]{field0}
}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
Assignment{
ArrayAccessor[not set]{
@ -886,9 +886,9 @@ Assignment{
Identifier[not set]{myvar}
Identifier[not set]{field1}
}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
})")) << got
<< p->error();
}
@ -918,9 +918,9 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughAccessChain_Cascaded) {
Identifier[not set]{myvar}
Identifier[not set]{field1}
}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
})")) << p->error();
}
@ -956,14 +956,14 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithoutHoisting) {
Identifier[not set]{myvar}
Identifier[not set]{field1}
}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
}
Assignment{
Identifier[not set]{x_2}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
})")) << p->error();
}
@ -999,8 +999,8 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithHoisting) {
ASSERT_TRUE(p->BuildAndParseInternalModule()) << assembly << p->error();
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
EXPECT_TRUE(fe.EmitBody()) << p->error();
EXPECT_THAT(ToString(p->builder(), fe.ast_body()),
Eq(R"(VariableDeclStatement{
EXPECT_EQ(ToString(p->builder(), fe.ast_body()),
R"(VariableDeclStatement{
Variable{
x_2
function
@ -1019,7 +1019,7 @@ If{
Identifier[not set]{myvar}
Identifier[not set]{field1}
}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
@ -1031,10 +1031,10 @@ Else{
}
Assignment{
Identifier[not set]{x_2}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
Return{}
)")) << p->error();
)") << p->error();
}
TEST_F(SpvParserTest, DISABLED_RemapStorageBuffer_ThroughFunctionCall) {

View File

@ -81,7 +81,7 @@ VariableDeclStatement{
none
__u32
{
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
}
}
@ -151,8 +151,8 @@ VariableDeclStatement{
{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
}
@ -224,7 +224,7 @@ VariableDeclStatement{
none
__u32
{
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
}
}
@ -277,8 +277,8 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Vector) {
{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
}
@ -380,8 +380,8 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) {
{
TypeConstructor[not set]{
__array__u32_2
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
}
@ -414,7 +414,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) {
TypeConstructor[not set]{
__struct_S
ScalarConstructor[not set]{false}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0.000000}
}

View File

@ -244,7 +244,7 @@ VariableDeclStatement{
function
__u32
{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
@ -308,7 +308,7 @@ VariableDeclStatement{
function
__u32
{
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
}
}
@ -436,8 +436,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer) {
{
TypeConstructor[not set]{
__array__u32_2
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{1u}
ScalarConstructor[not set]{2u}
}
}
}
@ -471,8 +471,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Alias) {
{
TypeConstructor[not set]{
__alias_Arr__array__u32_2_stride_16
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{1u}
ScalarConstructor[not set]{2u}
}
}
}
@ -506,8 +506,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Null) {
{
TypeConstructor[not set]{
__array__u32_2
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
}
@ -541,8 +541,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Alias_Null) {
{
TypeConstructor[not set]{
__alias_Arr__array__u32_2_stride_16
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
}
@ -576,12 +576,12 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer) {
{
TypeConstructor[not set]{
__struct_S
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
ScalarConstructor[not set]{1.500000}
TypeConstructor[not set]{
__array__u32_2
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{1u}
ScalarConstructor[not set]{2u}
}
}
}
@ -616,12 +616,12 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer_Null) {
{
TypeConstructor[not set]{
__struct_S
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0.000000}
TypeConstructor[not set]{
__array__u32_2
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
}
@ -663,14 +663,14 @@ TEST_F(SpvParserTest,
}
Assignment{
Identifier[not set]{x_25}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
Assignment{
Identifier[not set]{x_25}
Binary[not set]{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
add
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
Return{}
@ -715,16 +715,16 @@ VariableDeclStatement{
__u32
{
Binary[not set]{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
add
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
}
Assignment{
Identifier[not set]{x_25}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
Assignment{
Identifier[not set]{x_25}
@ -787,16 +787,16 @@ VariableDeclStatement{
__u32
{
Binary[not set]{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
add
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
}
Assignment{
Identifier[not set]{x_25}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
Loop{
continuing {
@ -808,7 +808,7 @@ Loop{
}
Assignment{
Identifier[not set]{x_25}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{2u}
}
Return{}
)";
@ -874,7 +874,7 @@ TEST_F(
auto got = ToString(p->builder(), fe.ast_body());
auto* expect = R"(Assignment{
Identifier[not set]{x_1}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
Loop{
VariableDeclStatement{
@ -886,7 +886,7 @@ Loop{
}
Assignment{
Identifier[not set]{x_1}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
If{
(
@ -898,7 +898,7 @@ Loop{
}
Assignment{
Identifier[not set]{x_1}
ScalarConstructor[not set]{3}
ScalarConstructor[not set]{3u}
}
If{
(
@ -908,9 +908,9 @@ Loop{
Assignment{
Identifier[not set]{x_2}
Binary[not set]{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
add
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
@ -927,7 +927,7 @@ Loop{
continuing {
Assignment{
Identifier[not set]{x_1}
ScalarConstructor[not set]{4}
ScalarConstructor[not set]{4u}
}
If{
(
@ -941,7 +941,7 @@ Loop{
}
Assignment{
Identifier[not set]{x_1}
ScalarConstructor[not set]{5}
ScalarConstructor[not set]{5u}
}
Return{}
)";
@ -996,7 +996,7 @@ TEST_F(
none
__u32
{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
@ -1086,7 +1086,7 @@ TEST_F(SpvParserTest,
none
__u32
{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
@ -1173,14 +1173,14 @@ TEST_F(
none
__u32
{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
Switch{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
{
Case 0{
Case 0u{
}
Default{
}
@ -1251,7 +1251,7 @@ TEST_F(SpvParserTest,
none
__u32
{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
@ -1356,11 +1356,11 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) {
}
Assignment{
Identifier[not set]{x_2_phi}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
Assignment{
Identifier[not set]{x_3_phi}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
If{
(
@ -1396,7 +1396,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) {
Binary[not set]{
Identifier[not set]{x_2}
add
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
Assignment{
@ -1500,11 +1500,11 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) {
}
Assignment{
Identifier[not set]{x_2_phi}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
Assignment{
Identifier[not set]{x_3_phi}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
If{
(
@ -1556,7 +1556,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) {
Binary[not set]{
Identifier[not set]{x_2}
add
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
Assignment{
@ -1648,11 +1648,11 @@ Loop{
}
Assignment{
Identifier[not set]{x_2_phi}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
Assignment{
Identifier[not set]{x_5_phi}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
Loop{
VariableDeclStatement{
@ -1691,7 +1691,7 @@ Loop{
Binary[not set]{
Identifier[not set]{x_2}
add
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
@ -1705,7 +1705,7 @@ Loop{
Binary[not set]{
Identifier[not set]{x_4}
add
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
@ -1833,7 +1833,7 @@ Loop{
{
Assignment{
Identifier[not set]{x_2_phi}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
Continue{}
}
@ -1842,7 +1842,7 @@ Loop{
{
Assignment{
Identifier[not set]{x_2_phi}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
@ -1950,7 +1950,7 @@ Loop{
}
Assignment{
Identifier[not set]{x_2_phi}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
If{
(
@ -1959,7 +1959,7 @@ Loop{
{
Assignment{
Identifier[not set]{x_2_phi}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}
@ -2044,15 +2044,15 @@ TEST_F(SpvParserTest,
}
}
Switch{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
{
Default{
Fallthrough{}
}
Case 0{
Case 0u{
Fallthrough{}
}
Case 1{
Case 1u{
If{
(
ScalarConstructor[not set]{true}
@ -2064,14 +2064,14 @@ Switch{
{
Assignment{
Identifier[not set]{x_35_phi}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
Break{}
}
}
Assignment{
Identifier[not set]{x_35_phi}
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
}

View File

@ -209,7 +209,7 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) {
{
Return{
{
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
}
}

View File

@ -890,7 +890,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarInitializers) {
private
__u32
{
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
}
}
Variable{
@ -939,7 +939,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarNullInitializers) {
private
__u32
{
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
}
Variable{
@ -988,7 +988,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarUndefInitializers) {
private
__u32
{
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
}
}
Variable{
@ -1087,8 +1087,8 @@ TEST_F(SpvModuleScopeVarParserTest, VectorUintNullInitializer) {
{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
})"));
@ -1110,8 +1110,8 @@ TEST_F(SpvModuleScopeVarParserTest, VectorUintUndefInitializer) {
{
TypeConstructor[not set]{
__vec_2__u32
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
})"));
@ -1340,8 +1340,8 @@ TEST_F(SpvModuleScopeVarParserTest, ArrayInitializer) {
{
TypeConstructor[not set]{
__array__u32_2
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{1u}
ScalarConstructor[not set]{2u}
}
}
})"));
@ -1363,8 +1363,8 @@ TEST_F(SpvModuleScopeVarParserTest, ArrayNullInitializer) {
{
TypeConstructor[not set]{
__array__u32_2
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
})"));
@ -1386,8 +1386,8 @@ TEST_F(SpvModuleScopeVarParserTest, ArrayUndefInitializer) {
{
TypeConstructor[not set]{
__array__u32_2
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
})"));
@ -1411,12 +1411,12 @@ TEST_F(SpvModuleScopeVarParserTest, StructInitializer) {
{
TypeConstructor[not set]{
__struct_S
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{1u}
ScalarConstructor[not set]{1.500000}
TypeConstructor[not set]{
__array__u32_2
ScalarConstructor[not set]{1}
ScalarConstructor[not set]{2}
ScalarConstructor[not set]{1u}
ScalarConstructor[not set]{2u}
}
}
}
@ -1440,12 +1440,12 @@ TEST_F(SpvModuleScopeVarParserTest, StructNullInitializer) {
{
TypeConstructor[not set]{
__struct_S
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0.000000}
TypeConstructor[not set]{
__array__u32_2
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
}
@ -1469,12 +1469,12 @@ TEST_F(SpvModuleScopeVarParserTest, StructUndefInitializer) {
{
TypeConstructor[not set]{
__struct_S
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0.000000}
TypeConstructor[not set]{
__array__u32_2
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
ScalarConstructor[not set]{0u}
}
}
}
@ -1906,7 +1906,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_DeclareConst_U32) {
none
__u32
{
ScalarConstructor[not set]{42}
ScalarConstructor[not set]{42u}
}
}
})")) << module_str;
@ -2762,7 +2762,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_Out_U32_Direct) {
EXPECT_THAT(module_str, HasSubstr(R"(
Assignment{
Identifier[not set]{x_1}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
})"))
<< module_str;
}
@ -2798,7 +2798,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_Out_U32_CopyObject) {
EXPECT_THAT(module_str, HasSubstr(R"(
Assignment{
Identifier[not set]{x_1}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
})"))
<< module_str;
}
@ -2834,7 +2834,7 @@ TEST_F(SpvModuleScopeVarParserTest, SampleMask_Out_U32_AccessChain) {
EXPECT_THAT(module_str, HasSubstr(R"(
Assignment{
Identifier[not set]{x_1}
ScalarConstructor[not set]{0}
ScalarConstructor[not set]{0u}
})"))
<< module_str;
}

View File

@ -213,10 +213,9 @@ TEST_F(ResolverControlBlockValidationTest,
WrapInFunction(block);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(
r()->error(),
"12:34 error v-0027: a literal value must not appear more than once "
"in the case selectors for a switch statement: '2'");
EXPECT_EQ(r()->error(),
"12:34 error v-0027: a literal value must not appear more than "
"once in the case selectors for a switch statement: '2u'");
}
TEST_F(ResolverControlBlockValidationTest,