From 627732c40839bb9de6c6cc06f5391cda45107c74 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Wed, 18 Nov 2020 19:40:00 +0000 Subject: [PATCH] src/reader tests: Have parse() return a unique_ptr The reason being that some tests called parse() twice, which will silently destruct the first parser. Once the `Module` owns the AST nodes, the second call will end up deleting all the AST nodes. Tests would then perform use-after-free for the AST nodes belonging to the first parser / module. There's no reason why the unique_ptr can't be returned, which is cleaner overall. Bug: tint:335 Change-Id: I7ff2e9777a7ebeb76702f806294fe4c2c49bd7c9 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33241 Auto-Submit: Ben Clayton Reviewed-by: dan sinclair Commit-Queue: dan sinclair --- src/reader/spirv/function_arithmetic_test.cc | 88 +- src/reader/spirv/function_bit_test.cc | 36 +- src/reader/spirv/function_call_test.cc | 16 +- src/reader/spirv/function_cfg_test.cc | 1270 ++++++++--------- src/reader/spirv/function_composite_test.cc | 84 +- src/reader/spirv/function_conversion_test.cc | 120 +- src/reader/spirv/function_decl_test.cc | 16 +- .../spirv/function_glsl_std_450_test.cc | 40 +- src/reader/spirv/function_logical_test.cc | 104 +- src/reader/spirv/function_memory_test.cc | 100 +- src/reader/spirv/function_misc_test.cc | 24 +- src/reader/spirv/function_var_test.cc | 108 +- ...ser_impl_convert_member_decoration_test.cc | 10 +- .../spirv/parser_impl_convert_type_test.cc | 98 +- .../spirv/parser_impl_function_decl_test.cc | 24 +- .../spirv/parser_impl_get_decorations_test.cc | 18 +- src/reader/spirv/parser_impl_handle_test.cc | 46 +- src/reader/spirv/parser_impl_import_test.cc | 4 +- .../spirv/parser_impl_module_var_test.cc | 120 +- .../spirv/parser_impl_named_types_test.cc | 16 +- src/reader/spirv/parser_impl_test.cc | 18 +- src/reader/spirv/parser_impl_test_helper.h | 17 +- .../spirv/parser_impl_user_name_test.cc | 14 +- .../parser_impl_additive_expression_test.cc | 10 +- .../wgsl/parser_impl_and_expression_test.cc | 8 +- ...rser_impl_argument_expression_list_test.cc | 8 +- .../wgsl/parser_impl_assignment_stmt_test.cc | 10 +- src/reader/wgsl/parser_impl_body_stmt_test.cc | 8 +- .../wgsl/parser_impl_break_stmt_test.cc | 2 +- src/reader/wgsl/parser_impl_call_stmt_test.cc | 10 +- src/reader/wgsl/parser_impl_case_body_test.cc | 10 +- .../wgsl/parser_impl_const_expr_test.cc | 20 +- .../wgsl/parser_impl_const_literal_test.cc | 14 +- .../wgsl/parser_impl_continue_stmt_test.cc | 2 +- .../wgsl/parser_impl_continuing_stmt_test.cc | 4 +- .../parser_impl_depth_texture_type_test.cc | 10 +- src/reader/wgsl/parser_impl_else_stmt_test.cc | 6 +- .../wgsl/parser_impl_elseif_stmt_test.cc | 8 +- .../parser_impl_equality_expression_test.cc | 10 +- src/reader/wgsl/parser_impl_error_msg_test.cc | 2 +- .../wgsl/parser_impl_error_resync_test.cc | 2 +- ...arser_impl_exclusive_or_expression_test.cc | 8 +- src/reader/wgsl/parser_impl_for_stmt_test.cc | 6 +- .../wgsl/parser_impl_function_decl_test.cc | 14 +- ...rser_impl_function_decoration_list_test.cc | 14 +- .../parser_impl_function_decoration_test.cc | 46 +- .../wgsl/parser_impl_function_header_test.cc | 18 +- .../parser_impl_function_type_decl_test.cc | 6 +- .../parser_impl_global_constant_decl_test.cc | 10 +- .../wgsl/parser_impl_global_decl_test.cc | 38 +- .../parser_impl_global_variable_decl_test.cc | 14 +- src/reader/wgsl/parser_impl_if_stmt_test.cc | 17 +- .../parser_impl_image_storage_type_test.cc | 72 +- ...arser_impl_inclusive_or_expression_test.cc | 8 +- ...parser_impl_logical_and_expression_test.cc | 8 +- .../parser_impl_logical_or_expression_test.cc | 8 +- src/reader/wgsl/parser_impl_loop_stmt_test.cc | 16 +- ...ser_impl_multiplicative_expression_test.cc | 12 +- .../wgsl/parser_impl_param_list_test.cc | 8 +- .../wgsl/parser_impl_paren_rhs_stmt_test.cc | 10 +- .../wgsl/parser_impl_pipeline_stage_test.cc | 4 +- .../parser_impl_postfix_expression_test.cc | 28 +- .../parser_impl_primary_expression_test.cc | 42 +- .../parser_impl_relational_expression_test.cc | 14 +- .../parser_impl_sampled_texture_type_test.cc | 30 +- .../wgsl/parser_impl_sampler_type_test.cc | 6 +- .../wgsl/parser_impl_shift_expression_test.cc | 10 +- src/reader/wgsl/parser_impl_statement_test.cc | 52 +- .../wgsl/parser_impl_statements_test.cc | 4 +- .../wgsl/parser_impl_storage_class_test.cc | 4 +- .../parser_impl_storage_texture_type_test.cc | 42 +- .../wgsl/parser_impl_struct_body_decl_test.cc | 10 +- .../wgsl/parser_impl_struct_decl_test.cc | 18 +- ...parser_impl_struct_decoration_decl_test.cc | 6 +- .../parser_impl_struct_decoration_test.cc | 4 +- ...impl_struct_member_decoration_decl_test.cc | 10 +- ...rser_impl_struct_member_decoration_test.cc | 10 +- .../wgsl/parser_impl_struct_member_test.cc | 12 +- .../wgsl/parser_impl_switch_body_test.cc | 26 +- .../wgsl/parser_impl_switch_stmt_test.cc | 16 +- src/reader/wgsl/parser_impl_test.cc | 10 +- src/reader/wgsl/parser_impl_test_helper.cc | 9 - src/reader/wgsl/parser_impl_test_helper.h | 30 +- .../parser_impl_texture_sampler_types_test.cc | 70 +- .../wgsl/parser_impl_type_alias_test.cc | 12 +- src/reader/wgsl/parser_impl_type_decl_test.cc | 102 +- .../wgsl/parser_impl_unary_expression_test.cc | 10 +- .../wgsl/parser_impl_variable_decl_test.cc | 10 +- ...rser_impl_variable_decoration_list_test.cc | 14 +- .../parser_impl_variable_decoration_test.cc | 42 +- .../parser_impl_variable_ident_decl_test.cc | 12 +- .../wgsl/parser_impl_variable_stmt_test.cc | 18 +- ...r_impl_variable_storage_decoration_test.cc | 10 +- 93 files changed, 1766 insertions(+), 1799 deletions(-) diff --git a/src/reader/spirv/function_arithmetic_test.cc b/src/reader/spirv/function_arithmetic_test.cc index 52b93e18aa..415e0b17a8 100644 --- a/src/reader/spirv/function_arithmetic_test.cc +++ b/src/reader/spirv/function_arithmetic_test.cc @@ -131,9 +131,9 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Int) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -158,9 +158,9 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -187,9 +187,9 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Int) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -216,9 +216,9 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -247,9 +247,9 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_SignedVec) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -278,9 +278,9 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -311,9 +311,9 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_SignedVec) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -344,9 +344,9 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -379,9 +379,9 @@ TEST_F(SpvUnaryArithTest, FNegate_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -406,9 +406,9 @@ TEST_F(SpvUnaryArithTest, FNegate_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -460,11 +460,11 @@ TEST_P(SpvBinaryArithTest, EmitExpression) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); std::ostringstream ss; ss << R"(VariableConst{ @@ -690,11 +690,11 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Scalar_UnsignedResult) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -725,11 +725,11 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Vector_UnsignedResult) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -836,11 +836,11 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Scalar_UnsignedResult) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -871,11 +871,11 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Vector_UnsignedResult) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -926,9 +926,9 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesScalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 @@ -955,9 +955,9 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesScalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 @@ -984,9 +984,9 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesMatrix) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 @@ -1013,9 +1013,9 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesVector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 @@ -1042,9 +1042,9 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesMatrix) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 @@ -1071,9 +1071,9 @@ TEST_F(SpvBinaryArithTestBasic, Dot) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_3 @@ -1102,9 +1102,9 @@ TEST_F(SpvBinaryArithTestBasic, OuterProduct) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_3 diff --git a/src/reader/spirv/function_bit_test.cc b/src/reader/spirv/function_bit_test.cc index d34b9634c4..3a03837368 100644 --- a/src/reader/spirv/function_bit_test.cc +++ b/src/reader/spirv/function_bit_test.cc @@ -149,11 +149,11 @@ TEST_P(SpvBinaryBitTest, EmitExpression) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); std::ostringstream ss; ss << R"(VariableConst{ @@ -396,9 +396,9 @@ TEST_F(SpvUnaryBitTest, Not_Int_Int) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -423,9 +423,9 @@ TEST_F(SpvUnaryBitTest, Not_Int_Uint) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -452,9 +452,9 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Int) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -481,9 +481,9 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Uint) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -508,9 +508,9 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_SignedVec) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -539,9 +539,9 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -572,9 +572,9 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_SignedVec) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -604,9 +604,9 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ diff --git a/src/reader/spirv/function_call_test.cc b/src/reader/spirv/function_call_test.cc index 2686ab57a9..a30ec374b8 100644 --- a/src/reader/spirv/function_call_test.cc +++ b/src/reader/spirv/function_call_test.cc @@ -30,7 +30,7 @@ using ::testing::Eq; using ::testing::HasSubstr; TEST_F(SpvParserTest, EmitStatement_VoidCallNoParams) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void @@ -68,7 +68,7 @@ TEST_F(SpvParserTest, EmitStatement_VoidCallNoParams) { } TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParams) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %uint = OpTypeInt 32 0 @@ -88,7 +88,7 @@ TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParams) { )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); { - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -109,7 +109,7 @@ Return{})")) } { - FunctionEmitter fe(p, *spirv_function(50)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 50)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Return{ { @@ -120,7 +120,7 @@ Return{})")) } TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParamsUsedTwice) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %uint = OpTypeInt 32 0 @@ -144,7 +144,7 @@ TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParamsUsedTwice) { )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); { - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ Variable{ @@ -179,7 +179,7 @@ Return{})")) << ToString(fe.ast_body()); } { - FunctionEmitter fe(p, *spirv_function(50)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 50)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Return{ { @@ -190,7 +190,7 @@ Return{})")) } TEST_F(SpvParserTest, EmitStatement_CallWithParams) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %uint = OpTypeInt 32 0 diff --git a/src/reader/spirv/function_cfg_test.cc b/src/reader/spirv/function_cfg_test.cc index af2553c0bf..03b7f11a53 100644 --- a/src/reader/spirv/function_cfg_test.cc +++ b/src/reader/spirv/function_cfg_test.cc @@ -123,7 +123,7 @@ bool FlowFindIfSelectionInternalHeaders(FunctionEmitter* fe) { } TEST_F(SpvParserTest, TerminatorsAreValid_SingleBlock) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %42 = OpLabel @@ -132,13 +132,13 @@ TEST_F(SpvParserTest, TerminatorsAreValid_SingleBlock) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.TerminatorsAreValid()); } TEST_F(SpvParserTest, TerminatorsAreValid_Sequence) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %20 = OpLabel @@ -150,13 +150,13 @@ TEST_F(SpvParserTest, TerminatorsAreValid_Sequence) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.TerminatorsAreValid()) << p->error(); } TEST_F(SpvParserTest, TerminatorsAreValid_If) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %20 = OpLabel @@ -175,13 +175,13 @@ TEST_F(SpvParserTest, TerminatorsAreValid_If) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.TerminatorsAreValid()) << p->error(); } TEST_F(SpvParserTest, TerminatorsAreValid_Switch) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -203,13 +203,13 @@ TEST_F(SpvParserTest, TerminatorsAreValid_Switch) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.TerminatorsAreValid()); } TEST_F(SpvParserTest, TerminatorsAreValid_Loop_SingleBlock) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -225,13 +225,13 @@ TEST_F(SpvParserTest, TerminatorsAreValid_Loop_SingleBlock) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.TerminatorsAreValid()); } TEST_F(SpvParserTest, TerminatorsAreValid_Loop_Simple) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -253,13 +253,13 @@ TEST_F(SpvParserTest, TerminatorsAreValid_Loop_Simple) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.TerminatorsAreValid()); } TEST_F(SpvParserTest, TerminatorsAreValid_Kill) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -268,13 +268,13 @@ TEST_F(SpvParserTest, TerminatorsAreValid_Kill) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.TerminatorsAreValid()); } TEST_F(SpvParserTest, TerminatorsAreValid_Unreachable) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -283,13 +283,13 @@ TEST_F(SpvParserTest, TerminatorsAreValid_Unreachable) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.TerminatorsAreValid()); } TEST_F(SpvParserTest, TerminatorsAreValid_MissingTerminator) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -301,7 +301,7 @@ TEST_F(SpvParserTest, TerminatorsAreValid_MissingTerminator) { } TEST_F(SpvParserTest, TerminatorsAreValid_DisallowLoopToEntryBlock) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -313,14 +313,14 @@ TEST_F(SpvParserTest, TerminatorsAreValid_DisallowLoopToEntryBlock) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.TerminatorsAreValid()); EXPECT_THAT(p->error(), Eq("Block 20 branches to function entry block 10")); } TEST_F(SpvParserTest, TerminatorsAreValid_DisallowNonBlock) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -329,7 +329,7 @@ TEST_F(SpvParserTest, TerminatorsAreValid_DisallowNonBlock) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.TerminatorsAreValid()); EXPECT_THAT(p->error(), @@ -338,7 +338,7 @@ TEST_F(SpvParserTest, TerminatorsAreValid_DisallowNonBlock) { } TEST_F(SpvParserTest, TerminatorsAreValid_DisallowBlockInDifferentFunction) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -355,7 +355,7 @@ TEST_F(SpvParserTest, TerminatorsAreValid_DisallowBlockInDifferentFunction) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.TerminatorsAreValid()); EXPECT_THAT(p->error(), Eq("Block 10 in function 100 branches to 210 which " @@ -363,7 +363,7 @@ TEST_F(SpvParserTest, TerminatorsAreValid_DisallowBlockInDifferentFunction) { } TEST_F(SpvParserTest, RegisterMerges_NoMerges) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -372,7 +372,7 @@ TEST_F(SpvParserTest, RegisterMerges_NoMerges) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.RegisterMerges()); @@ -386,7 +386,7 @@ TEST_F(SpvParserTest, RegisterMerges_NoMerges) { } TEST_F(SpvParserTest, RegisterMerges_GoodSelectionMerge_BranchConditional) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -402,7 +402,7 @@ TEST_F(SpvParserTest, RegisterMerges_GoodSelectionMerge_BranchConditional) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.RegisterMerges()); @@ -435,7 +435,7 @@ TEST_F(SpvParserTest, RegisterMerges_GoodSelectionMerge_BranchConditional) { } TEST_F(SpvParserTest, RegisterMerges_GoodSelectionMerge_Switch) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -451,7 +451,7 @@ TEST_F(SpvParserTest, RegisterMerges_GoodSelectionMerge_Switch) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.RegisterMerges()); @@ -484,7 +484,7 @@ TEST_F(SpvParserTest, RegisterMerges_GoodSelectionMerge_Switch) { } TEST_F(SpvParserTest, RegisterMerges_GoodLoopMerge_SingleBlockLoop) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -500,7 +500,7 @@ TEST_F(SpvParserTest, RegisterMerges_GoodLoopMerge_SingleBlockLoop) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.RegisterMerges()); @@ -534,7 +534,7 @@ TEST_F(SpvParserTest, RegisterMerges_GoodLoopMerge_SingleBlockLoop) { TEST_F(SpvParserTest, RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -553,7 +553,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.RegisterMerges()); @@ -587,7 +587,7 @@ TEST_F(SpvParserTest, TEST_F(SpvParserTest, RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -609,7 +609,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.RegisterMerges()); @@ -644,7 +644,7 @@ TEST_F(SpvParserTest, TEST_F( SpvParserTest, RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional) { // NOLINT - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -666,7 +666,7 @@ TEST_F( OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_TRUE(fe.RegisterMerges()); @@ -699,7 +699,7 @@ TEST_F( } TEST_F(SpvParserTest, RegisterMerges_SelectionMerge_BadTerminator) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -715,7 +715,7 @@ TEST_F(SpvParserTest, RegisterMerges_SelectionMerge_BadTerminator) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.RegisterMerges()); EXPECT_THAT(p->error(), Eq("Selection header 10 does not end in an " @@ -723,7 +723,7 @@ TEST_F(SpvParserTest, RegisterMerges_SelectionMerge_BadTerminator) { } TEST_F(SpvParserTest, RegisterMerges_LoopMerge_BadTerminator) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -745,7 +745,7 @@ TEST_F(SpvParserTest, RegisterMerges_LoopMerge_BadTerminator) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.RegisterMerges()); EXPECT_THAT(p->error(), Eq("Loop header 20 does not end in an OpBranch or " @@ -753,7 +753,7 @@ TEST_F(SpvParserTest, RegisterMerges_LoopMerge_BadTerminator) { } TEST_F(SpvParserTest, RegisterMerges_BadMergeBlock) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -769,7 +769,7 @@ TEST_F(SpvParserTest, RegisterMerges_BadMergeBlock) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.RegisterMerges()); EXPECT_THAT(p->error(), @@ -777,7 +777,7 @@ TEST_F(SpvParserTest, RegisterMerges_BadMergeBlock) { } TEST_F(SpvParserTest, RegisterMerges_HeaderIsItsOwnMerge) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -793,7 +793,7 @@ TEST_F(SpvParserTest, RegisterMerges_HeaderIsItsOwnMerge) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.RegisterMerges()); EXPECT_THAT(p->error(), @@ -801,7 +801,7 @@ TEST_F(SpvParserTest, RegisterMerges_HeaderIsItsOwnMerge) { } TEST_F(SpvParserTest, RegisterMerges_MergeReused) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -827,7 +827,7 @@ TEST_F(SpvParserTest, RegisterMerges_MergeReused) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.RegisterMerges()); EXPECT_THAT( @@ -836,7 +836,7 @@ TEST_F(SpvParserTest, RegisterMerges_MergeReused) { } TEST_F(SpvParserTest, RegisterMerges_EntryBlockIsLoopHeader) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -852,7 +852,7 @@ TEST_F(SpvParserTest, RegisterMerges_EntryBlockIsLoopHeader) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.RegisterMerges()); EXPECT_THAT(p->error(), @@ -860,7 +860,7 @@ TEST_F(SpvParserTest, RegisterMerges_EntryBlockIsLoopHeader) { } TEST_F(SpvParserTest, RegisterMerges_BadContinueTarget) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -876,7 +876,7 @@ TEST_F(SpvParserTest, RegisterMerges_BadContinueTarget) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.RegisterMerges()); EXPECT_THAT(p->error(), @@ -884,7 +884,7 @@ TEST_F(SpvParserTest, RegisterMerges_BadContinueTarget) { } TEST_F(SpvParserTest, RegisterMerges_MergeSameAsContinue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -904,7 +904,7 @@ TEST_F(SpvParserTest, RegisterMerges_MergeSameAsContinue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.RegisterMerges()); EXPECT_THAT(p->error(), @@ -913,7 +913,7 @@ TEST_F(SpvParserTest, RegisterMerges_MergeSameAsContinue) { } TEST_F(SpvParserTest, RegisterMerges_ContinueReused) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -948,7 +948,7 @@ TEST_F(SpvParserTest, RegisterMerges_ContinueReused) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.RegisterMerges()); EXPECT_THAT(p->error(), Eq("Block 40 declared as continue target for more " @@ -956,7 +956,7 @@ TEST_F(SpvParserTest, RegisterMerges_ContinueReused) { } TEST_F(SpvParserTest, RegisterMerges_SingleBlockLoop_NotItsOwnContinue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -975,7 +975,7 @@ TEST_F(SpvParserTest, RegisterMerges_SingleBlockLoop_NotItsOwnContinue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); EXPECT_FALSE(fe.RegisterMerges()); EXPECT_THAT( @@ -984,7 +984,7 @@ TEST_F(SpvParserTest, RegisterMerges_SingleBlockLoop_NotItsOwnContinue) { } TEST_F(SpvParserTest, ComputeBlockOrder_OneBlock) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %42 = OpLabel @@ -993,7 +993,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_OneBlock) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1005,7 +1005,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_OneBlock) { } TEST_F(SpvParserTest, ComputeBlockOrder_IgnoreStaticalyUnreachable) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -1020,7 +1020,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_IgnoreStaticalyUnreachable) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1028,7 +1028,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_IgnoreStaticalyUnreachable) { } TEST_F(SpvParserTest, ComputeBlockOrder_KillIsDeadEnd) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -1043,7 +1043,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_KillIsDeadEnd) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1051,7 +1051,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_KillIsDeadEnd) { } TEST_F(SpvParserTest, ComputeBlockOrder_UnreachableIsDeadEnd) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -1066,7 +1066,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_UnreachableIsDeadEnd) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1074,7 +1074,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_UnreachableIsDeadEnd) { } TEST_F(SpvParserTest, ComputeBlockOrder_ReorderSequence) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -1089,7 +1089,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_ReorderSequence) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1107,7 +1107,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_ReorderSequence) { } TEST_F(SpvParserTest, ComputeBlockOrder_DupConditionalBranch) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -1123,7 +1123,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_DupConditionalBranch) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1131,7 +1131,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_DupConditionalBranch) { } TEST_F(SpvParserTest, ComputeBlockOrder_RespectConditionalBranchOrder) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -1150,7 +1150,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_RespectConditionalBranchOrder) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1158,7 +1158,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_RespectConditionalBranchOrder) { } TEST_F(SpvParserTest, ComputeBlockOrder_TrueOnlyBranch) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -1174,7 +1174,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_TrueOnlyBranch) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1182,7 +1182,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_TrueOnlyBranch) { } TEST_F(SpvParserTest, ComputeBlockOrder_FalseOnlyBranch) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -1198,7 +1198,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_FalseOnlyBranch) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1206,7 +1206,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_FalseOnlyBranch) { } TEST_F(SpvParserTest, ComputeBlockOrder_SwitchOrderNaturallyReversed) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -1225,7 +1225,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_SwitchOrderNaturallyReversed) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1234,7 +1234,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_SwitchOrderNaturallyReversed) { TEST_F(SpvParserTest, ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -1256,7 +1256,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1264,7 +1264,7 @@ TEST_F(SpvParserTest, } TEST_F(SpvParserTest, ComputeBlockOrder_Switch_DefaultSameAsACase) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -1286,7 +1286,7 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Switch_DefaultSameAsACase) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1318,9 +1318,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_RespectSwitchCaseFallthrough) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1354,9 +1354,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1387,9 +1387,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1424,9 +1424,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1466,9 +1466,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1515,9 +1515,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Nest_If_Contains_If) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1565,9 +1565,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Nest_If_In_SwitchCase) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1615,9 +1615,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1659,9 +1659,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Nest_IfBreak_In_SwitchCase) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1684,9 +1684,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_SingleBlock_Simple) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1708,9 +1708,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_SingleBlock_Infinite) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1732,9 +1732,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_SingleBlock_DupInfinite) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1761,9 +1761,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_HeaderHasBreakIf) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1790,9 +1790,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_HeaderHasBreakUnless) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1819,9 +1819,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_BodyHasBreak) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1851,9 +1851,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_BodyHasBreakIf) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1884,9 +1884,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_BodyHasBreakUnless) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1924,9 +1924,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Body_If) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1961,9 +1961,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Body_If_Break) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -1994,9 +1994,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_BodyHasContinueIf) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2027,9 +2027,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_BodyHasContinueUnless) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2064,9 +2064,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Body_If_Continue) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2104,9 +2104,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Body_Switch) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2146,9 +2146,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Body_Switch_CaseBreaks) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2186,9 +2186,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Body_Switch_CaseContinues) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2219,9 +2219,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_BodyHasSwitchContinueBreak) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2251,9 +2251,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Continue_Sequence) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2290,9 +2290,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Continue_ContainsIf) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2319,9 +2319,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Continue_HasBreakIf) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2348,9 +2348,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Continue_HasBreakUnless) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2377,9 +2377,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Continue_SwitchBreak) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2419,9 +2419,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Loop) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2462,9 +2462,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Loop_InnerBreak) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2505,9 +2505,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Loop_InnerContinue) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2548,9 +2548,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Loop_InnerContinueBreaks) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2591,9 +2591,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Loop_InnerContinueContinues) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2639,9 +2639,9 @@ TEST_F(SpvParserTest, ComputeBlockOrder_Loop_Loop_SwitchBackedgeBreakContinue) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); @@ -2668,9 +2668,9 @@ TEST_F(SpvParserTest, VerifyHeaderContinueMergeOrder_Selection_Good) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -2693,9 +2693,9 @@ TEST_F(SpvParserTest, VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -2721,9 +2721,9 @@ TEST_F(SpvParserTest, VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -2753,9 +2753,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -2791,9 +2791,9 @@ TEST_F( OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -2828,9 +2828,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -2851,9 +2851,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -2878,9 +2878,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -2913,9 +2913,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -2960,9 +2960,9 @@ TEST_F( OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3004,9 +3004,9 @@ TEST_F(SpvParserTest, LabelControlFlowConstructs_SwitchSelection) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3041,9 +3041,9 @@ TEST_F(SpvParserTest, LabelControlFlowConstructs_SingleBlockLoop) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3089,9 +3089,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3138,9 +3138,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3182,9 +3182,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3231,9 +3231,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3290,9 +3290,9 @@ TEST_F(SpvParserTest, LabelControlFlowConstructs_Nest_If_If) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3350,9 +3350,9 @@ TEST_F(SpvParserTest, LabelControlFlowConstructs_Nest_Switch_If) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3400,9 +3400,9 @@ TEST_F(SpvParserTest, LabelControlFlowConstructs_Nest_If_Switch) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3454,9 +3454,9 @@ TEST_F(SpvParserTest, LabelControlFlowConstructs_Nest_Loop_Loop) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3509,9 +3509,9 @@ TEST_F(SpvParserTest, LabelControlFlowConstructs_Nest_Loop_If) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3560,9 +3560,9 @@ TEST_F(SpvParserTest, LabelControlFlowConstructs_Nest_LoopContinue_If) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3604,9 +3604,9 @@ TEST_F(SpvParserTest, LabelControlFlowConstructs_Nest_If_SingleBlockLoop) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3653,9 +3653,9 @@ TEST_F(SpvParserTest, LabelControlFlowConstructs_Nest_If_MultiBlockLoop) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); fe.RegisterMerges(); @@ -3697,9 +3697,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_DefaultIsLongRangeBackedge) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -3729,9 +3729,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_DefaultIsSelfLoop) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -3764,9 +3764,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_DefaultCantEscapeSwitch) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -3803,9 +3803,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_DefaultForTwoSwitches_AsMerge) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -3847,9 +3847,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -3876,9 +3876,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_CaseIsLongRangeBackedge) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -3905,9 +3905,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_CaseIsSelfLoop) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -3936,9 +3936,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_CaseCanBeSwitchMerge) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -3967,9 +3967,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_CaseCantEscapeSwitch) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -4003,9 +4003,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_CaseForMoreThanOneSwitch) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -4043,9 +4043,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_CaseIsMergeForAnotherConstruct) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -4065,9 +4065,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_NoSwitch) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -4099,9 +4099,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_DefaultIsMerge) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -4137,9 +4137,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_DefaultIsNotMerge) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -4175,9 +4175,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_CaseIsNotDefault) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -4210,9 +4210,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_CaseIsDefault) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -4248,9 +4248,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_ManyCasesWithSameValue_IsError) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -4278,9 +4278,9 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_ManyValuesWithSameCase) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -4321,9 +4321,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_BranchEscapesIfConstruct) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)) << p->error(); // Some further processing EXPECT_THAT( @@ -4352,9 +4352,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_ReturnInContinueConstruct) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)) << p->error(); EXPECT_THAT(p->error(), Eq("Invalid function exit at block 50 from continue " "construct starting at 50")); @@ -4380,9 +4380,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_KillInContinueConstruct) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), Eq("Invalid function exit at block 50 from continue " "construct starting at 50")); @@ -4408,9 +4408,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_UnreachableInContinueConstruct) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), Eq("Invalid function exit at block 50 from continue " "construct starting at 50")); @@ -4436,9 +4436,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_BackEdge_NotInContinueConstruct) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -4469,9 +4469,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), Eq("Invalid exit (50->20) from continue construct: 50 is not the " @@ -4503,9 +4503,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_BackEdge_ToWrongHeader) { %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), Eq("Invalid backedge (50->10): does not branch to " "the corresponding loop header, expected 20")); @@ -4525,9 +4525,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_BackEdge_SingleBlockLoop) { %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi20 = fe.GetBlockInfo(20); @@ -4557,9 +4557,9 @@ TEST_F(SpvParserTest, %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi40 = fe.GetBlockInfo(40); @@ -4593,9 +4593,9 @@ TEST_F( %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi50 = fe.GetBlockInfo(50); @@ -4629,9 +4629,9 @@ TEST_F( %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)) << p->error(); auto* bi50 = fe.GetBlockInfo(50); @@ -4663,9 +4663,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_PrematureExitFromContinueConstruct) { %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), Eq("Invalid exit (40->99) from continue construct: 40 is not the " @@ -4688,9 +4688,9 @@ TEST_F(SpvParserTest, %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(20); @@ -4716,9 +4716,9 @@ TEST_F(SpvParserTest, %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(20); @@ -4747,9 +4747,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(20); @@ -4775,9 +4775,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(30); @@ -4800,9 +4800,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_IfBreak_FromIfHeader) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(20); @@ -4828,9 +4828,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_IfBreak_FromIfThenElse) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); // Then clause @@ -4863,9 +4863,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_IfBreak_BypassesMerge_IsError) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -4903,9 +4903,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_IfBreak_EscapeSwitchCase_IsError) { %99 = OpLabel ; if-selection's merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -4927,9 +4927,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(10); @@ -4952,9 +4952,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(20); @@ -4980,9 +4980,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(30); @@ -5005,9 +5005,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(10); @@ -5037,9 +5037,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional) { %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(30); @@ -5069,9 +5069,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional) { %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(30); @@ -5097,9 +5097,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_SwitchBreak_BypassesMerge_IsError) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -5132,9 +5132,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_SwitchBreak_FromNestedLoop_IsError) { %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -5164,9 +5164,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_SwitchBreak_FromNestedSwitch_IsError) { %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -5194,9 +5194,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_LoopBreak_FromLoopBody) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(30); @@ -5228,9 +5228,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_LoopBreak_FromContinueConstructTail) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(60); @@ -5259,9 +5259,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(30); @@ -5298,9 +5298,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(40); @@ -5337,9 +5337,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(40); @@ -5379,9 +5379,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), Eq("Invalid exit (50->99) from continue construct: 50 is not the " @@ -5413,9 +5413,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -5450,9 +5450,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -5480,9 +5480,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_LoopContinue_LoopBodyToContinue) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(30); @@ -5518,9 +5518,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_LoopContinue_FromNestedIf) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(40); @@ -5556,9 +5556,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(40); @@ -5595,9 +5595,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)) << p->error(); auto* bi = fe.GetBlockInfo(40); @@ -5631,9 +5631,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -5669,9 +5669,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -5710,9 +5710,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)) << p->error(); auto* bi = fe.GetBlockInfo(40); @@ -5750,9 +5750,9 @@ TEST_F( %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(40); @@ -5801,9 +5801,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -5831,9 +5831,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_Fallthrough_CaseTailToCase) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(30); @@ -5862,9 +5862,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(30); @@ -5893,9 +5893,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_Fallthrough_DefaultToCase) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(30); @@ -5933,9 +5933,9 @@ TEST_F(SpvParserTest, %99 = OpLabel ; if-selection's merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -5967,9 +5967,9 @@ TEST_F(SpvParserTest, %99 = OpLabel ; if-selection's merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), Eq("Control flow diverges at block 20 (to 25, 30) but it is not " @@ -6013,9 +6013,9 @@ TEST_F( %99 = OpLabel ; loop merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), Eq("Invalid exit (40->20) from continue construct: 40 is not the " @@ -6052,9 +6052,9 @@ TEST_F( %99 = OpLabel ; switch merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowFindSwitchCaseHeaders(&fe)); EXPECT_THAT(fe.block_order(), ElementsAre(10, 20, 40, 50, 99)); EXPECT_THAT(p->error(), @@ -6095,9 +6095,9 @@ TEST_F( %99 = OpLabel ; switch merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), Eq("Branch from 10 to 50 bypasses continue target 40 " "(dominance rule violated)")); @@ -6136,9 +6136,9 @@ TEST_F( %99 = OpLabel ; switch merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(fe.block_order(), ElementsAre(10, 20, 40, 50, 49, 99)); EXPECT_THAT(p->error(), Eq("Branch from 10 to 50 bypasses continue target 40 " @@ -6180,9 +6180,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -6226,9 +6226,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -6249,9 +6249,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_Forward_IfToThen) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(10); @@ -6274,9 +6274,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_Forward_IfToElse) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(10); @@ -6299,9 +6299,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_Forward_SwitchToCase) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(10); @@ -6327,9 +6327,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(10); @@ -6358,9 +6358,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_Forward_LoopHeadToBody) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(20); @@ -6391,9 +6391,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -6422,9 +6422,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -6456,9 +6456,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), // Weird error, but still we caught it. @@ -6496,9 +6496,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -6530,9 +6530,9 @@ TEST_F(SpvParserTest, %80 = OpLabel OpBranch %60 ; bad branch )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -6563,9 +6563,9 @@ TEST_F( %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowFindSwitchCaseHeaders(&fe)); EXPECT_THAT(p->error(), Eq("Block 50 is a case block for switch-selection header 10 and " @@ -6595,9 +6595,9 @@ TEST_F( %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowFindSwitchCaseHeaders(&fe)); EXPECT_THAT(p->error(), Eq("Block 50 is the default block for switch-selection header 10 " @@ -6624,9 +6624,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_TooManyBackedges) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -6649,9 +6649,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_NeededMerge_BranchConditional) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), Eq("Control flow diverges at block 20 (to 30, 40) but it is not " @@ -6674,9 +6674,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_NeededMerge_Switch) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), Eq("Control flow diverges at block 10 (to 99, 20) but it is not " @@ -6708,9 +6708,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(20); @@ -6745,9 +6745,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_Pathological_Forward_Premerge) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi20 = fe.GetBlockInfo(20); @@ -6786,9 +6786,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_Pathological_Forward_Regardless) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi10 = fe.GetBlockInfo(10); @@ -6809,9 +6809,9 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_NoIf) { %10 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); auto* bi = fe.GetBlockInfo(10); @@ -6838,9 +6838,9 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_ThenElse) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowFindIfSelectionInternalHeaders(&fe)); auto* bi10 = fe.GetBlockInfo(10); @@ -6882,9 +6882,9 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_IfOnly) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowFindIfSelectionInternalHeaders(&fe)); auto* bi10 = fe.GetBlockInfo(10); @@ -6920,9 +6920,9 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_ElseOnly) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowFindIfSelectionInternalHeaders(&fe)); auto* bi10 = fe.GetBlockInfo(10); @@ -6961,9 +6961,9 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_Regardless) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowFindIfSelectionInternalHeaders(&fe)); EXPECT_THAT(fe.block_order(), ElementsAre(10, 20, 80, 99)); @@ -6995,9 +6995,9 @@ TEST_F(SpvParserTest, FindIfSelectionInternalHeaders_Premerge_Simple) { %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowFindIfSelectionInternalHeaders(&fe)); EXPECT_THAT(fe.block_order(), ElementsAre(10, 20, 30, 80, 99)); @@ -7030,9 +7030,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowFindIfSelectionInternalHeaders(&fe)); EXPECT_THAT(fe.block_order(), ElementsAre(10, 20, 30, 80, 99)); @@ -7065,9 +7065,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowFindIfSelectionInternalHeaders(&fe)); EXPECT_THAT(fe.block_order(), ElementsAre(10, 30, 20, 80, 99)); @@ -7106,9 +7106,9 @@ TEST_F(SpvParserTest, %99 = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); // Error out sooner in the flow EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(p->error(), @@ -7135,9 +7135,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(fe.block_order(), ElementsAre(10, 20, 80, 99)); @@ -7173,9 +7173,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(fe.block_order(), ElementsAre(10, 20, 30, 80, 99)); @@ -7210,9 +7210,9 @@ TEST_F(SpvParserTest, ClassifyCFGEdges_IfBreak_WithForwardToPremerge) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT(fe.block_order(), ElementsAre(10, 20, 30, 80, 99)); @@ -7248,9 +7248,9 @@ TEST_F(SpvParserTest, %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowFindIfSelectionInternalHeaders(&fe)); EXPECT_THAT( p->error(), @@ -7280,9 +7280,9 @@ TEST_F(SpvParserTest, %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowFindIfSelectionInternalHeaders(&fe)); EXPECT_THAT( p->error(), @@ -7318,9 +7318,9 @@ TEST_F(SpvParserTest, %99 = OpLabel ; outer merge OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowFindIfSelectionInternalHeaders(&fe)); EXPECT_THAT(p->error(), Eq("Block 70 is the merge block for 50 but has alternate paths " @@ -7357,9 +7357,9 @@ TEST_F(SpvParserTest, EmitBody_IfBreak_FromThen_ForwardWithinThen) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -7467,9 +7467,9 @@ TEST_F(SpvParserTest, EmitBody_IfBreak_FromElse_ForwardWithinElse) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -7592,9 +7592,9 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error() << assembly; EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -7758,9 +7758,9 @@ TEST_F(SpvParserTest, BlockIsContinueForMoreThanOneHeader) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); fe.RegisterBasicBlocks(); fe.ComputeBlockOrderAndPositions(); EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); @@ -7770,7 +7770,7 @@ TEST_F(SpvParserTest, BlockIsContinueForMoreThanOneHeader) { } TEST_F(SpvParserTest, EmitBody_If_Empty) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -7782,7 +7782,7 @@ TEST_F(SpvParserTest, EmitBody_If_Empty) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{ @@ -7797,7 +7797,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_If_Then_NoElse) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -7816,7 +7816,7 @@ TEST_F(SpvParserTest, EmitBody_If_Then_NoElse) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -7843,7 +7843,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_If_NoThen_Else) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -7862,7 +7862,7 @@ TEST_F(SpvParserTest, EmitBody_If_NoThen_Else) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -7893,7 +7893,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_If_Then_Else) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -7916,7 +7916,7 @@ TEST_F(SpvParserTest, EmitBody_If_Then_Else) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -7954,7 +7954,7 @@ TEST_F(SpvParserTest, EmitBody_If_Then_Else_Premerge) { // TODO(dneto): This should get an extra if(true) around // the premerge code. // See https://bugs.chromium.org/p/tint/issues/detail?id=82 - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -7981,7 +7981,7 @@ TEST_F(SpvParserTest, EmitBody_If_Then_Else_Premerge) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -8028,7 +8028,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_If_Then_Premerge) { // The premerge *is* the else. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8051,7 +8051,7 @@ TEST_F(SpvParserTest, EmitBody_If_Then_Premerge) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -8090,7 +8090,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_If_Else_Premerge) { // The premerge *is* the then-clause. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8113,7 +8113,7 @@ TEST_F(SpvParserTest, EmitBody_If_Else_Premerge) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -8155,7 +8155,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_If_Nest_If) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8196,7 +8196,7 @@ TEST_F(SpvParserTest, EmitBody_If_Nest_If) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -8265,7 +8265,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_TrueBackedge) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8284,7 +8284,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_TrueBackedge) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -8318,7 +8318,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_FalseBackedge) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8337,7 +8337,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_FalseBackedge) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -8367,7 +8367,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_BothBackedge) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8386,7 +8386,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_BothBackedge) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -8408,7 +8408,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_UnconditionalBackege) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8427,7 +8427,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_UnconditionalBackege) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -8449,7 +8449,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Loop_Unconditional_Body_SingleBlockContinue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8476,7 +8476,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_Unconditional_Body_SingleBlockContinue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -8508,7 +8508,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Loop_Unconditional_Body_MultiBlockContinue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8539,7 +8539,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_Unconditional_Body_MultiBlockContinue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -8575,7 +8575,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Loop_Unconditional_Body_ContinueNestIf) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8611,7 +8611,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_Unconditional_Body_ContinueNestIf) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -8659,7 +8659,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_Loop_MultiBlockContinueIsEntireLoop) { // Test case where both branches exit. e.g both go to merge. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8682,7 +8682,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_MultiBlockContinueIsEntireLoop) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -8716,7 +8716,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_Loop_Never) { // Test case where both branches exit. e.g both go to merge. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8738,7 +8738,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_Never) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ Assignment{ @@ -8770,7 +8770,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_HeaderBreakAndContinue) { } TEST_F(SpvParserTest, EmitBody_Loop_TrueToBody_FalseBreaks) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8796,7 +8796,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_TrueToBody_FalseBreaks) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ Assignment{ @@ -8835,7 +8835,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Loop_FalseToBody_TrueBreaks) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8861,7 +8861,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_FalseToBody_TrueBreaks) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ Assignment{ @@ -8901,7 +8901,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_Loop_NestedIfContinue) { // By construction, it has to come from nested code. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8933,7 +8933,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_NestedIfContinue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ If{ @@ -8964,7 +8964,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Loop_BodyAlwaysBreaks) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -8988,7 +8988,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_BodyAlwaysBreaks) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -9011,7 +9011,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromTrue) { // The else-branch has a continue but it's skipped because it's from a // block that immediately precedes the continue construct. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9035,7 +9035,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromTrue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -9065,7 +9065,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromFalse) { // The else-branch has a continue but it's skipped because it's from a // block that immediately precedes the continue construct. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9089,7 +9089,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromFalse) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -9121,7 +9121,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9149,7 +9149,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -9181,7 +9181,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9209,7 +9209,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -9245,7 +9245,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_NoCases) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9260,7 +9260,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_NoCases) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -9284,7 +9284,7 @@ Return{} // First do no special control flow: no fallthroughs, breaks, continues. TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_OneCase) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9303,7 +9303,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_OneCase) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -9332,7 +9332,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_TwoCases) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9355,7 +9355,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_TwoCases) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -9390,7 +9390,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_CasesWithDup) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9413,7 +9413,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_CasesWithDup) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -9450,7 +9450,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsCase_NoDupCases) { // The default block is not the merge block. But not the same as a case // either. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9477,7 +9477,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsCase_NoDupCases) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -9519,7 +9519,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsCase_WithDupCase) { // The default block is not the merge block and is the same as a case. // We emit the default case separately, but just before the labeled // case, and with a fallthrough. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9546,7 +9546,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsCase_WithDupCase) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -9588,7 +9588,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Switch_Case_SintValue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9616,7 +9616,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_Case_SintValue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -9657,7 +9657,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Switch_Case_UintValue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9684,7 +9684,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_Case_UintValue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -9725,7 +9725,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Return_TopLevel) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9734,7 +9734,7 @@ TEST_F(SpvParserTest, EmitBody_Return_TopLevel) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Return{} @@ -9742,7 +9742,7 @@ TEST_F(SpvParserTest, EmitBody_Return_TopLevel) { } TEST_F(SpvParserTest, EmitBody_Return_InsideIf) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9758,7 +9758,7 @@ TEST_F(SpvParserTest, EmitBody_Return_InsideIf) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{ @@ -9774,7 +9774,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Return_InsideLoop) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9796,7 +9796,7 @@ TEST_F(SpvParserTest, EmitBody_Return_InsideLoop) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -9807,7 +9807,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_ReturnValue_TopLevel) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %200 = OpFunction %uint None %uintfn %210 = OpLabel @@ -9824,7 +9824,7 @@ TEST_F(SpvParserTest, EmitBody_ReturnValue_TopLevel) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(200)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 200)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Return{ @@ -9836,7 +9836,7 @@ TEST_F(SpvParserTest, EmitBody_ReturnValue_TopLevel) { } TEST_F(SpvParserTest, EmitBody_ReturnValue_InsideIf) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %200 = OpFunction %uint None %uintfn %210 = OpLabel @@ -9861,7 +9861,7 @@ TEST_F(SpvParserTest, EmitBody_ReturnValue_InsideIf) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(200)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 200)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{ @@ -9885,7 +9885,7 @@ Return{ } TEST_F(SpvParserTest, EmitBody_ReturnValue_Loop) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %200 = OpFunction %void None %voidfn %210 = OpLabel @@ -9916,7 +9916,7 @@ TEST_F(SpvParserTest, EmitBody_ReturnValue_Loop) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(200)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 200)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -9935,7 +9935,7 @@ Return{ } TEST_F(SpvParserTest, EmitBody_Kill_TopLevel) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9944,7 +9944,7 @@ TEST_F(SpvParserTest, EmitBody_Kill_TopLevel) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Discard{} @@ -9952,7 +9952,7 @@ TEST_F(SpvParserTest, EmitBody_Kill_TopLevel) { } TEST_F(SpvParserTest, EmitBody_Kill_InsideIf) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -9968,7 +9968,7 @@ TEST_F(SpvParserTest, EmitBody_Kill_InsideIf) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{ @@ -9984,7 +9984,7 @@ Discard{} } TEST_F(SpvParserTest, EmitBody_Kill_InsideLoop) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10006,7 +10006,7 @@ TEST_F(SpvParserTest, EmitBody_Kill_InsideLoop) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -10017,7 +10017,7 @@ Discard{} } TEST_F(SpvParserTest, EmitBody_Unreachable_TopLevel) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10026,7 +10026,7 @@ TEST_F(SpvParserTest, EmitBody_Unreachable_TopLevel) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Return{} @@ -10034,7 +10034,7 @@ TEST_F(SpvParserTest, EmitBody_Unreachable_TopLevel) { } TEST_F(SpvParserTest, EmitBody_Unreachable_InsideIf) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10050,7 +10050,7 @@ TEST_F(SpvParserTest, EmitBody_Unreachable_InsideIf) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{ @@ -10066,7 +10066,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Unreachable_InsideLoop) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10088,7 +10088,7 @@ TEST_F(SpvParserTest, EmitBody_Unreachable_InsideLoop) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -10099,7 +10099,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Unreachable_InNonVoidFunction) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %200 = OpFunction %uint None %uintfn %210 = OpLabel @@ -10116,7 +10116,7 @@ TEST_F(SpvParserTest, EmitBody_Unreachable_InNonVoidFunction) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(200)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 200)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Return{ @@ -10128,7 +10128,7 @@ TEST_F(SpvParserTest, EmitBody_Unreachable_InNonVoidFunction) { } TEST_F(SpvParserTest, EmitBody_Branch_BackEdge_MultiBlockLoop) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10148,7 +10148,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_BackEdge_MultiBlockLoop) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -10164,7 +10164,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Branch_BackEdge_SingleBlockLoop) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10181,7 +10181,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_BackEdge_SingleBlockLoop) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -10197,7 +10197,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_Branch_SwitchBreak_LastInCase) { // When the break is last in its case, we omit it because it's implicit in // WGSL. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10216,7 +10216,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_SwitchBreak_LastInCase) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -10246,7 +10246,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_Branch_SwitchBreak_NotLastInCase) { // When the break is not last in its case, we must emit a 'break' - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10274,7 +10274,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_SwitchBreak_NotLastInCase) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -10319,7 +10319,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10343,7 +10343,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -10368,7 +10368,7 @@ TEST_F( EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructConditional) { // This case is invalid because the backedge block doesn't post-dominate the // continue target. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10394,7 +10394,7 @@ TEST_F( OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()) << p->error(); EXPECT_THAT(p->error(), Eq("Invalid exit (40->99) from continue construct: 40 is not the " @@ -10404,7 +10404,7 @@ TEST_F( TEST_F(SpvParserTest, EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10424,7 +10424,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ continuing { @@ -10440,7 +10440,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Branch_LoopContinue_LastInLoopConstruct) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10464,7 +10464,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_LoopContinue_LastInLoopConstruct) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ Assignment{ @@ -10484,7 +10484,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_Branch_LoopContinue_BeforeLast) { // By construction, it has to come from nested code. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10516,7 +10516,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_LoopContinue_BeforeLast) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ If{ @@ -10547,7 +10547,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Branch_LoopContinue_FromSwitch) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10583,7 +10583,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_LoopContinue_FromSwitch) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -10633,7 +10633,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_Branch_IfBreak_FromThen) { // When unconditional, the if-break must be last in the then clause. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10651,7 +10651,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_IfBreak_FromThen) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{ ( @@ -10674,7 +10674,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_Branch_IfBreak_FromElse) { // When unconditional, the if-break must be last in the else clause. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10692,7 +10692,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_IfBreak_FromElse) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{ ( @@ -10718,7 +10718,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Branch_Fallthrough) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10741,7 +10741,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_Fallthrough) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -10777,7 +10777,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_Branch_Forward) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10791,7 +10791,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_Forward) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -10874,7 +10874,7 @@ Return{} // kForward: dup general case TEST_F(SpvParserTest, EmitBody_BranchConditional_Back_SingleBlock_Back) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10893,7 +10893,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Back_SingleBlock_Back) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -10915,7 +10915,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10934,7 +10934,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -10964,7 +10964,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -10983,7 +10983,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -11017,7 +11017,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11039,7 +11039,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -11071,7 +11071,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11093,7 +11093,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -11131,7 +11131,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase) { // When the break is last in its case, we omit it because it's implicit in // WGSL. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11150,7 +11150,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -11181,7 +11181,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase) { // When the break is not last in its case, we must emit a 'break' - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11209,7 +11209,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -11254,7 +11254,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11290,7 +11290,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -11347,7 +11347,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11383,7 +11383,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -11444,7 +11444,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11467,7 +11467,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -11511,7 +11511,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11534,7 +11534,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -11575,7 +11575,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11598,7 +11598,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -11647,7 +11647,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11670,7 +11670,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -11715,7 +11715,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11738,7 +11738,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -11767,7 +11767,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11794,7 +11794,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -11826,7 +11826,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Continue_OnTrue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11865,7 +11865,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Continue_OnTrue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -11920,7 +11920,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Continue_OnFalse) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -11959,7 +11959,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Continue_OnFalse) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12016,7 +12016,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Fallthrough_IsError) { // It's an error because switch break conflicts with loop break. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12055,7 +12055,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()) << p->error(); EXPECT_THAT( p->error(), @@ -12064,7 +12064,7 @@ TEST_F(SpvParserTest, } TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Forward_OnTrue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12096,7 +12096,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Forward_OnTrue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12143,7 +12143,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Forward_OnFalse) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12175,7 +12175,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Forward_OnFalse) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12218,7 +12218,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Continue_FromHeader) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12241,7 +12241,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Continue_FromHeader) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12269,7 +12269,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12296,7 +12296,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12330,7 +12330,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional) { // Create an intervening block so we actually require a "continue" statement // instead of just an adjacent fallthrough to the continue target. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12366,7 +12366,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12416,7 +12416,7 @@ TEST_F( SpvParserTest, EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing) { // NOLINT // Like the previous tests, but with an empty continuing clause. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12452,7 +12452,7 @@ TEST_F( OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12493,7 +12493,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopContinue_FromSwitch) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12529,7 +12529,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopContinue_FromSwitch) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12578,7 +12578,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_IfBreak_OnTrue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12615,7 +12615,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_IfBreak_OnTrue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12673,7 +12673,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_IfBreak_OnFalse) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12710,7 +12710,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_IfBreak_OnFalse) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12764,7 +12764,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Fallthrough_OnTrue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12804,7 +12804,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Fallthrough_OnTrue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12871,7 +12871,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Fallthrough_OnFalse) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -12911,7 +12911,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Fallthrough_OnFalse) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -12974,7 +12974,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Forward_OnTrue) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -13006,7 +13006,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Forward_OnTrue) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -13053,7 +13053,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Forward_OnFalse) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -13085,7 +13085,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Forward_OnFalse) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -13128,7 +13128,7 @@ Return{} } TEST_F(SpvParserTest, EmitBody_BranchConditional_IfBreak_IfBreak_Same) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -13147,7 +13147,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_IfBreak_IfBreak_Same) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -13170,7 +13170,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_IfBreak_IfBreak_DifferentIsError) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -13197,7 +13197,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)); EXPECT_THAT( p->error(), @@ -13206,7 +13206,7 @@ TEST_F(SpvParserTest, } TEST_F(SpvParserTest, EmitBody_BranchConditional_Fallthrough_Fallthrough_Same) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -13229,7 +13229,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Fallthrough_Fallthrough_Same) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -13268,7 +13268,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Fallthrough_NotLastInCase_IsError) { // See also // ClassifyCFGEdges_Fallthrough_BranchConditionalWith_Forward_IsError. - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -13294,7 +13294,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); // The weird forward branch pulls in 40 as part of the selection rather than // as a case. @@ -13305,7 +13305,7 @@ TEST_F(SpvParserTest, } TEST_F(SpvParserTest, EmitBody_BranchConditional_Forward_Forward_Same) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -13319,7 +13319,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Forward_Forward_Same) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ Identifier[not set]{var_1} @@ -13335,7 +13335,7 @@ Return{} TEST_F(SpvParserTest, EmitBody_BranchConditional_Forward_Forward_Different_IsError) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %10 = OpLabel @@ -13351,7 +13351,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("Control flow diverges at block 10 (to 20, 99) but it is not " @@ -13361,7 +13361,7 @@ TEST_F(SpvParserTest, TEST_F(SpvParserTest, DISABLED_Switch_NotAsSelectionHeader_NonDefaultBranchesAreContinue) { // Adapted from SPIRV-Tools test MissingMergeOneUnseenTargetSwitchGood - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %entry = OpLabel OpBranch %loop @@ -13386,7 +13386,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(unhandled case)")) << ToString(fe.ast_body()); @@ -13395,7 +13395,7 @@ TEST_F(SpvParserTest, TEST_F(SpvParserTest, DISABLED_Switch_NotAsSelectionHeader_DefaultBranchIsContinue) { // Adapted from SPIRV-Tools test MissingMergeOneUnseenTargetSwitchGood - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %entry = OpLabel OpBranch %loop @@ -13420,7 +13420,7 @@ TEST_F(SpvParserTest, OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(unhandled case)")) << ToString(fe.ast_body()); @@ -13433,9 +13433,9 @@ TEST_F(SpvParserTest, SiblingLoopConstruct_Null) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_EQ(fe.SiblingLoopConstruct(nullptr), nullptr); } @@ -13448,9 +13448,9 @@ TEST_F(SpvParserTest, SiblingLoopConstruct_NotAContinue) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); ASSERT_TRUE(FlowLabelControlFlowConstructs(&fe)) << p->error(); const Construct* c = fe.GetBlockInfo(10)->construct; EXPECT_NE(c, nullptr); @@ -13473,9 +13473,9 @@ TEST_F(SpvParserTest, SiblingLoopConstruct_SingleBlockLoop) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); ASSERT_TRUE(FlowLabelControlFlowConstructs(&fe)) << p->error(); const Construct* c = fe.GetBlockInfo(20)->construct; EXPECT_EQ(c->kind, Construct::kContinue); @@ -13501,10 +13501,10 @@ TEST_F(SpvParserTest, SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); ASSERT_TRUE(FlowLabelControlFlowConstructs(&fe)) << p->error(); const Construct* c = fe.GetBlockInfo(20)->construct; EXPECT_EQ(c->kind, Construct::kContinue); @@ -13530,9 +13530,9 @@ TEST_F(SpvParserTest, SiblingLoopConstruct_HasSiblingLoop) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); ASSERT_TRUE(FlowLabelControlFlowConstructs(&fe)) << p->error(); const Construct* c = fe.GetBlockInfo(30)->construct; EXPECT_EQ(c->kind, Construct::kContinue); diff --git a/src/reader/spirv/function_composite_test.cc b/src/reader/spirv/function_composite_test.cc index 45b17b5b73..0cc2cc87a1 100644 --- a/src/reader/spirv/function_composite_test.cc +++ b/src/reader/spirv/function_composite_test.cc @@ -82,9 +82,9 @@ TEST_F(SpvParserTest_Composite_Construct, Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -138,9 +138,9 @@ TEST_F(SpvParserTest_Composite_Construct, Matrix) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -179,9 +179,9 @@ TEST_F(SpvParserTest_Composite_Construct, Array) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -210,9 +210,9 @@ TEST_F(SpvParserTest_Composite_Construct, Struct) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -245,9 +245,9 @@ TEST_F(SpvParserTest_CompositeExtract, Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -276,9 +276,9 @@ TEST_F(SpvParserTest_CompositeExtract, Vector_IndexTooBigError) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("CompositeExtract %1 index value 900 is out of " "bounds for vector of 2 elements")); @@ -296,9 +296,9 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -327,9 +327,9 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix_IndexTooBigError) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()) << p->error(); EXPECT_THAT(p->error(), Eq("CompositeExtract %2 index value 3 is out of " "bounds for matrix of 3 elements")); @@ -347,9 +347,9 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -381,9 +381,9 @@ TEST_F(SpvParserTest_CompositeExtract, Array) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -413,9 +413,9 @@ TEST_F(SpvParserTest_CompositeExtract, RuntimeArray_IsError) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()) << p->error(); EXPECT_THAT(p->error(), Eq("can't do OpCompositeExtract on a runtime array")); } @@ -432,9 +432,9 @@ TEST_F(SpvParserTest_CompositeExtract, Struct) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -474,9 +474,9 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_DifferOnlyInMemberName) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -518,9 +518,9 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_IndexTooBigError) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("CompositeExtract %2 index value 40 is out of " "bounds for structure %25 having 3 members")); @@ -540,9 +540,9 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_Array_Matrix_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -579,9 +579,9 @@ TEST_F(SpvParserTest_CopyObject, Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -617,9 +617,9 @@ TEST_F(SpvParserTest_CopyObject, Pointer) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -657,9 +657,9 @@ TEST_F(SpvParserTest_VectorShuffle, FunctionScopeOperands_UseBoth) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 @@ -699,9 +699,9 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_UseBoth) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 @@ -758,9 +758,9 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_AllOnesMapToNull) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_10 @@ -789,9 +789,9 @@ TEST_F(SpvParserTest_VectorShuffle, IndexTooBig_IsError) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()) << p->error(); EXPECT_THAT(p->error(), Eq("invalid vectorshuffle ID %10: index too large: 9")); diff --git a/src/reader/spirv/function_conversion_test.cc b/src/reader/spirv/function_conversion_test.cc index ac7dda59a7..e95afa7f6e 100644 --- a/src/reader/spirv/function_conversion_test.cc +++ b/src/reader/spirv/function_conversion_test.cc @@ -78,9 +78,9 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -104,9 +104,9 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -134,9 +134,9 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_BadArg) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), HasSubstr("unhandled expression for ID 2\n%2 = OpTypeVoid")); @@ -150,9 +150,9 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_BadArg) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), HasSubstr("unhandled expression for ID 2\n%2 = OpTypeVoid")); @@ -166,9 +166,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_BadArg) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), HasSubstr("unhandled expression for ID 2\n%2 = OpTypeVoid")); @@ -182,9 +182,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_BadArg) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), HasSubstr("unhandled expression for ID 2\n%2 = OpTypeVoid")); @@ -198,9 +198,9 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_BadArgType) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), HasSubstr("operand for conversion to floating point must be " @@ -215,9 +215,9 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_BadArgType) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT( p->error(), @@ -234,9 +234,9 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromSigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -261,9 +261,9 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromUnsigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -290,9 +290,9 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromSigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -317,9 +317,9 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromUnsigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -345,9 +345,9 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_BadArgType) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("operand for conversion to floating point must be " "integral scalar or vector, but got: __bool")); @@ -361,9 +361,9 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_BadArgType) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("operand for conversion to floating point must be integral " @@ -379,9 +379,9 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromSigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -408,9 +408,9 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromUnsigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -435,9 +435,9 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromSigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -464,9 +464,9 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromUnsigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -490,9 +490,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_BadArgType) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("operand for conversion to signed integer must be floating " @@ -507,9 +507,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_BadArgType) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("operand for conversion to signed integer must be floating " @@ -525,9 +525,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToSigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -552,9 +552,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToUnsigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -581,9 +581,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToSigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -608,9 +608,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToUnsigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -636,9 +636,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_BadArgType) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("operand for conversion to unsigned integer must be floating " @@ -653,9 +653,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_BadArgType) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("operand for conversion to unsigned integer must be floating " @@ -671,9 +671,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToSigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -700,9 +700,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToUnsigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -727,9 +727,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToSigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 @@ -756,9 +756,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToUnsigned) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{ x_1 diff --git a/src/reader/spirv/function_decl_test.cc b/src/reader/spirv/function_decl_test.cc index 61427260a4..ed1afb656f 100644 --- a/src/reader/spirv/function_decl_test.cc +++ b/src/reader/spirv/function_decl_test.cc @@ -50,14 +50,14 @@ std::string CommonTypes() { } TEST_F(SpvParserTest, EmitFunctionDeclaration_VoidFunctionWithoutParams) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %100 = OpFunction %void None %voidfn %entry = OpLabel OpReturn OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionDeclaration()); EXPECT_THAT(p->module().to_str(), HasSubstr(R"( Function x_100 -> __void @@ -67,7 +67,7 @@ TEST_F(SpvParserTest, EmitFunctionDeclaration_VoidFunctionWithoutParams) { } TEST_F(SpvParserTest, EmitFunctionDeclaration_NonVoidResultType) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %fn_ret_float = OpTypeFunction %float %100 = OpFunction %float None %fn_ret_float %entry = OpLabel @@ -75,7 +75,7 @@ TEST_F(SpvParserTest, EmitFunctionDeclaration_NonVoidResultType) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionDeclaration()); EXPECT_THAT(p->module().to_str(), HasSubstr(R"( @@ -86,7 +86,7 @@ TEST_F(SpvParserTest, EmitFunctionDeclaration_NonVoidResultType) { } TEST_F(SpvParserTest, EmitFunctionDeclaration_MixedParamTypes) { - auto* p = parser(test::Assemble(Names({"a", "b", "c"}) + CommonTypes() + R"( + auto p = parser(test::Assemble(Names({"a", "b", "c"}) + CommonTypes() + R"( %fn_mixed_params = OpTypeFunction %float %uint %float %int %100 = OpFunction %void None %fn_mixed_params @@ -98,7 +98,7 @@ TEST_F(SpvParserTest, EmitFunctionDeclaration_MixedParamTypes) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionDeclaration()); EXPECT_THAT(p->module().to_str(), HasSubstr(R"( @@ -125,7 +125,7 @@ TEST_F(SpvParserTest, EmitFunctionDeclaration_MixedParamTypes) { } TEST_F(SpvParserTest, EmitFunctionDeclaration_GenerateParamNames) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %fn_mixed_params = OpTypeFunction %float %uint %float %int %100 = OpFunction %void None %fn_mixed_params @@ -137,7 +137,7 @@ TEST_F(SpvParserTest, EmitFunctionDeclaration_GenerateParamNames) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionDeclaration()); EXPECT_THAT(p->module().to_str(), HasSubstr(R"( diff --git a/src/reader/spirv/function_glsl_std_450_test.cc b/src/reader/spirv/function_glsl_std_450_test.cc index e333e419ff..c5ee0cc45a 100644 --- a/src/reader/spirv/function_glsl_std_450_test.cc +++ b/src/reader/spirv/function_glsl_std_450_test.cc @@ -96,9 +96,9 @@ TEST_P(SpvParserTest_GlslStd450_Float_Floating, Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -127,9 +127,9 @@ TEST_P(SpvParserTest_GlslStd450_Float_Floating, Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -162,9 +162,9 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -194,9 +194,9 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -234,9 +234,9 @@ TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -265,9 +265,9 @@ TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -300,9 +300,9 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -332,9 +332,9 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -372,9 +372,9 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -406,9 +406,9 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ diff --git a/src/reader/spirv/function_logical_test.cc b/src/reader/spirv/function_logical_test.cc index e50915aeb8..1630a1f87f 100644 --- a/src/reader/spirv/function_logical_test.cc +++ b/src/reader/spirv/function_logical_test.cc @@ -202,9 +202,9 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -229,9 +229,9 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -282,11 +282,11 @@ TEST_P(SpvBinaryLogicalTest, EmitExpression) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); std::ostringstream ss; ss << R"(VariableConst{ @@ -697,9 +697,9 @@ TEST_F(SpvFUnordTest, FUnordEqual_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -728,9 +728,9 @@ TEST_F(SpvFUnordTest, FUnordEqual_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -767,9 +767,9 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -798,9 +798,9 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -837,9 +837,9 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -868,9 +868,9 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -907,9 +907,9 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -938,9 +938,9 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -977,9 +977,9 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -1008,9 +1008,9 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -1047,9 +1047,9 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -1078,9 +1078,9 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -1117,9 +1117,9 @@ TEST_F(SpvFUnordTest, Select_BoolCond_BoolParams) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -1148,9 +1148,9 @@ TEST_F(SpvFUnordTest, Select_BoolCond_IntScalarParams) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -1179,9 +1179,9 @@ TEST_F(SpvFUnordTest, Select_BoolCond_FloatScalarParams) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -1210,9 +1210,9 @@ TEST_F(SpvFUnordTest, Select_BoolCond_VectorParams) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -1249,9 +1249,9 @@ TEST_F(SpvFUnordTest, Select_VecBoolCond_VectorParams) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -1294,9 +1294,9 @@ TEST_F(SpvLogicalTest, Any) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -1327,9 +1327,9 @@ TEST_F(SpvLogicalTest, All) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -1360,9 +1360,9 @@ TEST_F(SpvLogicalTest, IsNan_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -1389,9 +1389,9 @@ TEST_F(SpvLogicalTest, IsNan_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -1422,9 +1422,9 @@ TEST_F(SpvLogicalTest, IsInf_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -1451,9 +1451,9 @@ TEST_F(SpvLogicalTest, IsInf_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ diff --git a/src/reader/spirv/function_memory_test.cc b/src/reader/spirv/function_memory_test.cc index 63013cfd07..86e51893f6 100644 --- a/src/reader/spirv/function_memory_test.cc +++ b/src/reader/spirv/function_memory_test.cc @@ -30,7 +30,7 @@ using ::testing::Eq; using ::testing::HasSubstr; TEST_F(SpvParserTest, EmitStatement_StoreBoolConst) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %ty = OpTypeBool @@ -48,7 +48,7 @@ TEST_F(SpvParserTest, EmitStatement_StoreBoolConst) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ Identifier[not set]{x_1} @@ -65,7 +65,7 @@ Assignment{ } TEST_F(SpvParserTest, EmitStatement_StoreUintConst) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %ty = OpTypeInt 32 0 @@ -80,7 +80,7 @@ TEST_F(SpvParserTest, EmitStatement_StoreUintConst) { OpReturn )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ Identifier[not set]{x_1} @@ -93,7 +93,7 @@ Assignment{ } TEST_F(SpvParserTest, EmitStatement_StoreIntConst) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %ty = OpTypeInt 32 1 @@ -108,7 +108,7 @@ TEST_F(SpvParserTest, EmitStatement_StoreIntConst) { OpReturn )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ Identifier[not set]{x_1} @@ -121,7 +121,7 @@ Assignment{ } TEST_F(SpvParserTest, EmitStatement_StoreFloatConst) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %ty = OpTypeFloat 32 @@ -136,7 +136,7 @@ TEST_F(SpvParserTest, EmitStatement_StoreFloatConst) { OpReturn )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ Identifier[not set]{x_1} @@ -149,7 +149,7 @@ Assignment{ } TEST_F(SpvParserTest, EmitStatement_LoadBool) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %ty = OpTypeBool @@ -165,7 +165,7 @@ TEST_F(SpvParserTest, EmitStatement_LoadBool) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( VariableConst{ @@ -179,7 +179,7 @@ TEST_F(SpvParserTest, EmitStatement_LoadBool) { } TEST_F(SpvParserTest, EmitStatement_LoadScalar) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %ty = OpTypeInt 32 0 @@ -194,7 +194,7 @@ TEST_F(SpvParserTest, EmitStatement_LoadScalar) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -219,7 +219,7 @@ VariableDeclStatement{ } TEST_F(SpvParserTest, EmitStatement_UseLoadedScalarTwice) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %ty = OpTypeInt 32 0 @@ -235,7 +235,7 @@ TEST_F(SpvParserTest, EmitStatement_UseLoadedScalarTwice) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -259,7 +259,7 @@ Assignment{ } TEST_F(SpvParserTest, EmitStatement_StoreToModuleScopeVar) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %ty = OpTypeInt 32 0 @@ -272,7 +272,7 @@ TEST_F(SpvParserTest, EmitStatement_StoreToModuleScopeVar) { OpReturn )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ Identifier[not set]{x_1} @@ -300,7 +300,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_NoOperands) { } TEST_F(SpvParserTest, EmitStatement_AccessChain_BaseIsNotPointer) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %voidfn = OpTypeFunction %void %10 = OpTypeInt 32 0 @@ -336,10 +336,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorSwizzle) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ MemberAccessor[not set]{ @@ -369,10 +369,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorConstOutOfBounds) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("Access chain %2 index %42 value 42 is out of " "bounds for vector of 4 elements")); @@ -399,10 +399,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorNonConstIndex) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ ArrayAccessor[not set]{ @@ -436,10 +436,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Matrix) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ ArrayAccessor[not set]{ @@ -479,10 +479,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Array) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ ArrayAccessor[not set]{ @@ -521,10 +521,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Struct) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ MemberAccessor[not set]{ @@ -569,10 +569,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Struct_DifferOnlyMemberName) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ MemberAccessor[not set]{ @@ -615,10 +615,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_StructNonConstIndex) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("Access chain %2 index %10 is a non-constant " "index into a structure %55")); @@ -646,10 +646,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_StructConstOutOfBounds) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), Eq("Access chain %2 index value 99 is out of bounds " "for structure %55 having 2 members")); @@ -679,10 +679,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Struct_RuntimeArray) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ ArrayAccessor[not set]{ @@ -719,10 +719,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Compound_Matrix_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ MemberAccessor[not set]{ @@ -754,10 +754,10 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_InvalidPointeeType) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_FALSE(fe.EmitBody()); EXPECT_THAT(p->error(), HasSubstr("Access chain with unknown or invalid pointee type " @@ -794,7 +794,7 @@ TEST_F(SpvParserTest, RemapStorageBuffer_TypesAndVarDeclarations) { // of the structure type, arrays of the structure, pointers to them, and // OpVariable of these. const auto assembly = OldStorageBufferPreamble(); - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); const auto module_str = p->module().to_str(); @@ -828,9 +828,9 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughAccessChain_NonCascaded) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModule()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ MemberAccessor[not set]{ @@ -867,9 +867,9 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughAccessChain_Cascaded) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModule()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ ArrayAccessor[not set]{ @@ -900,9 +900,9 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithoutHoisting) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModule()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -955,9 +955,9 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithHoisting) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModule()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ Variable{ diff --git a/src/reader/spirv/function_misc_test.cc b/src/reader/spirv/function_misc_test.cc index 64207b60dc..f5d1bd94de 100644 --- a/src/reader/spirv/function_misc_test.cc +++ b/src/reader/spirv/function_misc_test.cc @@ -63,9 +63,9 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Scalar) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -123,9 +123,9 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Vector) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -183,9 +183,9 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Matrix) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -224,9 +224,9 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -256,9 +256,9 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ VariableConst{ @@ -286,10 +286,10 @@ TEST_F(SpvParserTestMiscInstruction, OpNop) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Return{} )")) << ToString(fe.ast_body()); diff --git a/src/reader/spirv/function_var_test.cc b/src/reader/spirv/function_var_test.cc index 4c371082f4..b3e946daf2 100644 --- a/src/reader/spirv/function_var_test.cc +++ b/src/reader/spirv/function_var_test.cc @@ -78,7 +78,7 @@ std::string Preamble() { } TEST_F(SpvParserTest, EmitFunctionVariables_AnonymousVars) { - auto* p = parser(test::Assemble(Preamble() + R"( + auto p = parser(test::Assemble(Preamble() + R"( %100 = OpFunction %void None %voidfn %entry = OpLabel %1 = OpVariable %ptr_uint Function @@ -88,7 +88,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_AnonymousVars) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -116,7 +116,7 @@ VariableDeclStatement{ } TEST_F(SpvParserTest, EmitFunctionVariables_NamedVars) { - auto* p = parser(test::Assemble(Names({"a", "b", "c"}) + Preamble() + R"( + auto p = parser(test::Assemble(Names({"a", "b", "c"}) + Preamble() + R"( %100 = OpFunction %void None %voidfn %entry = OpLabel %a = OpVariable %ptr_uint Function @@ -126,7 +126,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_NamedVars) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -154,7 +154,7 @@ VariableDeclStatement{ } TEST_F(SpvParserTest, EmitFunctionVariables_MixedTypes) { - auto* p = parser(test::Assemble(Names({"a", "b", "c"}) + Preamble() + R"( + auto p = parser(test::Assemble(Names({"a", "b", "c"}) + Preamble() + R"( %100 = OpFunction %void None %voidfn %entry = OpLabel %a = OpVariable %ptr_uint Function @@ -164,7 +164,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_MixedTypes) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -192,7 +192,7 @@ VariableDeclStatement{ } TEST_F(SpvParserTest, EmitFunctionVariables_ScalarInitializers) { - auto* p = + auto p = parser(test::Assemble(Names({"a", "b", "c", "d", "e"}) + Preamble() + R"( %100 = OpFunction %void None %voidfn %entry = OpLabel @@ -205,7 +205,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ScalarInitializers) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -262,7 +262,7 @@ VariableDeclStatement{ } TEST_F(SpvParserTest, EmitFunctionVariables_ScalarNullInitializers) { - auto* p = parser(test::Assemble(Names({"a", "b", "c", "d"}) + Preamble() + R"( + auto p = parser(test::Assemble(Names({"a", "b", "c", "d"}) + Preamble() + R"( %null_bool = OpConstantNull %bool %null_int = OpConstantNull %int %null_uint = OpConstantNull %uint @@ -278,7 +278,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ScalarNullInitializers) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -325,7 +325,7 @@ VariableDeclStatement{ } TEST_F(SpvParserTest, EmitFunctionVariables_VectorInitializer) { - auto* p = parser(test::Assemble(Preamble() + R"( + auto p = parser(test::Assemble(Preamble() + R"( %ptr = OpTypePointer Function %v2float %two = OpConstant %float 2.0 %const = OpConstantComposite %v2float %float_1p5 %two @@ -337,7 +337,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_VectorInitializer) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -358,7 +358,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_VectorInitializer) { } TEST_F(SpvParserTest, EmitFunctionVariables_MatrixInitializer) { - auto* p = parser(test::Assemble(Preamble() + R"( + auto p = parser(test::Assemble(Preamble() + R"( %ptr = OpTypePointer Function %m3v2float %two = OpConstant %float 2.0 %three = OpConstant %float 3.0 @@ -375,7 +375,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_MatrixInitializer) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -409,7 +409,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_MatrixInitializer) { } TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer) { - auto* p = parser(test::Assemble(Preamble() + R"( + auto p = parser(test::Assemble(Preamble() + R"( %ptr = OpTypePointer Function %arr2uint %two = OpConstant %uint 2 %const = OpConstantComposite %arr2uint %uint_1 %two @@ -421,7 +421,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -442,7 +442,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer) { } TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_AliasType) { - auto* p = parser(test::Assemble( + auto p = parser(test::Assemble( std::string("OpDecorate %arr2uint ArrayStride 16\n") + Preamble() + R"( %ptr = OpTypePointer Function %arr2uint %two = OpConstant %uint 2 @@ -455,7 +455,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_AliasType) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -476,7 +476,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_AliasType) { } TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Null) { - auto* p = parser(test::Assemble(Preamble() + R"( + auto p = parser(test::Assemble(Preamble() + R"( %ptr = OpTypePointer Function %arr2uint %two = OpConstant %uint 2 %const = OpConstantNull %arr2uint @@ -488,7 +488,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Null) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -509,7 +509,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Null) { } TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_AliasType_Null) { - auto* p = parser(test::Assemble( + auto p = parser(test::Assemble( std::string("OpDecorate %arr2uint ArrayStride 16\n") + Preamble() + R"( %ptr = OpTypePointer Function %arr2uint %two = OpConstant %uint 2 @@ -522,7 +522,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_AliasType_Null) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -543,7 +543,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_AliasType_Null) { } TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer) { - auto* p = parser(test::Assemble(Preamble() + R"( + auto p = parser(test::Assemble(Preamble() + R"( %ptr = OpTypePointer Function %strct %two = OpConstant %uint 2 %arrconst = OpConstantComposite %arr2uint %uint_1 %two @@ -556,7 +556,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -582,7 +582,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer) { } TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer_Null) { - auto* p = parser(test::Assemble(Preamble() + R"( + auto p = parser(test::Assemble(Preamble() + R"( %ptr = OpTypePointer Function %strct %two = OpConstant %uint 2 %arrconst = OpConstantComposite %arr2uint %uint_1 %two @@ -595,7 +595,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer_Null) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitFunctionVariables()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{ @@ -637,9 +637,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ @@ -682,9 +682,9 @@ TEST_F(SpvParserTest, EmitStatement_CombinatorialValue_Immediate_UsedTwice) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ @@ -752,9 +752,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ @@ -849,9 +849,9 @@ TEST_F( OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ @@ -963,9 +963,9 @@ TEST_F( OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); // We don't hoist x_1 into its own mutable variable. It is emitted as @@ -1048,9 +1048,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{ @@ -1133,9 +1133,9 @@ TEST_F( OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{ @@ -1212,9 +1212,9 @@ TEST_F(SpvParserTest, OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); // We don't hoist x_1 into its own mutable variable. It is emitted as @@ -1286,9 +1286,9 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -1428,9 +1428,9 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{ @@ -1583,10 +1583,10 @@ TEST_F(SpvParserTest, EmitStatement_Phi_ValueFromLoopBodyAndContinuing) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ @@ -1752,9 +1752,9 @@ TEST_F(SpvParserTest, EmitStatement_Phi_FromElseAndThen) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ @@ -1872,9 +1872,9 @@ TEST_F(SpvParserTest, EmitStatement_Phi_FromHeaderAndThen) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ @@ -1978,9 +1978,9 @@ TEST_F(SpvParserTest, EmitStatement_UseInPhiCountsAsUse) { OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly; - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{ diff --git a/src/reader/spirv/parser_impl_convert_member_decoration_test.cc b/src/reader/spirv/parser_impl_convert_member_decoration_test.cc index aa7542425c..9f95d0a394 100644 --- a/src/reader/spirv/parser_impl_convert_member_decoration_test.cc +++ b/src/reader/spirv/parser_impl_convert_member_decoration_test.cc @@ -32,7 +32,7 @@ namespace { using ::testing::Eq; TEST_F(SpvParserTest, ConvertMemberDecoration_Empty) { - auto* p = parser(std::vector{}); + auto p = parser(std::vector{}); auto* result = p->ConvertMemberDecoration(1, 1, {}); EXPECT_EQ(result, nullptr); @@ -40,7 +40,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_Empty) { } TEST_F(SpvParserTest, ConvertMemberDecoration_OffsetWithoutOperand) { - auto* p = parser(std::vector{}); + auto p = parser(std::vector{}); auto* result = p->ConvertMemberDecoration(12, 13, {SpvDecorationOffset}); EXPECT_EQ(result, nullptr); @@ -49,7 +49,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_OffsetWithoutOperand) { } TEST_F(SpvParserTest, ConvertMemberDecoration_OffsetWithTooManyOperands) { - auto* p = parser(std::vector{}); + auto p = parser(std::vector{}); auto* result = p->ConvertMemberDecoration(12, 13, {SpvDecorationOffset, 3, 4}); @@ -59,7 +59,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_OffsetWithTooManyOperands) { } TEST_F(SpvParserTest, ConvertMemberDecoration_Offset) { - auto* p = parser(std::vector{}); + auto p = parser(std::vector{}); auto* result = p->ConvertMemberDecoration(1, 1, {SpvDecorationOffset, 8}); ASSERT_NE(result, nullptr); @@ -71,7 +71,7 @@ TEST_F(SpvParserTest, ConvertMemberDecoration_Offset) { } TEST_F(SpvParserTest, ConvertMemberDecoration_UnhandledDecoration) { - auto* p = parser(std::vector{}); + auto p = parser(std::vector{}); auto* result = p->ConvertMemberDecoration(12, 13, {12345678}); EXPECT_EQ(result, nullptr); diff --git a/src/reader/spirv/parser_impl_convert_type_test.cc b/src/reader/spirv/parser_impl_convert_type_test.cc index aaba532a6a..5cbb1e0192 100644 --- a/src/reader/spirv/parser_impl_convert_type_test.cc +++ b/src/reader/spirv/parser_impl_convert_type_test.cc @@ -37,7 +37,7 @@ namespace { using ::testing::Eq; TEST_F(SpvParserTest, ConvertType_PreservesExistingFailure) { - auto* p = parser(std::vector{}); + auto p = parser(std::vector{}); p->Fail() << "boing"; auto* type = p->ConvertType(10); EXPECT_EQ(type, nullptr); @@ -45,7 +45,7 @@ TEST_F(SpvParserTest, ConvertType_PreservesExistingFailure) { } TEST_F(SpvParserTest, ConvertType_RequiresInternalRepresntation) { - auto* p = parser(std::vector{}); + auto p = parser(std::vector{}); auto* type = p->ConvertType(10); EXPECT_EQ(type, nullptr); EXPECT_THAT( @@ -54,7 +54,7 @@ TEST_F(SpvParserTest, ConvertType_RequiresInternalRepresntation) { } TEST_F(SpvParserTest, ConvertType_NotAnId) { - auto* p = parser(test::Assemble("%1 = OpExtInstImport \"GLSL.std.450\"")); + auto p = parser(test::Assemble("%1 = OpExtInstImport \"GLSL.std.450\"")); EXPECT_TRUE(p->BuildInternalModule()); auto* type = p->ConvertType(10); @@ -64,7 +64,7 @@ TEST_F(SpvParserTest, ConvertType_NotAnId) { } TEST_F(SpvParserTest, ConvertType_IdExistsButIsNotAType) { - auto* p = parser(test::Assemble("%1 = OpExtInstImport \"GLSL.std.450\"")); + auto p = parser(test::Assemble("%1 = OpExtInstImport \"GLSL.std.450\"")); EXPECT_TRUE(p->BuildInternalModule()); auto* type = p->ConvertType(1); @@ -74,7 +74,7 @@ TEST_F(SpvParserTest, ConvertType_IdExistsButIsNotAType) { TEST_F(SpvParserTest, ConvertType_UnhandledType) { // Pipes are an OpenCL type. Tint doesn't support them. - auto* p = parser(test::Assemble("%70 = OpTypePipe WriteOnly")); + auto p = parser(test::Assemble("%70 = OpTypePipe WriteOnly")); EXPECT_TRUE(p->BuildInternalModule()); auto* type = p->ConvertType(70); @@ -84,7 +84,7 @@ TEST_F(SpvParserTest, ConvertType_UnhandledType) { } TEST_F(SpvParserTest, ConvertType_Void) { - auto* p = parser(test::Assemble("%1 = OpTypeVoid")); + auto p = parser(test::Assemble("%1 = OpTypeVoid")); EXPECT_TRUE(p->BuildInternalModule()); auto* type = p->ConvertType(1); @@ -93,7 +93,7 @@ TEST_F(SpvParserTest, ConvertType_Void) { } TEST_F(SpvParserTest, ConvertType_Bool) { - auto* p = parser(test::Assemble("%100 = OpTypeBool")); + auto p = parser(test::Assemble("%100 = OpTypeBool")); EXPECT_TRUE(p->BuildInternalModule()); auto* type = p->ConvertType(100); @@ -102,7 +102,7 @@ TEST_F(SpvParserTest, ConvertType_Bool) { } TEST_F(SpvParserTest, ConvertType_I32) { - auto* p = parser(test::Assemble("%2 = OpTypeInt 32 1")); + auto p = parser(test::Assemble("%2 = OpTypeInt 32 1")); EXPECT_TRUE(p->BuildInternalModule()); auto* type = p->ConvertType(2); @@ -111,7 +111,7 @@ TEST_F(SpvParserTest, ConvertType_I32) { } TEST_F(SpvParserTest, ConvertType_U32) { - auto* p = parser(test::Assemble("%3 = OpTypeInt 32 0")); + auto p = parser(test::Assemble("%3 = OpTypeInt 32 0")); EXPECT_TRUE(p->BuildInternalModule()); auto* type = p->ConvertType(3); @@ -120,7 +120,7 @@ TEST_F(SpvParserTest, ConvertType_U32) { } TEST_F(SpvParserTest, ConvertType_F32) { - auto* p = parser(test::Assemble("%4 = OpTypeFloat 32")); + auto p = parser(test::Assemble("%4 = OpTypeFloat 32")); EXPECT_TRUE(p->BuildInternalModule()); auto* type = p->ConvertType(4); @@ -129,7 +129,7 @@ TEST_F(SpvParserTest, ConvertType_F32) { } TEST_F(SpvParserTest, ConvertType_BadIntWidth) { - auto* p = parser(test::Assemble("%5 = OpTypeInt 17 1")); + auto p = parser(test::Assemble("%5 = OpTypeInt 17 1")); EXPECT_TRUE(p->BuildInternalModule()); auto* type = p->ConvertType(5); @@ -138,7 +138,7 @@ TEST_F(SpvParserTest, ConvertType_BadIntWidth) { } TEST_F(SpvParserTest, ConvertType_BadFloatWidth) { - auto* p = parser(test::Assemble("%6 = OpTypeFloat 19")); + auto p = parser(test::Assemble("%6 = OpTypeFloat 19")); EXPECT_TRUE(p->BuildInternalModule()); auto* type = p->ConvertType(6); @@ -147,7 +147,7 @@ TEST_F(SpvParserTest, ConvertType_BadFloatWidth) { } TEST_F(SpvParserTest, DISABLED_ConvertType_InvalidVectorElement) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %5 = OpTypePipe ReadOnly %20 = OpTypeVector %5 2 )")); @@ -159,7 +159,7 @@ TEST_F(SpvParserTest, DISABLED_ConvertType_InvalidVectorElement) { } TEST_F(SpvParserTest, ConvertType_VecOverF32) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %20 = OpTypeVector %float 2 %30 = OpTypeVector %float 3 @@ -186,7 +186,7 @@ TEST_F(SpvParserTest, ConvertType_VecOverF32) { } TEST_F(SpvParserTest, ConvertType_VecOverI32) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %int = OpTypeInt 32 1 %20 = OpTypeVector %int 2 %30 = OpTypeVector %int 3 @@ -213,7 +213,7 @@ TEST_F(SpvParserTest, ConvertType_VecOverI32) { } TEST_F(SpvParserTest, ConvertType_VecOverU32) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %uint = OpTypeInt 32 0 %20 = OpTypeVector %uint 2 %30 = OpTypeVector %uint 3 @@ -240,7 +240,7 @@ TEST_F(SpvParserTest, ConvertType_VecOverU32) { } TEST_F(SpvParserTest, DISABLED_ConvertType_InvalidMatrixElement) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %5 = OpTypePipe ReadOnly %10 = OpTypeVector %5 2 %20 = OpTypeMatrix %10 2 @@ -254,7 +254,7 @@ TEST_F(SpvParserTest, DISABLED_ConvertType_InvalidMatrixElement) { TEST_F(SpvParserTest, ConvertType_MatrixOverF32) { // Matrices are only defined over floats. - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %v2 = OpTypeVector %float 2 %v3 = OpTypeVector %float 3 @@ -331,7 +331,7 @@ TEST_F(SpvParserTest, ConvertType_MatrixOverF32) { } TEST_F(SpvParserTest, ConvertType_RuntimeArray) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %uint = OpTypeInt 32 0 %10 = OpTypeRuntimeArray %uint )")); @@ -353,7 +353,7 @@ TEST_F(SpvParserTest, ConvertType_RuntimeArray) { } TEST_F(SpvParserTest, ConvertType_RuntimeArray_InvalidDecoration) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %10 Block %uint = OpTypeInt 32 0 %10 = OpTypeRuntimeArray %uint @@ -367,7 +367,7 @@ TEST_F(SpvParserTest, ConvertType_RuntimeArray_InvalidDecoration) { } TEST_F(SpvParserTest, ConvertType_RuntimeArray_ArrayStride_Valid) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %10 ArrayStride 64 %uint = OpTypeInt 32 0 %10 = OpTypeRuntimeArray %uint @@ -384,7 +384,7 @@ TEST_F(SpvParserTest, ConvertType_RuntimeArray_ArrayStride_Valid) { } TEST_F(SpvParserTest, ConvertType_RuntimeArray_ArrayStride_ZeroIsError) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %10 ArrayStride 0 %uint = OpTypeInt 32 0 %10 = OpTypeRuntimeArray %uint @@ -398,7 +398,7 @@ TEST_F(SpvParserTest, ConvertType_RuntimeArray_ArrayStride_ZeroIsError) { TEST_F(SpvParserTest, ConvertType_RuntimeArray_ArrayStride_SpecifiedTwiceIsError) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %10 ArrayStride 64 OpDecorate %10 ArrayStride 64 %uint = OpTypeInt 32 0 @@ -412,7 +412,7 @@ TEST_F(SpvParserTest, } TEST_F(SpvParserTest, ConvertType_Array) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %uint = OpTypeInt 32 0 %uint_42 = OpConstant %uint 42 %10 = OpTypeArray %uint %uint_42 @@ -435,7 +435,7 @@ TEST_F(SpvParserTest, ConvertType_Array) { } TEST_F(SpvParserTest, ConvertType_ArrayBadLengthIsSpecConstantValue) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %uint_42 SpecId 12 %uint = OpTypeInt 32 0 %uint_42 = OpSpecConstant %uint 42 @@ -450,7 +450,7 @@ TEST_F(SpvParserTest, ConvertType_ArrayBadLengthIsSpecConstantValue) { } TEST_F(SpvParserTest, ConvertType_ArrayBadLengthIsSpecConstantExpr) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %uint = OpTypeInt 32 0 %uint_42 = OpConstant %uint 42 %sum = OpSpecConstantOp %uint IAdd %uint_42 %uint_42 @@ -469,7 +469,7 @@ TEST_F(SpvParserTest, ConvertType_ArrayBadLengthIsSpecConstantExpr) { // optimizer representation doesn't handle it and asserts out instead. TEST_F(SpvParserTest, ConvertType_ArrayBadTooBig) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %uint64 = OpTypeInt 64 0 %uint64_big = OpConstant %uint64 5000000000 %10 = OpTypeArray %uint64 %uint64_big @@ -484,7 +484,7 @@ TEST_F(SpvParserTest, ConvertType_ArrayBadTooBig) { } TEST_F(SpvParserTest, ConvertType_Array_InvalidDecoration) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %10 Block %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 @@ -499,7 +499,7 @@ TEST_F(SpvParserTest, ConvertType_Array_InvalidDecoration) { } TEST_F(SpvParserTest, ConvertType_ArrayStride_Valid) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %10 ArrayStride 8 %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 @@ -518,7 +518,7 @@ TEST_F(SpvParserTest, ConvertType_ArrayStride_Valid) { } TEST_F(SpvParserTest, ConvertType_ArrayStride_ZeroIsError) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %10 ArrayStride 0 %uint = OpTypeInt 32 0 %uint_5 = OpConstant %uint 5 @@ -533,7 +533,7 @@ TEST_F(SpvParserTest, ConvertType_ArrayStride_ZeroIsError) { } TEST_F(SpvParserTest, ConvertType_ArrayStride_SpecifiedTwiceIsError) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %10 ArrayStride 4 OpDecorate %10 ArrayStride 4 %uint = OpTypeInt 32 0 @@ -549,7 +549,7 @@ TEST_F(SpvParserTest, ConvertType_ArrayStride_SpecifiedTwiceIsError) { } TEST_F(SpvParserTest, ConvertType_StructTwoMembers) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %uint = OpTypeInt 32 0 %float = OpTypeFloat 32 %10 = OpTypeStruct %uint %float @@ -570,7 +570,7 @@ TEST_F(SpvParserTest, ConvertType_StructTwoMembers) { } TEST_F(SpvParserTest, ConvertType_StructWithBlockDecoration) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %10 Block %uint = OpTypeInt 32 0 %10 = OpTypeStruct %uint @@ -591,7 +591,7 @@ TEST_F(SpvParserTest, ConvertType_StructWithBlockDecoration) { } TEST_F(SpvParserTest, ConvertType_StructWithMemberDecorations) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpMemberDecorate %10 0 Offset 0 OpMemberDecorate %10 1 Offset 8 OpMemberDecorate %10 2 Offset 16 @@ -623,7 +623,7 @@ TEST_F(SpvParserTest, ConvertType_StructWithMemberDecorations) { TEST_F(SpvParserTest, ConvertType_InvalidPointeetype) { // Disallow pointer-to-function - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %void = OpTypeVoid %42 = OpTypeFunction %void %3 = OpTypePointer Input %42 @@ -638,7 +638,7 @@ TEST_F(SpvParserTest, ConvertType_InvalidPointeetype) { TEST_F(SpvParserTest, DISABLED_ConvertType_InvalidStorageClass) { // Disallow invalid storage class - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %1 = OpTypeFloat 32 %3 = OpTypePointer !999 %1 ; Special syntax to inject 999 as the storage class )")); @@ -647,7 +647,7 @@ TEST_F(SpvParserTest, DISABLED_ConvertType_InvalidStorageClass) { } TEST_F(SpvParserTest, ConvertType_PointerInput) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %3 = OpTypePointer Input %float )")); @@ -663,7 +663,7 @@ TEST_F(SpvParserTest, ConvertType_PointerInput) { } TEST_F(SpvParserTest, ConvertType_PointerOutput) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %3 = OpTypePointer Output %float )")); @@ -679,7 +679,7 @@ TEST_F(SpvParserTest, ConvertType_PointerOutput) { } TEST_F(SpvParserTest, ConvertType_PointerUniform) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %3 = OpTypePointer Uniform %float )")); @@ -695,7 +695,7 @@ TEST_F(SpvParserTest, ConvertType_PointerUniform) { } TEST_F(SpvParserTest, ConvertType_PointerWorkgroup) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %3 = OpTypePointer Workgroup %float )")); @@ -711,7 +711,7 @@ TEST_F(SpvParserTest, ConvertType_PointerWorkgroup) { } TEST_F(SpvParserTest, ConvertType_PointerUniformConstant) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %3 = OpTypePointer UniformConstant %float )")); @@ -727,7 +727,7 @@ TEST_F(SpvParserTest, ConvertType_PointerUniformConstant) { } TEST_F(SpvParserTest, ConvertType_PointerStorageBuffer) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %3 = OpTypePointer StorageBuffer %float )")); @@ -743,7 +743,7 @@ TEST_F(SpvParserTest, ConvertType_PointerStorageBuffer) { } TEST_F(SpvParserTest, ConvertType_PointerImage) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %3 = OpTypePointer Image %float )")); @@ -759,7 +759,7 @@ TEST_F(SpvParserTest, ConvertType_PointerImage) { } TEST_F(SpvParserTest, ConvertType_PointerPrivate) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %3 = OpTypePointer Private %float )")); @@ -775,7 +775,7 @@ TEST_F(SpvParserTest, ConvertType_PointerPrivate) { } TEST_F(SpvParserTest, ConvertType_PointerFunction) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %3 = OpTypePointer Function %float )")); @@ -792,7 +792,7 @@ TEST_F(SpvParserTest, ConvertType_PointerFunction) { TEST_F(SpvParserTest, ConvertType_PointerToPointer) { // FYI: The reader suports pointer-to-pointer even while WebGPU does not. - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %42 = OpTypePointer Output %float %3 = OpTypePointer Input %42 @@ -818,7 +818,7 @@ TEST_F(SpvParserTest, ConvertType_PointerToPointer) { TEST_F(SpvParserTest, ConvertType_Sampler_PretendVoid) { // We fake the type suport for samplers, images, and sampled images. - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %1 = OpTypeSampler )")); EXPECT_TRUE(p->BuildInternalModule()); @@ -830,7 +830,7 @@ TEST_F(SpvParserTest, ConvertType_Sampler_PretendVoid) { TEST_F(SpvParserTest, ConvertType_Image_PretendVoid) { // We fake the type suport for samplers, images, and sampled images. - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %1 = OpTypeImage %float 2D 0 0 0 1 Unknown )")); @@ -842,7 +842,7 @@ TEST_F(SpvParserTest, ConvertType_Image_PretendVoid) { } TEST_F(SpvParserTest, ConvertType_SampledImage_PretendVoid) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %im = OpTypeImage %float 2D 0 0 0 1 Unknown %1 = OpTypeSampledImage %im diff --git a/src/reader/spirv/parser_impl_function_decl_test.cc b/src/reader/spirv/parser_impl_function_decl_test.cc index f03fd2b519..f322de25a9 100644 --- a/src/reader/spirv/parser_impl_function_decl_test.cc +++ b/src/reader/spirv/parser_impl_function_decl_test.cc @@ -50,7 +50,7 @@ std::string CommonTypes() { } TEST_F(SpvParserTest, EmitFunctions_NoFunctions) { - auto* p = parser(test::Assemble(CommonTypes())); + auto p = parser(test::Assemble(CommonTypes())); EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_TRUE(p->error().empty()); const auto module_ast = p->module().to_str(); @@ -58,7 +58,7 @@ TEST_F(SpvParserTest, EmitFunctions_NoFunctions) { } TEST_F(SpvParserTest, EmitFunctions_FunctionWithoutBody) { - auto* p = parser(test::Assemble(Names({"main"}) + CommonTypes() + R"( + auto p = parser(test::Assemble(Names({"main"}) + CommonTypes() + R"( %main = OpFunction %void None %voidfn OpFunctionEnd )")); @@ -76,7 +76,7 @@ TEST_F(SpvParserTest, EmitFunctions_Function_EntryPoint_Vertex) { OpReturn OpFunctionEnd)"; - auto* p = parser(test::Assemble(input)); + auto p = parser(test::Assemble(input)); ASSERT_TRUE(p->BuildAndParseInternalModule()); ASSERT_TRUE(p->error().empty()) << p->error(); const auto module_ast = p->module().to_str(); @@ -95,7 +95,7 @@ TEST_F(SpvParserTest, EmitFunctions_Function_EntryPoint_Fragment) { OpReturn OpFunctionEnd)"; - auto* p = parser(test::Assemble(input)); + auto p = parser(test::Assemble(input)); ASSERT_TRUE(p->BuildAndParseInternalModule()); ASSERT_TRUE(p->error().empty()) << p->error(); const auto module_ast = p->module().to_str(); @@ -114,7 +114,7 @@ TEST_F(SpvParserTest, EmitFunctions_Function_EntryPoint_GLCompute) { OpReturn OpFunctionEnd)"; - auto* p = parser(test::Assemble(input)); + auto p = parser(test::Assemble(input)); ASSERT_TRUE(p->BuildAndParseInternalModule()); ASSERT_TRUE(p->error().empty()) << p->error(); const auto module_ast = p->module().to_str(); @@ -135,7 +135,7 @@ OpEntryPoint Fragment %main "frag_main" OpReturn OpFunctionEnd)"; - auto* p = parser(test::Assemble(input)); + auto p = parser(test::Assemble(input)); ASSERT_TRUE(p->BuildAndParseInternalModule()); ASSERT_TRUE(p->error().empty()) << p->error(); const auto module_ast = p->module().to_str(); @@ -152,7 +152,7 @@ OpFunctionEnd)"; } TEST_F(SpvParserTest, EmitFunctions_VoidFunctionWithoutParams) { - auto* p = parser(test::Assemble(Names({"main"}) + CommonTypes() + R"( + auto p = parser(test::Assemble(Names({"main"}) + CommonTypes() + R"( %main = OpFunction %void None %voidfn %entry = OpLabel OpReturn @@ -168,7 +168,7 @@ TEST_F(SpvParserTest, EmitFunctions_VoidFunctionWithoutParams) { } TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) { - auto* p = parser(test::Assemble( + auto p = parser(test::Assemble( Names({"root", "branch", "leaf", "leaf_result", "branch_result"}) + CommonTypes() + R"( %uintfn = OpTypeFunction %uint @@ -250,7 +250,7 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) { } TEST_F(SpvParserTest, EmitFunctions_NonVoidResultType) { - auto* p = parser(test::Assemble(Names({"ret_float"}) + CommonTypes() + R"( + auto p = parser(test::Assemble(Names({"ret_float"}) + CommonTypes() + R"( %fn_ret_float = OpTypeFunction %float %ret_float = OpFunction %float None %fn_ret_float @@ -275,8 +275,8 @@ TEST_F(SpvParserTest, EmitFunctions_NonVoidResultType) { } TEST_F(SpvParserTest, EmitFunctions_MixedParamTypes) { - auto* p = parser(test::Assemble(Names({"mixed_params", "a", "b", "c"}) + - CommonTypes() + R"( + auto p = parser(test::Assemble(Names({"mixed_params", "a", "b", "c"}) + + CommonTypes() + R"( %fn_mixed_params = OpTypeFunction %float %uint %float %int %mixed_params = OpFunction %void None %fn_mixed_params @@ -315,7 +315,7 @@ TEST_F(SpvParserTest, EmitFunctions_MixedParamTypes) { } TEST_F(SpvParserTest, EmitFunctions_GenerateParamNames) { - auto* p = parser(test::Assemble(Names({"mixed_params"}) + CommonTypes() + R"( + auto p = parser(test::Assemble(Names({"mixed_params"}) + CommonTypes() + R"( %fn_mixed_params = OpTypeFunction %float %uint %float %int %mixed_params = OpFunction %void None %fn_mixed_params diff --git a/src/reader/spirv/parser_impl_get_decorations_test.cc b/src/reader/spirv/parser_impl_get_decorations_test.cc index 542332c662..113a7a79f3 100644 --- a/src/reader/spirv/parser_impl_get_decorations_test.cc +++ b/src/reader/spirv/parser_impl_get_decorations_test.cc @@ -27,7 +27,7 @@ using ::testing::Eq; using ::testing::UnorderedElementsAre; TEST_F(SpvParserTest, GetDecorationsFor_NotAnId) { - auto* p = parser(test::Assemble("")); + auto p = parser(test::Assemble("")); EXPECT_TRUE(p->BuildAndParseInternalModule()); auto decorations = p->GetDecorationsFor(42); EXPECT_TRUE(decorations.empty()); @@ -35,7 +35,7 @@ TEST_F(SpvParserTest, GetDecorationsFor_NotAnId) { } TEST_F(SpvParserTest, GetDecorationsFor_NoDecorations) { - auto* p = parser(test::Assemble("%1 = OpTypeVoid")); + auto p = parser(test::Assemble("%1 = OpTypeVoid")); EXPECT_TRUE(p->BuildAndParseInternalModule()); auto decorations = p->GetDecorationsFor(1); EXPECT_TRUE(decorations.empty()); @@ -43,7 +43,7 @@ TEST_F(SpvParserTest, GetDecorationsFor_NoDecorations) { } TEST_F(SpvParserTest, GetDecorationsFor_OneDecoration) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %10 Block %float = OpTypeFloat 32 %10 = OpTypeStruct %float @@ -56,7 +56,7 @@ TEST_F(SpvParserTest, GetDecorationsFor_OneDecoration) { } TEST_F(SpvParserTest, GetDecorationsFor_MultiDecoration) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %5 RelaxedPrecision OpDecorate %5 Location 7 ; Invalid case made up for test %float = OpTypeFloat 32 @@ -71,7 +71,7 @@ TEST_F(SpvParserTest, GetDecorationsFor_MultiDecoration) { } TEST_F(SpvParserTest, GetDecorationsForMember_NotAnId) { - auto* p = parser(test::Assemble("")); + auto p = parser(test::Assemble("")); EXPECT_TRUE(p->BuildAndParseInternalModule()); auto decorations = p->GetDecorationsForMember(42, 9); EXPECT_TRUE(decorations.empty()); @@ -79,7 +79,7 @@ TEST_F(SpvParserTest, GetDecorationsForMember_NotAnId) { } TEST_F(SpvParserTest, GetDecorationsForMember_NotAStruct) { - auto* p = parser(test::Assemble("%1 = OpTypeVoid")); + auto p = parser(test::Assemble("%1 = OpTypeVoid")); EXPECT_TRUE(p->BuildAndParseInternalModule()); auto decorations = p->GetDecorationsFor(1); EXPECT_TRUE(decorations.empty()); @@ -87,7 +87,7 @@ TEST_F(SpvParserTest, GetDecorationsForMember_NotAStruct) { } TEST_F(SpvParserTest, GetDecorationsForMember_MemberWithoutDecoration) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %uint = OpTypeInt 32 0 %10 = OpTypeStruct %uint )")); @@ -99,7 +99,7 @@ TEST_F(SpvParserTest, GetDecorationsForMember_MemberWithoutDecoration) { // TODO(dneto): Enable when ArrayStride is handled TEST_F(SpvParserTest, DISABLED_GetDecorationsForMember_OneDecoration) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpMemberDecorate %10 1 ArrayStride 12 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 @@ -117,7 +117,7 @@ TEST_F(SpvParserTest, DISABLED_GetDecorationsForMember_OneDecoration) { // crbug.com/tint/30 for ArrayStride // crbug.com/tint/31 for matrix layout TEST_F(SpvParserTest, DISABLED_GetDecorationsForMember_MultiDecoration) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpMemberDecorate %50 1 RelaxedPrecision OpMemberDecorate %50 2 ArrayStride 16 OpMemberDecorate %50 2 MatrixStride 8 diff --git a/src/reader/spirv/parser_impl_handle_test.cc b/src/reader/spirv/parser_impl_handle_test.cc index 8026e766ad..4a84da378b 100644 --- a/src/reader/spirv/parser_impl_handle_test.cc +++ b/src/reader/spirv/parser_impl_handle_test.cc @@ -195,7 +195,7 @@ TEST_F(SpvParserTest, %10 = OpConstantNull %ptr_sampler %20 = OpConstantNull %ptr_f_texture_1d )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(10, false); const auto* image = p->GetMemoryObjectDeclarationForHandle(20, true); @@ -210,7 +210,7 @@ TEST_F(SpvParserTest, GetMemoryObjectDeclarationForHandle_Variable_Direct) { %10 = OpVariable %ptr_sampler UniformConstant %20 = OpVariable %ptr_f_texture_1d UniformConstant )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(10, false); @@ -247,7 +247,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -282,7 +282,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -319,7 +319,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -354,7 +354,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -382,7 +382,7 @@ TEST_F(SpvParserTest, GetMemoryObjectDeclarationForHandle_Variable_CopyObject) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -410,7 +410,7 @@ TEST_F(SpvParserTest, GetMemoryObjectDeclarationForHandle_Variable_Load) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -443,7 +443,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(100, false); @@ -474,7 +474,7 @@ TEST_F(SpvParserTest, GetMemoryObjectDeclarationForHandle_Variable_Image) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); @@ -493,7 +493,7 @@ TEST_F(SpvParserTest, GetMemoryObjectDeclarationForHandle_FuncParam_Direct) { %entry = OpLabel OpReturn )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(10, false); @@ -530,7 +530,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -565,7 +565,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -602,7 +602,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -637,7 +637,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -666,7 +666,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -694,7 +694,7 @@ TEST_F(SpvParserTest, GetMemoryObjectDeclarationForHandle_FuncParam_Load) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(110, false); @@ -728,7 +728,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); const auto* sampler = p->GetMemoryObjectDeclarationForHandle(100, false); @@ -760,7 +760,7 @@ TEST_F(SpvParserTest, GetMemoryObjectDeclarationForHandle_FuncParam_Image) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->error().empty()); @@ -804,7 +804,7 @@ TEST_P(SpvParserTest_RegisterHandleUsage_SampledImage, Variable) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->RegisterHandleUsage()); EXPECT_TRUE(p->error().empty()); @@ -844,7 +844,7 @@ TEST_P(SpvParserTest_RegisterHandleUsage_SampledImage, FunctionParam) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()) << p->error() << assembly << std::endl; EXPECT_TRUE(p->RegisterHandleUsage()) << p->error() << assembly << std::endl; EXPECT_TRUE(p->error().empty()) << p->error() << assembly << std::endl; @@ -953,7 +953,7 @@ TEST_P(SpvParserTest_RegisterHandleUsage_RawImage, Variable) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->RegisterHandleUsage()); EXPECT_TRUE(p->error().empty()); @@ -990,7 +990,7 @@ TEST_P(SpvParserTest_RegisterHandleUsage_RawImage, FunctionParam) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildInternalModule()); EXPECT_TRUE(p->RegisterHandleUsage()); EXPECT_TRUE(p->error().empty()); diff --git a/src/reader/spirv/parser_impl_import_test.cc b/src/reader/spirv/parser_impl_import_test.cc index b72445bf91..cb01dff2f1 100644 --- a/src/reader/spirv/parser_impl_import_test.cc +++ b/src/reader/spirv/parser_impl_import_test.cc @@ -32,7 +32,7 @@ using ::testing::Not; using ::testing::UnorderedElementsAre; TEST_F(SpvParserTest, Import_NoImport) { - auto* p = parser(test::Assemble("%1 = OpTypeVoid")); + auto p = parser(test::Assemble("%1 = OpTypeVoid")); EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_TRUE(p->error().empty()); const auto module_ast = p->module().to_str(); @@ -40,7 +40,7 @@ TEST_F(SpvParserTest, Import_NoImport) { } TEST_F(SpvParserTest, Import_ImportGlslStd450) { - auto* p = parser(test::Assemble(R"(%1 = OpExtInstImport "GLSL.std.450")")); + auto p = parser(test::Assemble(R"(%1 = OpExtInstImport "GLSL.std.450")")); EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_TRUE(p->error().empty()); EXPECT_THAT(p->glsl_std_450_imports(), ElementsAre(1)); diff --git a/src/reader/spirv/parser_impl_module_var_test.cc b/src/reader/spirv/parser_impl_module_var_test.cc index 423541240f..b80dc1599b 100644 --- a/src/reader/spirv/parser_impl_module_var_test.cc +++ b/src/reader/spirv/parser_impl_module_var_test.cc @@ -64,7 +64,7 @@ std::string CommonTypes() { } TEST_F(SpvParserTest, ModuleScopeVar_NoVar) { - auto* p = parser(test::Assemble("")); + auto p = parser(test::Assemble("")); EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_TRUE(p->error().empty()); const auto module_ast = p->module().to_str(); @@ -72,7 +72,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_NoVar) { } TEST_F(SpvParserTest, ModuleScopeVar_BadStorageClass_NotAWebGPUStorageClass) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %ptr = OpTypePointer CrossWorkgroup %float %52 = OpVariable %ptr CrossWorkgroup @@ -86,7 +86,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_BadStorageClass_NotAWebGPUStorageClass) { } TEST_F(SpvParserTest, ModuleScopeVar_BadStorageClass_Function) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %ptr = OpTypePointer Function %float %52 = OpVariable %ptr Function @@ -102,7 +102,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_BadStorageClass_Function) { } TEST_F(SpvParserTest, ModuleScopeVar_BadPointerType) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %fn_ty = OpTypeFunction %float %3 = OpTypePointer Private %fn_ty @@ -118,7 +118,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_BadPointerType) { } TEST_F(SpvParserTest, ModuleScopeVar_NonPointerType) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %5 = OpTypeFunction %float %3 = OpTypePointer Private %5 @@ -132,7 +132,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_NonPointerType) { } TEST_F(SpvParserTest, ModuleScopeVar_AnonWorkgroupVar) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %float = OpTypeFloat 32 %ptr = OpTypePointer Workgroup %float %52 = OpVariable %ptr Workgroup @@ -150,7 +150,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_AnonWorkgroupVar) { } TEST_F(SpvParserTest, ModuleScopeVar_NamedWorkgroupVar) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %52 "the_counter" %float = OpTypeFloat 32 %ptr = OpTypePointer Workgroup %float @@ -169,7 +169,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_NamedWorkgroupVar) { } TEST_F(SpvParserTest, ModuleScopeVar_PrivateVar) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %52 "my_own_private_idaho" %float = OpTypeFloat 32 %ptr = OpTypePointer Private %float @@ -188,7 +188,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_PrivateVar) { } TEST_F(SpvParserTest, ModuleScopeVar_BuiltinVertexIndex) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %52 BuiltIn VertexIndex %uint = OpTypeInt 32 0 %ptr = OpTypePointer Input %uint @@ -236,7 +236,7 @@ std::string PerVertexPreamble() { TEST_F(SpvParserTest, ModuleScopeVar_BuiltinPosition_MapsToModuleScopeVec4Var) { // In Vulkan SPIR-V, Position is the first member of gl_PerVertex const std::string assembly = PerVertexPreamble(); - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_TRUE(p->BuildAndParseInternalModule()) << assembly; EXPECT_TRUE(p->error().empty()) << p->error(); @@ -272,7 +272,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_FALSE(p->BuildAndParseInternalModule()) << assembly; EXPECT_THAT(p->error(), Eq("storing to the whole per-vertex structure is not " "supported: OpStore %1 %9")) @@ -288,7 +288,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_FALSE(p->BuildAndParseInternalModule()) << assembly; EXPECT_THAT(p->error(), Eq("operations producing a per-vertex structure are " "not supported: %1000 = OpUndef %10")) @@ -304,7 +304,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_FALSE(p->BuildAndParseInternalModule()); EXPECT_THAT(p->error(), Eq("operations producing a per-vertex structure are " "not supported: %1000 = OpUndef %11")) @@ -323,7 +323,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_BuiltinPosition_StorePosition) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_TRUE(p->error().empty()); const auto module_str = p->module().to_str(); @@ -354,7 +354,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_TRUE(p->error().empty()); const auto module_str = p->module().to_str(); @@ -385,7 +385,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_TRUE(p->error().empty()); const auto module_str = p->module().to_str(); @@ -415,7 +415,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_BuiltinPointSize_NotSupported) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_FALSE(p->BuildAndParseInternalModule()); EXPECT_THAT(p->error(), Eq("accessing per-vertex member 1 is not supported. " "Only Position is supported")); @@ -435,7 +435,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_BuiltinClipDistance_NotSupported) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_FALSE(p->BuildAndParseInternalModule()); EXPECT_THAT(p->error(), Eq("accessing per-vertex member 2 is not supported. " "Only Position is supported")); @@ -455,7 +455,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_BuiltinCullDistance_NotSupported) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_FALSE(p->BuildAndParseInternalModule()); EXPECT_THAT(p->error(), Eq("accessing per-vertex member 3 is not supported. " "Only Position is supported")); @@ -474,7 +474,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_BuiltinPerVertex_MemberIndex_NotConstant) { OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_FALSE(p->BuildAndParseInternalModule()); EXPECT_THAT(p->error(), Eq("first index of access chain into per-vertex structure is not " @@ -495,7 +495,7 @@ TEST_F(SpvParserTest, OpReturn OpFunctionEnd )"; - auto* p = parser(test::Assemble(assembly)); + auto p = parser(test::Assemble(assembly)); EXPECT_FALSE(p->BuildAndParseInternalModule()); EXPECT_THAT(p->error(), Eq("first index of access chain into per-vertex structure is not " @@ -503,7 +503,7 @@ TEST_F(SpvParserTest, } TEST_F(SpvParserTest, ModuleScopeVar_ScalarInitializers) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %1 = OpVariable %ptr_bool Private %true %2 = OpVariable %ptr_bool Private %false %3 = OpVariable %ptr_int Private %int_m1 @@ -556,7 +556,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarInitializers) { } TEST_F(SpvParserTest, ModuleScopeVar_ScalarNullInitializers) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %null_bool = OpConstantNull %bool %null_int = OpConstantNull %int %null_uint = OpConstantNull %uint @@ -605,7 +605,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarNullInitializers) { } TEST_F(SpvParserTest, ModuleScopeVar_ScalarUndefInitializers) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %undef_bool = OpUndef %bool %undef_int = OpUndef %int %undef_uint = OpUndef %uint @@ -654,7 +654,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarUndefInitializers) { } TEST_F(SpvParserTest, ModuleScopeVar_VectorInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %v2float %two = OpConstant %float 2.0 %const = OpConstantComposite %v2float %float_1p5 %two @@ -678,7 +678,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_VectorBoolNullInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %v2bool %const = OpConstantNull %v2bool %200 = OpVariable %ptr Private %const @@ -701,7 +701,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorBoolNullInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_VectorBoolUndefInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %v2bool %const = OpUndef %v2bool %200 = OpVariable %ptr Private %const @@ -724,7 +724,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorBoolUndefInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_VectorUintNullInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %v2uint %const = OpConstantNull %v2uint %200 = OpVariable %ptr Private %const @@ -747,7 +747,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorUintNullInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_VectorUintUndefInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %v2uint %const = OpUndef %v2uint %200 = OpVariable %ptr Private %const @@ -770,7 +770,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorUintUndefInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_VectorIntNullInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %v2int %const = OpConstantNull %v2int %200 = OpVariable %ptr Private %const @@ -793,7 +793,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorIntNullInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_VectorIntUndefInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %v2int %const = OpUndef %v2int %200 = OpVariable %ptr Private %const @@ -816,7 +816,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorIntUndefInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_VectorFloatNullInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %v2float %const = OpConstantNull %v2float %200 = OpVariable %ptr Private %const @@ -839,7 +839,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorFloatNullInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_VectorFloatUndefInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %v2float %const = OpUndef %v2float %200 = OpVariable %ptr Private %const @@ -862,7 +862,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorFloatUndefInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_MatrixInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %m3v2float %two = OpConstant %float 2.0 %three = OpConstant %float 3.0 @@ -904,7 +904,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_MatrixInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_MatrixNullInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %m3v2float %const = OpConstantNull %m3v2float %200 = OpVariable %ptr Private %const @@ -940,7 +940,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_MatrixNullInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_MatrixUndefInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %m3v2float %const = OpUndef %m3v2float %200 = OpVariable %ptr Private %const @@ -976,7 +976,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_MatrixUndefInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_ArrayInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %arr2uint %two = OpConstant %uint 2 %const = OpConstantComposite %arr2uint %uint_1 %two @@ -1000,7 +1000,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ArrayInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_ArrayNullInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %arr2uint %const = OpConstantNull %arr2uint %200 = OpVariable %ptr Private %const @@ -1023,7 +1023,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ArrayNullInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_ArrayUndefInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %arr2uint %const = OpUndef %arr2uint %200 = OpVariable %ptr Private %const @@ -1046,7 +1046,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ArrayUndefInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_StructInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %strct %two = OpConstant %uint 2 %arrconst = OpConstantComposite %arr2uint %uint_1 %two @@ -1077,7 +1077,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_StructInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_StructNullInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %strct %const = OpConstantNull %strct %200 = OpVariable %ptr Private %const @@ -1106,7 +1106,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_StructNullInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_StructUndefInitializer) { - auto* p = parser(test::Assemble(CommonTypes() + R"( + auto p = parser(test::Assemble(CommonTypes() + R"( %ptr = OpTypePointer Private %strct %const = OpUndef %strct %200 = OpVariable %ptr Private %const @@ -1135,7 +1135,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_StructUndefInitializer) { } TEST_F(SpvParserTest, ModuleScopeVar_LocationDecoration_Valid) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %myvar "myvar" OpDecorate %myvar Location 3 )" + CommonTypes() + R"( @@ -1186,7 +1186,7 @@ TEST_F(SpvParserTest, } TEST_F(SpvParserTest, ModuleScopeVar_DescriptorSetDecoration_Valid) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %myvar "myvar" OpDecorate %myvar DescriptorSet 3 OpDecorate %strct Block @@ -1240,7 +1240,7 @@ TEST_F(SpvParserTest, } TEST_F(SpvParserTest, ModuleScopeVar_BindingDecoration_Valid) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %myvar "myvar" OpDecorate %myvar Binding 3 OpDecorate %strct Block @@ -1295,7 +1295,7 @@ TEST_F(SpvParserTest, TEST_F(SpvParserTest, ModuleScopeVar_StructMember_NonReadableDecoration_Dropped) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %myvar "myvar" OpDecorate %strct Block OpMemberDecorate %strct 0 NonReadable @@ -1322,7 +1322,7 @@ TEST_F(SpvParserTest, } TEST_F(SpvParserTest, ModuleScopeVar_ColMajorDecoration_Dropped) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %myvar "myvar" OpDecorate %s Block OpMemberDecorate %s 0 ColMajor @@ -1351,7 +1351,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ColMajorDecoration_Dropped) { } TEST_F(SpvParserTest, ModuleScopeVar_MatrixStrideDecoration_Dropped) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %myvar "myvar" OpDecorate %s Block OpMemberDecorate %s 0 MatrixStride 8 @@ -1380,7 +1380,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_MatrixStrideDecoration_Dropped) { } TEST_F(SpvParserTest, ModuleScopeVar_RowMajorDecoration_IsError) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %myvar "myvar" OpDecorate %s Block OpMemberDecorate %s 0 RowMajor @@ -1401,7 +1401,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_RowMajorDecoration_IsError) { TEST_F(SpvParserTest, ModuleScopeVar_StorageBuffer_NonWritable_AllMembers) { // Variable should have access(read) - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %myvar "myvar" OpDecorate %s Block OpMemberDecorate %s 0 NonWritable @@ -1431,7 +1431,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_StorageBuffer_NonWritable_AllMembers) { TEST_F(SpvParserTest, ModuleScopeVar_StorageBuffer_NonWritable_NotAllMembers) { // Variable should have access(read_write) - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %myvar "myvar" OpDecorate %s Block OpMemberDecorate %s 0 NonWritable @@ -1462,7 +1462,7 @@ TEST_F( SpvParserTest, ModuleScopeVar_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember) { // NOLINT // Variable should have access(read_write) - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %myvar "myvar" OpDecorate %s Block OpMemberDecorate %s 0 NonWritable @@ -1491,7 +1491,7 @@ TEST_F( } TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_True) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %c "myconst" OpDecorate %c SpecId 12 %bool = OpTypeBool @@ -1516,7 +1516,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_True) { } TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_False) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %c "myconst" OpDecorate %c SpecId 12 %bool = OpTypeBool @@ -1541,7 +1541,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_False) { } TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_U32) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %c "myconst" OpDecorate %c SpecId 12 %uint = OpTypeInt 32 0 @@ -1566,7 +1566,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_U32) { } TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_I32) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %c "myconst" OpDecorate %c SpecId 12 %int = OpTypeInt 32 1 @@ -1591,7 +1591,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_I32) { } TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_F32) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %c "myconst" OpDecorate %c SpecId 12 %float = OpTypeFloat 32 @@ -1618,7 +1618,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_F32) { TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId) { // When we don't have a spec ID, declare an undecorated module-scope constant. - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %c "myconst" %float = OpTypeFloat 32 %c = OpSpecConstant %float 2.5 @@ -1639,7 +1639,7 @@ TEST_F(SpvParserTest, } TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_UsedInFunction) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %c "myconst" %float = OpTypeFloat 32 %c = OpSpecConstant %float 2.5 @@ -1651,7 +1651,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_UsedInFunction) { OpFunctionEnd )")); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - FunctionEmitter fe(p, *spirv_function(100)); + FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100)); EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_TRUE(p->error().empty()); EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"( diff --git a/src/reader/spirv/parser_impl_named_types_test.cc b/src/reader/spirv/parser_impl_named_types_test.cc index d7262605b4..3b7e933731 100644 --- a/src/reader/spirv/parser_impl_named_types_test.cc +++ b/src/reader/spirv/parser_impl_named_types_test.cc @@ -35,7 +35,7 @@ namespace { using ::testing::HasSubstr; TEST_F(SpvParserTest, NamedTypes_AnonStruct) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %uint = OpTypeInt 32 0 %s = OpTypeStruct %uint %uint )")); @@ -44,7 +44,7 @@ TEST_F(SpvParserTest, NamedTypes_AnonStruct) { } TEST_F(SpvParserTest, NamedTypes_NamedStruct) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %s "mystruct" %uint = OpTypeInt 32 0 %s = OpTypeStruct %uint %uint @@ -54,7 +54,7 @@ TEST_F(SpvParserTest, NamedTypes_NamedStruct) { } TEST_F(SpvParserTest, NamedTypes_Dup_EmitBoth) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %uint = OpTypeInt 32 0 %s = OpTypeStruct %uint %uint %s2 = OpTypeStruct %uint %uint @@ -75,7 +75,7 @@ TEST_F(SpvParserTest, NamedTypes_Dup_EmitBoth) { TEST_F(SpvParserTest, NamedTypes_AnonRTArrayWithDecoration) { // Runtime arrays are always in SSBO, and those are always laid out. - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %arr ArrayStride 8 %uint = OpTypeInt 32 0 %arr = OpTypeRuntimeArray %uint @@ -86,7 +86,7 @@ TEST_F(SpvParserTest, NamedTypes_AnonRTArrayWithDecoration) { } TEST_F(SpvParserTest, NamedTypes_AnonRTArray_Dup_EmitBoth) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %arr ArrayStride 8 OpDecorate %arr2 ArrayStride 8 %uint = OpTypeInt 32 0 @@ -100,7 +100,7 @@ TEST_F(SpvParserTest, NamedTypes_AnonRTArray_Dup_EmitBoth) { } TEST_F(SpvParserTest, NamedTypes_NamedRTArray) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %arr "myrtarr" OpDecorate %arr ArrayStride 8 %uint = OpTypeInt 32 0 @@ -112,7 +112,7 @@ TEST_F(SpvParserTest, NamedTypes_NamedRTArray) { } TEST_F(SpvParserTest, NamedTypes_NamedArray) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %arr "myarr" OpDecorate %arr ArrayStride 8 %uint = OpTypeInt 32 0 @@ -126,7 +126,7 @@ TEST_F(SpvParserTest, NamedTypes_NamedArray) { } TEST_F(SpvParserTest, NamedTypes_AnonArray_Dup_EmitBoth) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpDecorate %arr ArrayStride 8 OpDecorate %arr2 ArrayStride 8 %uint = OpTypeInt 32 0 diff --git a/src/reader/spirv/parser_impl_test.cc b/src/reader/spirv/parser_impl_test.cc index cee5eb27df..29e5e3c34a 100644 --- a/src/reader/spirv/parser_impl_test.cc +++ b/src/reader/spirv/parser_impl_test.cc @@ -30,14 +30,14 @@ using ::testing::HasSubstr; TEST_F(SpvParserTest, Impl_Uint32VecEmpty) { std::vector data; - auto* p = parser(data); + auto p = parser(data); EXPECT_FALSE(p->Parse()); // TODO(dneto): What message? } TEST_F(SpvParserTest, Impl_InvalidModuleFails) { auto invalid_spv = test::Assemble("%ty = OpTypeInt 3 0"); - auto* p = parser(invalid_spv); + auto p = parser(invalid_spv); EXPECT_FALSE(p->Parse()); EXPECT_THAT( p->error(), @@ -58,7 +58,7 @@ TEST_F(SpvParserTest, Impl_GenericVulkanShader_SimpleMemoryModel) { OpReturn OpFunctionEnd )"); - auto* p = parser(spv); + auto p = parser(spv); EXPECT_TRUE(p->Parse()); EXPECT_TRUE(p->error().empty()); } @@ -76,7 +76,7 @@ TEST_F(SpvParserTest, Impl_GenericVulkanShader_GLSL450MemoryModel) { OpReturn OpFunctionEnd )"); - auto* p = parser(spv); + auto p = parser(spv); EXPECT_TRUE(p->Parse()); EXPECT_TRUE(p->error().empty()); } @@ -96,7 +96,7 @@ TEST_F(SpvParserTest, Impl_GenericVulkanShader_VulkanMemoryModel) { OpReturn OpFunctionEnd )"); - auto* p = parser(spv); + auto p = parser(spv); EXPECT_TRUE(p->Parse()); EXPECT_TRUE(p->error().empty()); } @@ -114,7 +114,7 @@ TEST_F(SpvParserTest, Impl_OpenCLKernel_Fails) { OpReturn OpFunctionEnd )"); - auto* p = parser(spv); + auto p = parser(spv); EXPECT_FALSE(p->Parse()); EXPECT_THAT(p->error(), HasSubstr("Capability Kernel is not allowed")); } @@ -134,7 +134,7 @@ TEST_F(SpvParserTest, Impl_Source_NoOpLine) { OpReturn OpFunctionEnd )"); - auto* p = parser(spv); + auto p = parser(spv); EXPECT_TRUE(p->Parse()); EXPECT_TRUE(p->error().empty()); // Use instruction counting. @@ -167,7 +167,7 @@ TEST_F(SpvParserTest, Impl_Source_WithOpLine_WithOpNoLine) { OpReturn OpFunctionEnd )"); - auto* p = parser(spv); + auto p = parser(spv); EXPECT_TRUE(p->Parse()); EXPECT_TRUE(p->error().empty()); // Use the information from the OpLine that is still in scope. @@ -197,7 +197,7 @@ TEST_F(SpvParserTest, Impl_Source_InvalidId) { OpReturn OpFunctionEnd )"); - auto* p = parser(spv); + auto p = parser(spv); EXPECT_TRUE(p->Parse()); EXPECT_TRUE(p->error().empty()); auto s99 = p->GetSourceForResultIdForTest(99); diff --git a/src/reader/spirv/parser_impl_test_helper.h b/src/reader/spirv/parser_impl_test_helper.h index 025471b1d5..164bfaa577 100644 --- a/src/reader/spirv/parser_impl_test_helper.h +++ b/src/reader/spirv/parser_impl_test_helper.h @@ -36,31 +36,24 @@ class SpvParserTestBase : public T { SpvParserTestBase() = default; ~SpvParserTestBase() override = default; - /// Sets up the test helper - void SetUp() override { ctx_.Reset(); } - - /// Tears down the test helper - void TearDown() override { impl_ = nullptr; } - /// Retrieves the parser from the helper /// @param input the SPIR-V binary to parse /// @returns a parser for the given binary - ParserImpl* parser(const std::vector& input) { - impl_ = std::make_unique(&ctx_, input); - return impl_.get(); + std::unique_ptr parser(const std::vector& input) { + return std::make_unique(&ctx_, input); } /// Gets the internal representation of the function with the given ID. /// Assumes ParserImpl::BuildInternalRepresentation has been run and /// succeeded. + /// @param parser the parser /// @param id the SPIR-V ID of the function /// @returns the internal representation of the function - spvtools::opt::Function* spirv_function(uint32_t id) { - return impl_->ir_context()->GetFunction(id); + spvtools::opt::Function* spirv_function(ParserImpl* parser, uint32_t id) { + return parser->ir_context()->GetFunction(id); } private: - std::unique_ptr impl_; Context ctx_; }; diff --git a/src/reader/spirv/parser_impl_user_name_test.cc b/src/reader/spirv/parser_impl_user_name_test.cc index 1afcdc150d..a7f50da8d8 100644 --- a/src/reader/spirv/parser_impl_user_name_test.cc +++ b/src/reader/spirv/parser_impl_user_name_test.cc @@ -28,7 +28,7 @@ namespace { using ::testing::Eq; TEST_F(SpvParserTest, UserName_RespectOpName) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %1 "the_void_type" %1 = OpTypeVoid )")); @@ -37,7 +37,7 @@ TEST_F(SpvParserTest, UserName_RespectOpName) { } TEST_F(SpvParserTest, UserName_IgnoreEmptyName) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %1 "" %1 = OpTypeVoid )")); @@ -46,7 +46,7 @@ TEST_F(SpvParserTest, UserName_IgnoreEmptyName) { } TEST_F(SpvParserTest, UserName_DistinguishDuplicateSuggestion) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpName %1 "vanilla" OpName %2 "vanilla" %1 = OpTypeVoid @@ -58,7 +58,7 @@ TEST_F(SpvParserTest, UserName_DistinguishDuplicateSuggestion) { } TEST_F(SpvParserTest, UserName_RespectOpMemberName) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpMemberName %3 0 "strawberry" OpMemberName %3 1 "vanilla" OpMemberName %3 2 "chocolate" @@ -72,7 +72,7 @@ TEST_F(SpvParserTest, UserName_RespectOpMemberName) { } TEST_F(SpvParserTest, UserName_IgnoreEmptyMemberName) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpMemberName %3 0 "" %2 = OpTypeInt 32 0 %3 = OpTypeStruct %2 @@ -82,7 +82,7 @@ TEST_F(SpvParserTest, UserName_IgnoreEmptyMemberName) { } TEST_F(SpvParserTest, UserName_SynthesizeMemberNames) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( %2 = OpTypeInt 32 0 %3 = OpTypeStruct %2 %2 %2 )")); @@ -93,7 +93,7 @@ TEST_F(SpvParserTest, UserName_SynthesizeMemberNames) { } TEST_F(SpvParserTest, UserName_MemberNamesMixUserAndSynthesized) { - auto* p = parser(test::Assemble(R"( + auto p = parser(test::Assemble(R"( OpMemberName %3 1 "vanilla" %2 = OpTypeInt 32 0 %3 = OpTypeStruct %2 %2 %2 diff --git a/src/reader/wgsl/parser_impl_additive_expression_test.cc b/src/reader/wgsl/parser_impl_additive_expression_test.cc index e77c67029d..09948cd1e0 100644 --- a/src/reader/wgsl/parser_impl_additive_expression_test.cc +++ b/src/reader/wgsl/parser_impl_additive_expression_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, AdditiveExpression_Parses_Plus) { - auto* p = parser("a + true"); + auto p = parser("a + true"); auto e = p->additive_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, AdditiveExpression_Parses_Plus) { } TEST_F(ParserImplTest, AdditiveExpression_Parses_Minus) { - auto* p = parser("a - true"); + auto p = parser("a - true"); auto e = p->additive_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -72,7 +72,7 @@ TEST_F(ParserImplTest, AdditiveExpression_Parses_Minus) { } TEST_F(ParserImplTest, AdditiveExpression_InvalidLHS) { - auto* p = parser("if (a) {} + true"); + auto p = parser("if (a) {} + true"); auto e = p->additive_expression(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); @@ -81,7 +81,7 @@ TEST_F(ParserImplTest, AdditiveExpression_InvalidLHS) { } TEST_F(ParserImplTest, AdditiveExpression_InvalidRHS) { - auto* p = parser("true + if (a) {}"); + auto p = parser("true + if (a) {}"); auto e = p->additive_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -91,7 +91,7 @@ TEST_F(ParserImplTest, AdditiveExpression_InvalidRHS) { } TEST_F(ParserImplTest, AdditiveExpression_NoOr_ReturnsLHS) { - auto* p = parser("a true"); + auto p = parser("a true"); auto e = p->additive_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); diff --git a/src/reader/wgsl/parser_impl_and_expression_test.cc b/src/reader/wgsl/parser_impl_and_expression_test.cc index 990e149aca..2131620d28 100644 --- a/src/reader/wgsl/parser_impl_and_expression_test.cc +++ b/src/reader/wgsl/parser_impl_and_expression_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, AndExpression_Parses) { - auto* p = parser("a & true"); + auto p = parser("a & true"); auto e = p->and_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, AndExpression_Parses) { } TEST_F(ParserImplTest, AndExpression_InvalidLHS) { - auto* p = parser("if (a) {} & true"); + auto p = parser("if (a) {} & true"); auto e = p->and_expression(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); @@ -58,7 +58,7 @@ TEST_F(ParserImplTest, AndExpression_InvalidLHS) { } TEST_F(ParserImplTest, AndExpression_InvalidRHS) { - auto* p = parser("true & if (a) {}"); + auto p = parser("true & if (a) {}"); auto e = p->and_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -68,7 +68,7 @@ TEST_F(ParserImplTest, AndExpression_InvalidRHS) { } TEST_F(ParserImplTest, AndExpression_NoOr_ReturnsLHS) { - auto* p = parser("a true"); + auto p = parser("a true"); auto e = p->and_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); diff --git a/src/reader/wgsl/parser_impl_argument_expression_list_test.cc b/src/reader/wgsl/parser_impl_argument_expression_list_test.cc index 6302c8e345..d1ea5887b6 100644 --- a/src/reader/wgsl/parser_impl_argument_expression_list_test.cc +++ b/src/reader/wgsl/parser_impl_argument_expression_list_test.cc @@ -27,7 +27,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, ArgumentExpressionList_Parses) { - auto* p = parser("a"); + auto p = parser("a"); auto e = p->expect_argument_expression_list(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); @@ -37,7 +37,7 @@ TEST_F(ParserImplTest, ArgumentExpressionList_Parses) { } TEST_F(ParserImplTest, ArgumentExpressionList_ParsesMultiple) { - auto* p = parser("a, -33, 1+2"); + auto p = parser("a, -33, 1+2"); auto e = p->expect_argument_expression_list(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, ArgumentExpressionList_ParsesMultiple) { } TEST_F(ParserImplTest, ArgumentExpressionList_HandlesMissingExpression) { - auto* p = parser("a, "); + auto p = parser("a, "); auto e = p->expect_argument_expression_list(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -57,7 +57,7 @@ TEST_F(ParserImplTest, ArgumentExpressionList_HandlesMissingExpression) { } TEST_F(ParserImplTest, ArgumentExpressionList_HandlesInvalidExpression) { - auto* p = parser("if(a) {}"); + auto p = parser("if(a) {}"); auto e = p->expect_argument_expression_list(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_assignment_stmt_test.cc b/src/reader/wgsl/parser_impl_assignment_stmt_test.cc index 89ab5e40f1..b641cedcb4 100644 --- a/src/reader/wgsl/parser_impl_assignment_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_assignment_stmt_test.cc @@ -29,7 +29,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, AssignmentStmt_Parses_ToVariable) { - auto* p = parser("a = 123"); + auto p = parser("a = 123"); auto e = p->assignment_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -54,7 +54,7 @@ TEST_F(ParserImplTest, AssignmentStmt_Parses_ToVariable) { } TEST_F(ParserImplTest, AssignmentStmt_Parses_ToMember) { - auto* p = parser("a.b.c[2].d = 123"); + auto p = parser("a.b.c[2].d = 123"); auto e = p->assignment_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -108,7 +108,7 @@ TEST_F(ParserImplTest, AssignmentStmt_Parses_ToMember) { } TEST_F(ParserImplTest, AssignmentStmt_MissingEqual) { - auto* p = parser("a.b.c[2].d 123"); + auto p = parser("a.b.c[2].d 123"); auto e = p->assignment_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -118,7 +118,7 @@ TEST_F(ParserImplTest, AssignmentStmt_MissingEqual) { } TEST_F(ParserImplTest, AssignmentStmt_InvalidLHS) { - auto* p = parser("if (true) {} = 123"); + auto p = parser("if (true) {} = 123"); auto e = p->assignment_stmt(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); @@ -127,7 +127,7 @@ TEST_F(ParserImplTest, AssignmentStmt_InvalidLHS) { } TEST_F(ParserImplTest, AssignmentStmt_InvalidRHS) { - auto* p = parser("a.b.c[2].d = if (true) {}"); + auto p = parser("a.b.c[2].d = if (true) {}"); auto e = p->assignment_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_body_stmt_test.cc b/src/reader/wgsl/parser_impl_body_stmt_test.cc index d0474eb633..e4e21ee6e4 100644 --- a/src/reader/wgsl/parser_impl_body_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_body_stmt_test.cc @@ -22,7 +22,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, BodyStmt) { - auto* p = parser(R"({ + auto p = parser(R"({ discard; return 1 + b / 2; })"); @@ -35,7 +35,7 @@ TEST_F(ParserImplTest, BodyStmt) { } TEST_F(ParserImplTest, BodyStmt_Empty) { - auto* p = parser("{}"); + auto p = parser("{}"); auto e = p->expect_body_stmt(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); @@ -43,7 +43,7 @@ TEST_F(ParserImplTest, BodyStmt_Empty) { } TEST_F(ParserImplTest, BodyStmt_InvalidStmt) { - auto* p = parser("{fn main() -> void {}}"); + auto p = parser("{fn main() -> void {}}"); auto e = p->expect_body_stmt(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -51,7 +51,7 @@ TEST_F(ParserImplTest, BodyStmt_InvalidStmt) { } TEST_F(ParserImplTest, BodyStmt_MissingRightParen) { - auto* p = parser("{return;"); + auto p = parser("{return;"); auto e = p->expect_body_stmt(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_break_stmt_test.cc b/src/reader/wgsl/parser_impl_break_stmt_test.cc index a45f7190ef..fdd74383bd 100644 --- a/src/reader/wgsl/parser_impl_break_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_break_stmt_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, BreakStmt) { - auto* p = parser("break"); + auto p = parser("break"); auto e = p->break_stmt(); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); diff --git a/src/reader/wgsl/parser_impl_call_stmt_test.cc b/src/reader/wgsl/parser_impl_call_stmt_test.cc index 875805d3eb..cfacc7b836 100644 --- a/src/reader/wgsl/parser_impl_call_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_call_stmt_test.cc @@ -25,7 +25,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, Statement_Call) { - auto* p = parser("a();"); + auto p = parser("a();"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); @@ -43,7 +43,7 @@ TEST_F(ParserImplTest, Statement_Call) { } TEST_F(ParserImplTest, Statement_Call_WithParams) { - auto* p = parser("a(1, b, 2 + 3 / b);"); + auto p = parser("a(1, b, 2 + 3 / b);"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); @@ -64,7 +64,7 @@ TEST_F(ParserImplTest, Statement_Call_WithParams) { } TEST_F(ParserImplTest, Statement_Call_Missing_RightParen) { - auto* p = parser("a("); + auto p = parser("a("); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -73,7 +73,7 @@ TEST_F(ParserImplTest, Statement_Call_Missing_RightParen) { } TEST_F(ParserImplTest, Statement_Call_Missing_Semi) { - auto* p = parser("a()"); + auto p = parser("a()"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -82,7 +82,7 @@ TEST_F(ParserImplTest, Statement_Call_Missing_Semi) { } TEST_F(ParserImplTest, Statement_Call_Bad_ArgList) { - auto* p = parser("a(b c);"); + auto p = parser("a(b c);"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_case_body_test.cc b/src/reader/wgsl/parser_impl_case_body_test.cc index 17e55da4e9..4abb8a945b 100644 --- a/src/reader/wgsl/parser_impl_case_body_test.cc +++ b/src/reader/wgsl/parser_impl_case_body_test.cc @@ -22,7 +22,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, CaseBody_Empty) { - auto* p = parser(""); + auto p = parser(""); auto e = p->case_body(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(e.errored); @@ -31,7 +31,7 @@ TEST_F(ParserImplTest, CaseBody_Empty) { } TEST_F(ParserImplTest, CaseBody_Statements) { - auto* p = parser(R"( + auto p = parser(R"( var a: i32; a = 2;)"); @@ -45,7 +45,7 @@ TEST_F(ParserImplTest, CaseBody_Statements) { } TEST_F(ParserImplTest, CaseBody_InvalidStatement) { - auto* p = parser("a ="); + auto p = parser("a ="); auto e = p->case_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -54,7 +54,7 @@ TEST_F(ParserImplTest, CaseBody_InvalidStatement) { } TEST_F(ParserImplTest, CaseBody_Fallthrough) { - auto* p = parser("fallthrough;"); + auto p = parser("fallthrough;"); auto e = p->case_body(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(e.errored); @@ -64,7 +64,7 @@ TEST_F(ParserImplTest, CaseBody_Fallthrough) { } TEST_F(ParserImplTest, CaseBody_Fallthrough_MissingSemicolon) { - auto* p = parser("fallthrough"); + auto p = parser("fallthrough"); auto e = p->case_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_const_expr_test.cc b/src/reader/wgsl/parser_impl_const_expr_test.cc index f07fbc2014..0635a728ff 100644 --- a/src/reader/wgsl/parser_impl_const_expr_test.cc +++ b/src/reader/wgsl/parser_impl_const_expr_test.cc @@ -27,7 +27,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, ConstExpr_TypeDecl) { - auto* p = parser("vec2(1., 2.)"); + auto p = parser("vec2(1., 2.)"); auto e = p->expect_const_expr(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); @@ -55,7 +55,7 @@ TEST_F(ParserImplTest, ConstExpr_TypeDecl) { } TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingRightParen) { - auto* p = parser("vec2(1., 2."); + auto p = parser("vec2(1., 2."); auto e = p->expect_const_expr(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -64,7 +64,7 @@ TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingRightParen) { } TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingLeftParen) { - auto* p = parser("vec2 1., 2.)"); + auto p = parser("vec2 1., 2.)"); auto e = p->expect_const_expr(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -73,7 +73,7 @@ TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingLeftParen) { } TEST_F(ParserImplTest, ConstExpr_TypeDecl_HangingComma) { - auto* p = parser("vec2(1.,)"); + auto p = parser("vec2(1.,)"); auto e = p->expect_const_expr(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -82,7 +82,7 @@ TEST_F(ParserImplTest, ConstExpr_TypeDecl_HangingComma) { } TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingComma) { - auto* p = parser("vec2(1. 2."); + auto p = parser("vec2(1. 2."); auto e = p->expect_const_expr(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -91,7 +91,7 @@ TEST_F(ParserImplTest, ConstExpr_TypeDecl_MissingComma) { } TEST_F(ParserImplTest, ConstExpr_MissingExpr) { - auto* p = parser("vec2()"); + auto p = parser("vec2()"); auto e = p->expect_const_expr(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -100,7 +100,7 @@ TEST_F(ParserImplTest, ConstExpr_MissingExpr) { } TEST_F(ParserImplTest, ConstExpr_InvalidExpr) { - auto* p = parser("vec2(1., if(a) {})"); + auto p = parser("vec2(1., if(a) {})"); auto e = p->expect_const_expr(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -109,7 +109,7 @@ TEST_F(ParserImplTest, ConstExpr_InvalidExpr) { } TEST_F(ParserImplTest, ConstExpr_ConstLiteral) { - auto* p = parser("true"); + auto p = parser("true"); auto e = p->expect_const_expr(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); @@ -122,7 +122,7 @@ TEST_F(ParserImplTest, ConstExpr_ConstLiteral) { } TEST_F(ParserImplTest, ConstExpr_ConstLiteral_Invalid) { - auto* p = parser("invalid"); + auto p = parser("invalid"); auto e = p->expect_const_expr(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -139,7 +139,7 @@ TEST_F(ParserImplTest, ConstExpr_Recursion) { for (size_t i = 0; i < 200; i++) { out << ")"; } - auto* p = parser(out.str()); + auto p = parser(out.str()); auto e = p->expect_const_expr(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_const_literal_test.cc b/src/reader/wgsl/parser_impl_const_literal_test.cc index acb7637674..fb99a27283 100644 --- a/src/reader/wgsl/parser_impl_const_literal_test.cc +++ b/src/reader/wgsl/parser_impl_const_literal_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, ConstLiteral_Int) { - auto* p = parser("-234"); + auto p = parser("-234"); auto c = p->const_literal(); EXPECT_TRUE(c.matched); EXPECT_FALSE(c.errored); @@ -37,7 +37,7 @@ TEST_F(ParserImplTest, ConstLiteral_Int) { } TEST_F(ParserImplTest, ConstLiteral_Uint) { - auto* p = parser("234u"); + auto p = parser("234u"); auto c = p->const_literal(); EXPECT_TRUE(c.matched); EXPECT_FALSE(c.errored); @@ -48,7 +48,7 @@ TEST_F(ParserImplTest, ConstLiteral_Uint) { } TEST_F(ParserImplTest, ConstLiteral_Float) { - auto* p = parser("234.e12"); + auto p = parser("234.e12"); auto c = p->const_literal(); EXPECT_TRUE(c.matched); EXPECT_FALSE(c.errored); @@ -59,7 +59,7 @@ TEST_F(ParserImplTest, ConstLiteral_Float) { } TEST_F(ParserImplTest, ConstLiteral_InvalidFloat) { - auto* p = parser("1.2e+256"); + auto p = parser("1.2e+256"); auto c = p->const_literal(); EXPECT_FALSE(c.matched); EXPECT_FALSE(c.errored); @@ -67,7 +67,7 @@ TEST_F(ParserImplTest, ConstLiteral_InvalidFloat) { } TEST_F(ParserImplTest, ConstLiteral_True) { - auto* p = parser("true"); + auto p = parser("true"); auto c = p->const_literal(); EXPECT_TRUE(c.matched); EXPECT_FALSE(c.errored); @@ -78,7 +78,7 @@ TEST_F(ParserImplTest, ConstLiteral_True) { } TEST_F(ParserImplTest, ConstLiteral_False) { - auto* p = parser("false"); + auto p = parser("false"); auto c = p->const_literal(); EXPECT_TRUE(c.matched); EXPECT_FALSE(c.errored); @@ -89,7 +89,7 @@ TEST_F(ParserImplTest, ConstLiteral_False) { } TEST_F(ParserImplTest, ConstLiteral_NoMatch) { - auto* p = parser("another-token"); + auto p = parser("another-token"); auto c = p->const_literal(); EXPECT_FALSE(c.matched); EXPECT_FALSE(c.errored); diff --git a/src/reader/wgsl/parser_impl_continue_stmt_test.cc b/src/reader/wgsl/parser_impl_continue_stmt_test.cc index b2003cea19..e2e6e01aea 100644 --- a/src/reader/wgsl/parser_impl_continue_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_continue_stmt_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, ContinueStmt) { - auto* p = parser("continue"); + auto p = parser("continue"); auto e = p->continue_stmt(); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); diff --git a/src/reader/wgsl/parser_impl_continuing_stmt_test.cc b/src/reader/wgsl/parser_impl_continuing_stmt_test.cc index 68c9ec6042..4e4a7d1bd0 100644 --- a/src/reader/wgsl/parser_impl_continuing_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_continuing_stmt_test.cc @@ -22,7 +22,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, ContinuingStmt) { - auto* p = parser("continuing { discard; }"); + auto p = parser("continuing { discard; }"); auto e = p->continuing_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -32,7 +32,7 @@ TEST_F(ParserImplTest, ContinuingStmt) { } TEST_F(ParserImplTest, ContinuingStmt_InvalidBody) { - auto* p = parser("continuing { discard }"); + auto p = parser("continuing { discard }"); auto e = p->continuing_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_depth_texture_type_test.cc b/src/reader/wgsl/parser_impl_depth_texture_type_test.cc index 5125c066c4..c7faf990b4 100644 --- a/src/reader/wgsl/parser_impl_depth_texture_type_test.cc +++ b/src/reader/wgsl/parser_impl_depth_texture_type_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, DepthTextureType_Invalid) { - auto* p = parser("1234"); + auto p = parser("1234"); auto t = p->depth_texture_type(); EXPECT_FALSE(t.matched); EXPECT_FALSE(t.errored); @@ -31,7 +31,7 @@ TEST_F(ParserImplTest, DepthTextureType_Invalid) { } TEST_F(ParserImplTest, DepthTextureType_2d) { - auto* p = parser("texture_depth_2d"); + auto p = parser("texture_depth_2d"); auto t = p->depth_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -43,7 +43,7 @@ TEST_F(ParserImplTest, DepthTextureType_2d) { } TEST_F(ParserImplTest, DepthTextureType_2dArray) { - auto* p = parser("texture_depth_2d_array"); + auto p = parser("texture_depth_2d_array"); auto t = p->depth_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -55,7 +55,7 @@ TEST_F(ParserImplTest, DepthTextureType_2dArray) { } TEST_F(ParserImplTest, DepthTextureType_Cube) { - auto* p = parser("texture_depth_cube"); + auto p = parser("texture_depth_cube"); auto t = p->depth_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -67,7 +67,7 @@ TEST_F(ParserImplTest, DepthTextureType_Cube) { } TEST_F(ParserImplTest, DepthTextureType_CubeArray) { - auto* p = parser("texture_depth_cube_array"); + auto p = parser("texture_depth_cube_array"); auto t = p->depth_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); diff --git a/src/reader/wgsl/parser_impl_else_stmt_test.cc b/src/reader/wgsl/parser_impl_else_stmt_test.cc index 89632e32e3..98ad2b0044 100644 --- a/src/reader/wgsl/parser_impl_else_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_else_stmt_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, ElseStmt) { - auto* p = parser("else { a = b; c = d; }"); + auto p = parser("else { a = b; c = d; }"); auto e = p->else_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -35,7 +35,7 @@ TEST_F(ParserImplTest, ElseStmt) { } TEST_F(ParserImplTest, ElseStmt_InvalidBody) { - auto* p = parser("else { fn main() -> void {}}"); + auto p = parser("else { fn main() -> void {}}"); auto e = p->else_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -45,7 +45,7 @@ TEST_F(ParserImplTest, ElseStmt_InvalidBody) { } TEST_F(ParserImplTest, ElseStmt_MissingBody) { - auto* p = parser("else"); + auto p = parser("else"); auto e = p->else_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_elseif_stmt_test.cc b/src/reader/wgsl/parser_impl_elseif_stmt_test.cc index dd1ae17891..22ebd97b4f 100644 --- a/src/reader/wgsl/parser_impl_elseif_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_elseif_stmt_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, ElseIfStmt) { - auto* p = parser("elseif (a == 4) { a = b; c = d; }"); + auto p = parser("elseif (a == 4) { a = b; c = d; }"); auto e = p->elseif_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -37,7 +37,7 @@ TEST_F(ParserImplTest, ElseIfStmt) { } TEST_F(ParserImplTest, ElseIfStmt_Multiple) { - auto* p = parser("elseif (a == 4) { a = b; c = d; } elseif(c) { d = 2; }"); + auto p = parser("elseif (a == 4) { a = b; c = d; } elseif(c) { d = 2; }"); auto e = p->elseif_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -56,7 +56,7 @@ TEST_F(ParserImplTest, ElseIfStmt_Multiple) { } TEST_F(ParserImplTest, ElseIfStmt_InvalidBody) { - auto* p = parser("elseif (true) { fn main() -> void {}}"); + auto p = parser("elseif (true) { fn main() -> void {}}"); auto e = p->elseif_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -65,7 +65,7 @@ TEST_F(ParserImplTest, ElseIfStmt_InvalidBody) { } TEST_F(ParserImplTest, ElseIfStmt_MissingBody) { - auto* p = parser("elseif (true)"); + auto p = parser("elseif (true)"); auto e = p->elseif_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_equality_expression_test.cc b/src/reader/wgsl/parser_impl_equality_expression_test.cc index f16007503f..36cbcef7d8 100644 --- a/src/reader/wgsl/parser_impl_equality_expression_test.cc +++ b/src/reader/wgsl/parser_impl_equality_expression_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, EqualityExpression_Parses_Equal) { - auto* p = parser("a == true"); + auto p = parser("a == true"); auto e = p->equality_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, EqualityExpression_Parses_Equal) { } TEST_F(ParserImplTest, EqualityExpression_Parses_NotEqual) { - auto* p = parser("a != true"); + auto p = parser("a != true"); auto e = p->equality_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -72,7 +72,7 @@ TEST_F(ParserImplTest, EqualityExpression_Parses_NotEqual) { } TEST_F(ParserImplTest, EqualityExpression_InvalidLHS) { - auto* p = parser("if (a) {} == true"); + auto p = parser("if (a) {} == true"); auto e = p->equality_expression(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); @@ -81,7 +81,7 @@ TEST_F(ParserImplTest, EqualityExpression_InvalidLHS) { } TEST_F(ParserImplTest, EqualityExpression_InvalidRHS) { - auto* p = parser("true == if (a) {}"); + auto p = parser("true == if (a) {}"); auto e = p->equality_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -91,7 +91,7 @@ TEST_F(ParserImplTest, EqualityExpression_InvalidRHS) { } TEST_F(ParserImplTest, EqualityExpression_NoOr_ReturnsLHS) { - auto* p = parser("a true"); + auto p = parser("a true"); auto e = p->equality_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); diff --git a/src/reader/wgsl/parser_impl_error_msg_test.cc b/src/reader/wgsl/parser_impl_error_msg_test.cc index 3d70cd9e49..7e075a56c4 100644 --- a/src/reader/wgsl/parser_impl_error_msg_test.cc +++ b/src/reader/wgsl/parser_impl_error_msg_test.cc @@ -27,7 +27,7 @@ class ParserImplErrorTest : public ParserImplTest {}; do { \ std::string source = SOURCE; \ std::string expected = EXPECTED; \ - auto* p = parser(source); \ + auto p = parser(source); \ EXPECT_EQ(false, p->Parse()); \ EXPECT_EQ(true, p->diagnostics().contains_errors()); \ EXPECT_EQ(expected, diag::Formatter().format(p->diagnostics())); \ diff --git a/src/reader/wgsl/parser_impl_error_resync_test.cc b/src/reader/wgsl/parser_impl_error_resync_test.cc index 3427a59368..e420bcddfe 100644 --- a/src/reader/wgsl/parser_impl_error_resync_test.cc +++ b/src/reader/wgsl/parser_impl_error_resync_test.cc @@ -27,7 +27,7 @@ class ParserImplErrorResyncTest : public ParserImplTest {}; do { \ std::string source = SOURCE; \ std::string expected = EXPECTED; \ - auto* p = parser(source); \ + auto p = parser(source); \ EXPECT_EQ(false, p->Parse()); \ EXPECT_EQ(true, p->diagnostics().contains_errors()); \ EXPECT_EQ(expected, diag::Formatter().format(p->diagnostics())); \ diff --git a/src/reader/wgsl/parser_impl_exclusive_or_expression_test.cc b/src/reader/wgsl/parser_impl_exclusive_or_expression_test.cc index c3a3139d22..1338dfafa2 100644 --- a/src/reader/wgsl/parser_impl_exclusive_or_expression_test.cc +++ b/src/reader/wgsl/parser_impl_exclusive_or_expression_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, ExclusiveOrExpression_Parses) { - auto* p = parser("a ^ true"); + auto p = parser("a ^ true"); auto e = p->exclusive_or_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, ExclusiveOrExpression_Parses) { } TEST_F(ParserImplTest, ExclusiveOrExpression_InvalidLHS) { - auto* p = parser("if (a) {} ^ true"); + auto p = parser("if (a) {} ^ true"); auto e = p->exclusive_or_expression(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); @@ -58,7 +58,7 @@ TEST_F(ParserImplTest, ExclusiveOrExpression_InvalidLHS) { } TEST_F(ParserImplTest, ExclusiveOrExpression_InvalidRHS) { - auto* p = parser("true ^ if (a) {}"); + auto p = parser("true ^ if (a) {}"); auto e = p->exclusive_or_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -68,7 +68,7 @@ TEST_F(ParserImplTest, ExclusiveOrExpression_InvalidRHS) { } TEST_F(ParserImplTest, ExclusiveOrExpression_NoOr_ReturnsLHS) { - auto* p = parser("a true"); + auto p = parser("a true"); auto e = p->exclusive_or_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); diff --git a/src/reader/wgsl/parser_impl_for_stmt_test.cc b/src/reader/wgsl/parser_impl_for_stmt_test.cc index 27c7defe9a..2172e21495 100644 --- a/src/reader/wgsl/parser_impl_for_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_for_stmt_test.cc @@ -26,13 +26,13 @@ namespace { class ForStmtTest : public ParserImplTest { public: void TestForLoop(std::string loop_str, std::string for_str) { - auto* p_loop = parser(loop_str); + auto p_loop = parser(loop_str); auto e_loop = p_loop->expect_statements(); EXPECT_FALSE(e_loop.errored); EXPECT_FALSE(p_loop->has_error()) << p_loop->error(); ASSERT_NE(e_loop.value, nullptr); - auto* p_for = parser(for_str); + auto p_for = parser(for_str); auto e_for = p_for->expect_statements(); EXPECT_FALSE(e_for.errored); EXPECT_FALSE(p_for->has_error()) << p_for->error(); @@ -158,7 +158,7 @@ TEST_F(ForStmtTest, All) { class ForStmtErrorTest : public ParserImplTest { public: void TestForWithError(std::string for_str, std::string error_str) { - auto* p_for = parser(for_str); + auto p_for = parser(for_str); auto e_for = p_for->for_stmt(); EXPECT_FALSE(e_for.matched); diff --git a/src/reader/wgsl/parser_impl_function_decl_test.cc b/src/reader/wgsl/parser_impl_function_decl_test.cc index 03dc6cbdb0..8f829ac324 100644 --- a/src/reader/wgsl/parser_impl_function_decl_test.cc +++ b/src/reader/wgsl/parser_impl_function_decl_test.cc @@ -25,7 +25,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, FunctionDecl) { - auto* p = parser("fn main(a : i32, b : f32) -> void { return; }"); + auto p = parser("fn main(a : i32, b : f32) -> void { return; }"); auto decos = p->decoration_list(); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(decos.errored); @@ -53,7 +53,7 @@ TEST_F(ParserImplTest, FunctionDecl) { } TEST_F(ParserImplTest, FunctionDecl_DecorationList) { - auto* p = parser("[[workgroup_size(2, 3, 4)]] fn main() -> void { return; }"); + auto p = parser("[[workgroup_size(2, 3, 4)]] fn main() -> void { return; }"); auto decos = p->decoration_list(); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(decos.errored); @@ -89,7 +89,7 @@ TEST_F(ParserImplTest, FunctionDecl_DecorationList) { } TEST_F(ParserImplTest, FunctionDecl_DecorationList_MultipleEntries) { - auto* p = parser(R"( + auto p = parser(R"( [[workgroup_size(2, 3, 4), workgroup_size(5, 6, 7)]] fn main() -> void { return; })"); auto decos = p->decoration_list(); @@ -133,7 +133,7 @@ fn main() -> void { return; })"); } TEST_F(ParserImplTest, FunctionDecl_DecorationList_MultipleLists) { - auto* p = parser(R"( + auto p = parser(R"( [[workgroup_size(2, 3, 4)]] [[workgroup_size(5, 6, 7)]] fn main() -> void { return; })"); @@ -178,7 +178,7 @@ fn main() -> void { return; })"); } TEST_F(ParserImplTest, FunctionDecl_InvalidHeader) { - auto* p = parser("fn main() -> { }"); + auto p = parser("fn main() -> { }"); auto decos = p->decoration_list(); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(decos.errored); @@ -192,7 +192,7 @@ TEST_F(ParserImplTest, FunctionDecl_InvalidHeader) { } TEST_F(ParserImplTest, FunctionDecl_InvalidBody) { - auto* p = parser("fn main() -> void { return }"); + auto p = parser("fn main() -> void { return }"); auto decos = p->decoration_list(); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(decos.errored); @@ -206,7 +206,7 @@ TEST_F(ParserImplTest, FunctionDecl_InvalidBody) { } TEST_F(ParserImplTest, FunctionDecl_MissingLeftBrace) { - auto* p = parser("fn main() -> void return; }"); + auto p = parser("fn main() -> void return; }"); auto decos = p->decoration_list(); EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(decos.errored); diff --git a/src/reader/wgsl/parser_impl_function_decoration_list_test.cc b/src/reader/wgsl/parser_impl_function_decoration_list_test.cc index 53dad7f9d2..9a7da60c48 100644 --- a/src/reader/wgsl/parser_impl_function_decoration_list_test.cc +++ b/src/reader/wgsl/parser_impl_function_decoration_list_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, FunctionDecorationList_Parses) { - auto* p = parser("[[workgroup_size(2), workgroup_size(3, 4, 5)]]"); + auto p = parser("[[workgroup_size(2), workgroup_size(3, 4, 5)]]"); auto decos = p->decoration_list(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_FALSE(decos.errored); @@ -50,7 +50,7 @@ TEST_F(ParserImplTest, FunctionDecorationList_Parses) { } TEST_F(ParserImplTest, FunctionDecorationList_Empty) { - auto* p = parser("[[]]"); + auto p = parser("[[]]"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -59,7 +59,7 @@ TEST_F(ParserImplTest, FunctionDecorationList_Empty) { } TEST_F(ParserImplTest, FunctionDecorationList_Invalid) { - auto* p = parser("[[invalid]]"); + auto p = parser("[[invalid]]"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -69,7 +69,7 @@ TEST_F(ParserImplTest, FunctionDecorationList_Invalid) { } TEST_F(ParserImplTest, FunctionDecorationList_ExtraComma) { - auto* p = parser("[[workgroup_size(2), ]]"); + auto p = parser("[[workgroup_size(2), ]]"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -78,7 +78,7 @@ TEST_F(ParserImplTest, FunctionDecorationList_ExtraComma) { } TEST_F(ParserImplTest, FunctionDecorationList_MissingComma) { - auto* p = parser("[[workgroup_size(2) workgroup_size(2)]]"); + auto p = parser("[[workgroup_size(2) workgroup_size(2)]]"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -87,7 +87,7 @@ TEST_F(ParserImplTest, FunctionDecorationList_MissingComma) { } TEST_F(ParserImplTest, FunctionDecorationList_BadDecoration) { - auto* p = parser("[[workgroup_size()]]"); + auto p = parser("[[workgroup_size()]]"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -98,7 +98,7 @@ TEST_F(ParserImplTest, FunctionDecorationList_BadDecoration) { } TEST_F(ParserImplTest, FunctionDecorationList_MissingRightAttr) { - auto* p = parser("[[workgroup_size(2), workgroup_size(3, 4, 5)"); + auto p = parser("[[workgroup_size(2), workgroup_size(3, 4, 5)"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); diff --git a/src/reader/wgsl/parser_impl_function_decoration_test.cc b/src/reader/wgsl/parser_impl_function_decoration_test.cc index 583a5bb835..3877cbc1a2 100644 --- a/src/reader/wgsl/parser_impl_function_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_function_decoration_test.cc @@ -24,7 +24,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, FunctionDecoration_Workgroup) { - auto* p = parser("workgroup_size(4)"); + auto p = parser("workgroup_size(4)"); auto deco = p->decoration(); EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); @@ -44,7 +44,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_2Param) { - auto* p = parser("workgroup_size(4, 5)"); + auto p = parser("workgroup_size(4, 5)"); auto deco = p->decoration(); EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); @@ -64,7 +64,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_2Param) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_3Param) { - auto* p = parser("workgroup_size(4, 5, 6)"); + auto p = parser("workgroup_size(4, 5, 6)"); auto deco = p->decoration(); EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); @@ -84,7 +84,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_3Param) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_TooManyValues) { - auto* p = parser("workgroup_size(1, 2, 3, 4)"); + auto p = parser("workgroup_size(1, 2, 3, 4)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -94,7 +94,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_TooManyValues) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Invalid_X_Value) { - auto* p = parser("workgroup_size(-2, 5, 6)"); + auto p = parser("workgroup_size(-2, 5, 6)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -105,7 +105,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Invalid_X_Value) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Invalid_Y_Value) { - auto* p = parser("workgroup_size(4, 0, 6)"); + auto p = parser("workgroup_size(4, 0, 6)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -116,7 +116,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Invalid_Y_Value) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Invalid_Z_Value) { - auto* p = parser("workgroup_size(4, 5, -3)"); + auto p = parser("workgroup_size(4, 5, -3)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -127,7 +127,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Invalid_Z_Value) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_MissingLeftParam) { - auto* p = parser("workgroup_size 4, 5, 6)"); + auto p = parser("workgroup_size 4, 5, 6)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -137,7 +137,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_MissingLeftParam) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_MissingRightParam) { - auto* p = parser("workgroup_size(4, 5, 6"); + auto p = parser("workgroup_size(4, 5, 6"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -147,7 +147,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_MissingRightParam) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_MissingValues) { - auto* p = parser("workgroup_size()"); + auto p = parser("workgroup_size()"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -159,7 +159,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_MissingValues) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_X_Value) { - auto* p = parser("workgroup_size(, 2, 3)"); + auto p = parser("workgroup_size(, 2, 3)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -171,7 +171,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_X_Value) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Y_Comma) { - auto* p = parser("workgroup_size(1 2, 3)"); + auto p = parser("workgroup_size(1 2, 3)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -181,7 +181,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Y_Comma) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Y_Value) { - auto* p = parser("workgroup_size(1, , 3)"); + auto p = parser("workgroup_size(1, , 3)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -193,7 +193,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Y_Value) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Z_Comma) { - auto* p = parser("workgroup_size(1, 2 3)"); + auto p = parser("workgroup_size(1, 2 3)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -203,7 +203,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Z_Comma) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Z_Value) { - auto* p = parser("workgroup_size(1, 2, )"); + auto p = parser("workgroup_size(1, 2, )"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -215,7 +215,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Z_Value) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_X_Invalid) { - auto* p = parser("workgroup_size(nan)"); + auto p = parser("workgroup_size(nan)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -227,7 +227,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_X_Invalid) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Y_Invalid) { - auto* p = parser("workgroup_size(2, nan)"); + auto p = parser("workgroup_size(2, nan)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -239,7 +239,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Y_Invalid) { } TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Z_Invalid) { - auto* p = parser("workgroup_size(2, 3, nan)"); + auto p = parser("workgroup_size(2, 3, nan)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -251,7 +251,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Workgroup_Missing_Z_Invalid) { } TEST_F(ParserImplTest, FunctionDecoration_Stage) { - auto* p = parser("stage(compute)"); + auto p = parser("stage(compute)"); auto deco = p->decoration(); EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); @@ -264,7 +264,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Stage) { } TEST_F(ParserImplTest, FunctionDecoration_Stage_MissingValue) { - auto* p = parser("stage()"); + auto p = parser("stage()"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -274,7 +274,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Stage_MissingValue) { } TEST_F(ParserImplTest, FunctionDecoration_Stage_MissingInvalid) { - auto* p = parser("stage(nan)"); + auto p = parser("stage(nan)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -284,7 +284,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Stage_MissingInvalid) { } TEST_F(ParserImplTest, FunctionDecoration_Stage_MissingLeftParen) { - auto* p = parser("stage compute)"); + auto p = parser("stage compute)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -294,7 +294,7 @@ TEST_F(ParserImplTest, FunctionDecoration_Stage_MissingLeftParen) { } TEST_F(ParserImplTest, FunctionDecoration_Stage_MissingRightParen) { - auto* p = parser("stage(compute"); + auto p = parser("stage(compute"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); diff --git a/src/reader/wgsl/parser_impl_function_header_test.cc b/src/reader/wgsl/parser_impl_function_header_test.cc index cc4d257215..f657a809a7 100644 --- a/src/reader/wgsl/parser_impl_function_header_test.cc +++ b/src/reader/wgsl/parser_impl_function_header_test.cc @@ -24,7 +24,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, FunctionHeader) { - auto* p = parser("fn main(a : i32, b: f32) -> void"); + auto p = parser("fn main(a : i32, b: f32) -> void"); auto f = p->function_header(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(f.matched); @@ -39,7 +39,7 @@ TEST_F(ParserImplTest, FunctionHeader) { } TEST_F(ParserImplTest, FunctionHeader_MissingIdent) { - auto* p = parser("fn () -> void"); + auto p = parser("fn () -> void"); auto f = p->function_header(); EXPECT_FALSE(f.matched); EXPECT_TRUE(f.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, FunctionHeader_MissingIdent) { } TEST_F(ParserImplTest, FunctionHeader_InvalidIdent) { - auto* p = parser("fn 133main() -> i32"); + auto p = parser("fn 133main() -> i32"); auto f = p->function_header(); EXPECT_FALSE(f.matched); EXPECT_TRUE(f.errored); @@ -59,7 +59,7 @@ TEST_F(ParserImplTest, FunctionHeader_InvalidIdent) { } TEST_F(ParserImplTest, FunctionHeader_MissingParenLeft) { - auto* p = parser("fn main) -> i32"); + auto p = parser("fn main) -> i32"); auto f = p->function_header(); EXPECT_FALSE(f.matched); EXPECT_TRUE(f.errored); @@ -69,7 +69,7 @@ TEST_F(ParserImplTest, FunctionHeader_MissingParenLeft) { } TEST_F(ParserImplTest, FunctionHeader_InvalidParamList) { - auto* p = parser("fn main(a :i32,) -> i32"); + auto p = parser("fn main(a :i32,) -> i32"); auto f = p->function_header(); EXPECT_FALSE(f.matched); EXPECT_TRUE(f.errored); @@ -79,7 +79,7 @@ TEST_F(ParserImplTest, FunctionHeader_InvalidParamList) { } TEST_F(ParserImplTest, FunctionHeader_MissingParenRight) { - auto* p = parser("fn main( -> i32"); + auto p = parser("fn main( -> i32"); auto f = p->function_header(); EXPECT_FALSE(f.matched); EXPECT_TRUE(f.errored); @@ -89,7 +89,7 @@ TEST_F(ParserImplTest, FunctionHeader_MissingParenRight) { } TEST_F(ParserImplTest, FunctionHeader_MissingArrow) { - auto* p = parser("fn main() i32"); + auto p = parser("fn main() i32"); auto f = p->function_header(); EXPECT_FALSE(f.matched); EXPECT_TRUE(f.errored); @@ -99,7 +99,7 @@ TEST_F(ParserImplTest, FunctionHeader_MissingArrow) { } TEST_F(ParserImplTest, FunctionHeader_InvalidReturnType) { - auto* p = parser("fn main() -> invalid"); + auto p = parser("fn main() -> invalid"); auto f = p->function_header(); EXPECT_FALSE(f.matched); EXPECT_TRUE(f.errored); @@ -109,7 +109,7 @@ TEST_F(ParserImplTest, FunctionHeader_InvalidReturnType) { } TEST_F(ParserImplTest, FunctionHeader_MissingReturnType) { - auto* p = parser("fn main() ->"); + auto p = parser("fn main() ->"); auto f = p->function_header(); EXPECT_FALSE(f.matched); EXPECT_TRUE(f.errored); diff --git a/src/reader/wgsl/parser_impl_function_type_decl_test.cc b/src/reader/wgsl/parser_impl_function_type_decl_test.cc index 14bf09d7d8..9fb2711f5b 100644 --- a/src/reader/wgsl/parser_impl_function_type_decl_test.cc +++ b/src/reader/wgsl/parser_impl_function_type_decl_test.cc @@ -30,7 +30,7 @@ namespace { TEST_F(ParserImplTest, FunctionTypeDecl_Void) { auto* v = tm()->Get(std::make_unique()); - auto* p = parser("void"); + auto p = parser("void"); auto e = p->function_type_decl(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -42,7 +42,7 @@ TEST_F(ParserImplTest, FunctionTypeDecl_Type) { auto* f32 = tm()->Get(std::make_unique()); auto* vec2 = tm()->Get(std::make_unique(f32, 2)); - auto* p = parser("vec2"); + auto p = parser("vec2"); auto e = p->function_type_decl(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -51,7 +51,7 @@ TEST_F(ParserImplTest, FunctionTypeDecl_Type) { } TEST_F(ParserImplTest, FunctionTypeDecl_InvalidType) { - auto* p = parser("vec2"); + auto p = parser("vec2"); auto e = p->function_type_decl(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_global_constant_decl_test.cc b/src/reader/wgsl/parser_impl_global_constant_decl_test.cc index 5888ee97b8..3f4aaedc39 100644 --- a/src/reader/wgsl/parser_impl_global_constant_decl_test.cc +++ b/src/reader/wgsl/parser_impl_global_constant_decl_test.cc @@ -24,7 +24,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, GlobalConstantDecl) { - auto* p = parser("const a : f32 = 1."); + auto p = parser("const a : f32 = 1."); auto e = p->global_constant_decl(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -46,7 +46,7 @@ TEST_F(ParserImplTest, GlobalConstantDecl) { } TEST_F(ParserImplTest, GlobalConstantDecl_MissingEqual) { - auto* p = parser("const a: f32 1."); + auto p = parser("const a: f32 1."); auto e = p->global_constant_decl(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -56,7 +56,7 @@ TEST_F(ParserImplTest, GlobalConstantDecl_MissingEqual) { } TEST_F(ParserImplTest, GlobalConstantDecl_InvalidVariable) { - auto* p = parser("const a: invalid = 1."); + auto p = parser("const a: invalid = 1."); auto e = p->global_constant_decl(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -66,7 +66,7 @@ TEST_F(ParserImplTest, GlobalConstantDecl_InvalidVariable) { } TEST_F(ParserImplTest, GlobalConstantDecl_InvalidExpression) { - auto* p = parser("const a: f32 = if (a) {}"); + auto p = parser("const a: f32 = if (a) {}"); auto e = p->global_constant_decl(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -76,7 +76,7 @@ TEST_F(ParserImplTest, GlobalConstantDecl_InvalidExpression) { } TEST_F(ParserImplTest, GlobalConstantDecl_MissingExpression) { - auto* p = parser("const a: f32 ="); + auto p = parser("const a: f32 ="); auto e = p->global_constant_decl(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_global_decl_test.cc b/src/reader/wgsl/parser_impl_global_decl_test.cc index ddd0f1db71..906efe54e0 100644 --- a/src/reader/wgsl/parser_impl_global_decl_test.cc +++ b/src/reader/wgsl/parser_impl_global_decl_test.cc @@ -24,13 +24,13 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, GlobalDecl_Semicolon) { - auto* p = parser(";"); + auto p = parser(";"); p->expect_global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); } TEST_F(ParserImplTest, GlobalDecl_GlobalVariable) { - auto* p = parser("var a : vec2 = vec2(1, 2);"); + auto p = parser("var a : vec2 = vec2(1, 2);"); p->expect_global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -42,21 +42,21 @@ TEST_F(ParserImplTest, GlobalDecl_GlobalVariable) { } TEST_F(ParserImplTest, GlobalDecl_GlobalVariable_Invalid) { - auto* p = parser("var a : vec2;"); + auto p = parser("var a : vec2;"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:19: unknown constructed type 'invalid'"); } TEST_F(ParserImplTest, GlobalDecl_GlobalVariable_MissingSemicolon) { - auto* p = parser("var a : vec2"); + auto p = parser("var a : vec2"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:23: expected ';' for variable declaration"); } TEST_F(ParserImplTest, GlobalDecl_GlobalConstant) { - auto* p = parser("const a : i32 = 2;"); + auto p = parser("const a : i32 = 2;"); p->expect_global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -68,21 +68,21 @@ TEST_F(ParserImplTest, GlobalDecl_GlobalConstant) { } TEST_F(ParserImplTest, GlobalDecl_GlobalConstant_Invalid) { - auto* p = parser("const a : vec2;"); + auto p = parser("const a : vec2;"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:20: expected '=' for constant declaration"); } TEST_F(ParserImplTest, GlobalDecl_GlobalConstant_MissingSemicolon) { - auto* p = parser("const a : vec2 = vec2(1, 2)"); + auto p = parser("const a : vec2 = vec2(1, 2)"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:38: expected ';' for constant declaration"); } TEST_F(ParserImplTest, GlobalDecl_TypeAlias) { - auto* p = parser("type A = i32;"); + auto p = parser("type A = i32;"); p->expect_global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -93,7 +93,7 @@ TEST_F(ParserImplTest, GlobalDecl_TypeAlias) { } TEST_F(ParserImplTest, GlobalDecl_TypeAlias_StructIdent) { - auto* p = parser(R"(struct A { + auto p = parser(R"(struct A { a : f32; }; type B = A;)"); @@ -114,21 +114,21 @@ type B = A;)"); } TEST_F(ParserImplTest, GlobalDecl_TypeAlias_Invalid) { - auto* p = parser("type A = invalid;"); + auto p = parser("type A = invalid;"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:10: unknown constructed type 'invalid'"); } TEST_F(ParserImplTest, GlobalDecl_TypeAlias_MissingSemicolon) { - auto* p = parser("type A = i32"); + auto p = parser("type A = i32"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:13: expected ';' for type alias"); } TEST_F(ParserImplTest, GlobalDecl_Function) { - auto* p = parser("fn main() -> void { return; }"); + auto p = parser("fn main() -> void { return; }"); p->expect_global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -138,7 +138,7 @@ TEST_F(ParserImplTest, GlobalDecl_Function) { } TEST_F(ParserImplTest, GlobalDecl_Function_WithDecoration) { - auto* p = parser("[[workgroup_size(2)]] fn main() -> void { return; }"); + auto p = parser("[[workgroup_size(2)]] fn main() -> void { return; }"); p->expect_global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -148,14 +148,14 @@ TEST_F(ParserImplTest, GlobalDecl_Function_WithDecoration) { } TEST_F(ParserImplTest, GlobalDecl_Function_Invalid) { - auto* p = parser("fn main() -> { return; }"); + auto p = parser("fn main() -> { return; }"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:14: unable to determine function return type"); } TEST_F(ParserImplTest, GlobalDecl_ParsesStruct) { - auto* p = parser("struct A { b: i32; c: f32;};"); + auto p = parser("struct A { b: i32; c: f32;};"); p->expect_global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -172,7 +172,7 @@ TEST_F(ParserImplTest, GlobalDecl_ParsesStruct) { } TEST_F(ParserImplTest, GlobalDecl_Struct_WithStride) { - auto* p = + auto p = parser("struct A { [[offset(0)]] data: [[stride(4)]] array; };"); p->expect_global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -197,7 +197,7 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithStride) { } TEST_F(ParserImplTest, GlobalDecl_Struct_WithDecoration) { - auto* p = parser("[[block]] struct A { [[offset(0)]] data: f32; };"); + auto p = parser("[[block]] struct A { [[offset(0)]] data: f32; };"); p->expect_global_decl(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -215,14 +215,14 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithDecoration) { } TEST_F(ParserImplTest, GlobalDecl_Struct_Invalid) { - auto* p = parser("[[block]] A {};"); + auto p = parser("[[block]] A {};"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:11: expected declaration after decorations"); } TEST_F(ParserImplTest, GlobalDecl_StructMissing_Semi) { - auto* p = parser("[[block]] struct A {}"); + auto p = parser("[[block]] struct A {}"); p->expect_global_decl(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(p->error(), "1:22: expected ';' for struct declaration"); diff --git a/src/reader/wgsl/parser_impl_global_variable_decl_test.cc b/src/reader/wgsl/parser_impl_global_variable_decl_test.cc index d714e96793..65913b3117 100644 --- a/src/reader/wgsl/parser_impl_global_variable_decl_test.cc +++ b/src/reader/wgsl/parser_impl_global_variable_decl_test.cc @@ -24,7 +24,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, GlobalVariableDecl_WithoutConstructor) { - auto* p = parser("var a : f32"); + auto p = parser("var a : f32"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_FALSE(decos.matched); @@ -48,7 +48,7 @@ TEST_F(ParserImplTest, GlobalVariableDecl_WithoutConstructor) { } TEST_F(ParserImplTest, GlobalVariableDecl_WithConstructor) { - auto* p = parser("var a : f32 = 1."); + auto p = parser("var a : f32 = 1."); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_FALSE(decos.matched); @@ -75,7 +75,7 @@ TEST_F(ParserImplTest, GlobalVariableDecl_WithConstructor) { } TEST_F(ParserImplTest, GlobalVariableDecl_WithDecoration) { - auto* p = parser("[[binding(2), set(1)]] var a : f32"); + auto p = parser("[[binding(2), set(1)]] var a : f32"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_TRUE(decos.matched); @@ -108,7 +108,7 @@ TEST_F(ParserImplTest, GlobalVariableDecl_WithDecoration) { } TEST_F(ParserImplTest, GlobalVariableDecl_WithDecoration_MulitpleGroups) { - auto* p = parser("[[binding(2)]] [[set(1)]] var a : f32"); + auto p = parser("[[binding(2)]] [[set(1)]] var a : f32"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_TRUE(decos.matched); @@ -142,7 +142,7 @@ TEST_F(ParserImplTest, GlobalVariableDecl_WithDecoration_MulitpleGroups) { } TEST_F(ParserImplTest, GlobalVariableDecl_InvalidDecoration) { - auto* p = parser("[[binding()]] var a : f32"); + auto p = parser("[[binding()]] var a : f32"); auto decos = p->decoration_list(); EXPECT_TRUE(decos.errored); EXPECT_FALSE(decos.matched); @@ -158,7 +158,7 @@ TEST_F(ParserImplTest, GlobalVariableDecl_InvalidDecoration) { } TEST_F(ParserImplTest, GlobalVariableDecl_InvalidConstExpr) { - auto* p = parser("var a : f32 = if (a) {}"); + auto p = parser("var a : f32 = if (a) {}"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_FALSE(decos.matched); @@ -171,7 +171,7 @@ TEST_F(ParserImplTest, GlobalVariableDecl_InvalidConstExpr) { } TEST_F(ParserImplTest, GlobalVariableDecl_InvalidVariableDecl) { - auto* p = parser("var a : f32;"); + auto p = parser("var a : f32;"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_FALSE(decos.matched); diff --git a/src/reader/wgsl/parser_impl_if_stmt_test.cc b/src/reader/wgsl/parser_impl_if_stmt_test.cc index 0297559770..4fd989ecb6 100644 --- a/src/reader/wgsl/parser_impl_if_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_if_stmt_test.cc @@ -24,7 +24,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, IfStmt) { - auto* p = parser("if (a == 4) { a = b; c = d; }"); + auto p = parser("if (a == 4) { a = b; c = d; }"); auto e = p->if_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -39,8 +39,7 @@ TEST_F(ParserImplTest, IfStmt) { } TEST_F(ParserImplTest, IfStmt_WithElse) { - auto* p = - parser("if (a == 4) { a = b; c = d; } elseif(c) { d = 2; } else {}"); + auto p = parser("if (a == 4) { a = b; c = d; } elseif(c) { d = 2; } else {}"); auto e = p->if_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -62,7 +61,7 @@ TEST_F(ParserImplTest, IfStmt_WithElse) { } TEST_F(ParserImplTest, IfStmt_InvalidCondition) { - auto* p = parser("if (a = 3) {}"); + auto p = parser("if (a = 3) {}"); auto e = p->if_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -72,7 +71,7 @@ TEST_F(ParserImplTest, IfStmt_InvalidCondition) { } TEST_F(ParserImplTest, IfStmt_MissingCondition) { - auto* p = parser("if {}"); + auto p = parser("if {}"); auto e = p->if_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -82,7 +81,7 @@ TEST_F(ParserImplTest, IfStmt_MissingCondition) { } TEST_F(ParserImplTest, IfStmt_InvalidBody) { - auto* p = parser("if (a) { fn main() -> void {}}"); + auto p = parser("if (a) { fn main() -> void {}}"); auto e = p->if_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -92,7 +91,7 @@ TEST_F(ParserImplTest, IfStmt_InvalidBody) { } TEST_F(ParserImplTest, IfStmt_MissingBody) { - auto* p = parser("if (a)"); + auto p = parser("if (a)"); auto e = p->if_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -102,7 +101,7 @@ TEST_F(ParserImplTest, IfStmt_MissingBody) { } TEST_F(ParserImplTest, IfStmt_InvalidElseif) { - auto* p = parser("if (a) {} elseif (a) { fn main() -> a{}}"); + auto p = parser("if (a) {} elseif (a) { fn main() -> a{}}"); auto e = p->if_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -112,7 +111,7 @@ TEST_F(ParserImplTest, IfStmt_InvalidElseif) { } TEST_F(ParserImplTest, IfStmt_InvalidElse) { - auto* p = parser("if (a) {} else { fn main() -> a{}}"); + auto p = parser("if (a) {} else { fn main() -> a{}}"); auto e = p->if_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_image_storage_type_test.cc b/src/reader/wgsl/parser_impl_image_storage_type_test.cc index f454a3bc17..64462f791d 100644 --- a/src/reader/wgsl/parser_impl_image_storage_type_test.cc +++ b/src/reader/wgsl/parser_impl_image_storage_type_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, ImageStorageType_Invalid) { - auto* p = parser("1234"); + auto p = parser("1234"); auto t = p->expect_image_storage_type("test"); EXPECT_TRUE(t.errored); EXPECT_TRUE(p->has_error()); @@ -31,7 +31,7 @@ TEST_F(ParserImplTest, ImageStorageType_Invalid) { } TEST_F(ParserImplTest, ImageStorageType_R8Unorm) { - auto* p = parser("r8unorm"); + auto p = parser("r8unorm"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kR8Unorm); @@ -39,7 +39,7 @@ TEST_F(ParserImplTest, ImageStorageType_R8Unorm) { } TEST_F(ParserImplTest, ImageStorageType_R8Snorm) { - auto* p = parser("r8snorm"); + auto p = parser("r8snorm"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kR8Snorm); @@ -47,7 +47,7 @@ TEST_F(ParserImplTest, ImageStorageType_R8Snorm) { } TEST_F(ParserImplTest, ImageStorageType_R8Uint) { - auto* p = parser("r8uint"); + auto p = parser("r8uint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kR8Uint); @@ -55,7 +55,7 @@ TEST_F(ParserImplTest, ImageStorageType_R8Uint) { } TEST_F(ParserImplTest, ImageStorageType_R8Sint) { - auto* p = parser("r8sint"); + auto p = parser("r8sint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kR8Sint); @@ -63,7 +63,7 @@ TEST_F(ParserImplTest, ImageStorageType_R8Sint) { } TEST_F(ParserImplTest, ImageStorageType_R16Uint) { - auto* p = parser("r16uint"); + auto p = parser("r16uint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kR16Uint); @@ -71,7 +71,7 @@ TEST_F(ParserImplTest, ImageStorageType_R16Uint) { } TEST_F(ParserImplTest, ImageStorageType_R16Sint) { - auto* p = parser("r16sint"); + auto p = parser("r16sint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kR16Sint); @@ -79,7 +79,7 @@ TEST_F(ParserImplTest, ImageStorageType_R16Sint) { } TEST_F(ParserImplTest, ImageStorageType_R16Float) { - auto* p = parser("r16float"); + auto p = parser("r16float"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kR16Float); @@ -87,7 +87,7 @@ TEST_F(ParserImplTest, ImageStorageType_R16Float) { } TEST_F(ParserImplTest, ImageStorageType_Rg8Unorm) { - auto* p = parser("rg8unorm"); + auto p = parser("rg8unorm"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRg8Unorm); @@ -95,7 +95,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rg8Unorm) { } TEST_F(ParserImplTest, ImageStorageType_Rg8Snorm) { - auto* p = parser("rg8snorm"); + auto p = parser("rg8snorm"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRg8Snorm); @@ -103,7 +103,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rg8Snorm) { } TEST_F(ParserImplTest, ImageStorageType_Rg8Uint) { - auto* p = parser("rg8uint"); + auto p = parser("rg8uint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRg8Uint); @@ -111,7 +111,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rg8Uint) { } TEST_F(ParserImplTest, ImageStorageType_Rg8Sint) { - auto* p = parser("rg8sint"); + auto p = parser("rg8sint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRg8Sint); @@ -119,7 +119,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rg8Sint) { } TEST_F(ParserImplTest, ImageStorageType_R32Uint) { - auto* p = parser("r32uint"); + auto p = parser("r32uint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kR32Uint); @@ -127,7 +127,7 @@ TEST_F(ParserImplTest, ImageStorageType_R32Uint) { } TEST_F(ParserImplTest, ImageStorageType_R32Sint) { - auto* p = parser("r32sint"); + auto p = parser("r32sint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kR32Sint); @@ -135,7 +135,7 @@ TEST_F(ParserImplTest, ImageStorageType_R32Sint) { } TEST_F(ParserImplTest, ImageStorageType_R32Float) { - auto* p = parser("r32float"); + auto p = parser("r32float"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kR32Float); @@ -143,7 +143,7 @@ TEST_F(ParserImplTest, ImageStorageType_R32Float) { } TEST_F(ParserImplTest, ImageStorageType_Rg16Uint) { - auto* p = parser("rg16uint"); + auto p = parser("rg16uint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRg16Uint); @@ -151,7 +151,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rg16Uint) { } TEST_F(ParserImplTest, ImageStorageType_Rg16Sint) { - auto* p = parser("rg16sint"); + auto p = parser("rg16sint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRg16Sint); @@ -159,7 +159,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rg16Sint) { } TEST_F(ParserImplTest, ImageStorageType_Rg16Float) { - auto* p = parser("rg16float"); + auto p = parser("rg16float"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRg16Float); @@ -167,7 +167,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rg16Float) { } TEST_F(ParserImplTest, ImageStorageType_Rgba8Unorm) { - auto* p = parser("rgba8unorm"); + auto p = parser("rgba8unorm"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgba8Unorm); @@ -175,7 +175,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rgba8Unorm) { } TEST_F(ParserImplTest, ImageStorageType_Rgba8UnormSrgb) { - auto* p = parser("rgba8unorm_srgb"); + auto p = parser("rgba8unorm_srgb"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgba8UnormSrgb); @@ -183,7 +183,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rgba8UnormSrgb) { } TEST_F(ParserImplTest, ImageStorageType_Rgba8Snorm) { - auto* p = parser("rgba8snorm"); + auto p = parser("rgba8snorm"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgba8Snorm); @@ -191,7 +191,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rgba8Snorm) { } TEST_F(ParserImplTest, ImageStorageType_Rgba8Uint) { - auto* p = parser("rgba8uint"); + auto p = parser("rgba8uint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgba8Uint); @@ -199,7 +199,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rgba8Uint) { } TEST_F(ParserImplTest, ImageStorageType_Rgba8Sint) { - auto* p = parser("rgba8sint"); + auto p = parser("rgba8sint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgba8Sint); @@ -207,7 +207,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rgba8Sint) { } TEST_F(ParserImplTest, ImageStorageType_Bgra8Unorm) { - auto* p = parser("bgra8unorm"); + auto p = parser("bgra8unorm"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kBgra8Unorm); @@ -215,7 +215,7 @@ TEST_F(ParserImplTest, ImageStorageType_Bgra8Unorm) { } TEST_F(ParserImplTest, ImageStorageType_Bgra8UnormSrgb) { - auto* p = parser("bgra8unorm_srgb"); + auto p = parser("bgra8unorm_srgb"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kBgra8UnormSrgb); @@ -223,7 +223,7 @@ TEST_F(ParserImplTest, ImageStorageType_Bgra8UnormSrgb) { } TEST_F(ParserImplTest, ImageStorageType_Rgb10A2Unorm) { - auto* p = parser("rgb10a2unorm"); + auto p = parser("rgb10a2unorm"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgb10A2Unorm); @@ -231,7 +231,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rgb10A2Unorm) { } TEST_F(ParserImplTest, ImageStorageType_Rg11B10Float) { - auto* p = parser("rg11b10float"); + auto p = parser("rg11b10float"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRg11B10Float); @@ -239,7 +239,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rg11B10Float) { } TEST_F(ParserImplTest, ImageStorageType_Rg32Uint) { - auto* p = parser("rg32uint"); + auto p = parser("rg32uint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRg32Uint); @@ -247,7 +247,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rg32Uint) { } TEST_F(ParserImplTest, ImageStorageType_Rg32Sint) { - auto* p = parser("rg32sint"); + auto p = parser("rg32sint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRg32Sint); @@ -255,7 +255,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rg32Sint) { } TEST_F(ParserImplTest, ImageStorageType_Rg32Float) { - auto* p = parser("rg32float"); + auto p = parser("rg32float"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRg32Float); @@ -263,7 +263,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rg32Float) { } TEST_F(ParserImplTest, ImageStorageType_Rgba16Uint) { - auto* p = parser("rgba16uint"); + auto p = parser("rgba16uint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgba16Uint); @@ -271,7 +271,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rgba16Uint) { } TEST_F(ParserImplTest, ImageStorageType_Rgba16Sint) { - auto* p = parser("rgba16sint"); + auto p = parser("rgba16sint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgba16Sint); @@ -279,7 +279,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rgba16Sint) { } TEST_F(ParserImplTest, ImageStorageType_Rgba16Float) { - auto* p = parser("rgba16float"); + auto p = parser("rgba16float"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgba16Float); @@ -287,7 +287,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rgba16Float) { } TEST_F(ParserImplTest, ImageStorageType_Rgba32Uint) { - auto* p = parser("rgba32uint"); + auto p = parser("rgba32uint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgba32Uint); @@ -295,7 +295,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rgba32Uint) { } TEST_F(ParserImplTest, ImageStorageType_Rgba32Sint) { - auto* p = parser("rgba32sint"); + auto p = parser("rgba32sint"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgba32Sint); @@ -303,7 +303,7 @@ TEST_F(ParserImplTest, ImageStorageType_Rgba32Sint) { } TEST_F(ParserImplTest, ImageStorageType_Rgba32Float) { - auto* p = parser("rgba32float"); + auto p = parser("rgba32float"); auto t = p->expect_image_storage_type("test"); EXPECT_FALSE(t.errored); EXPECT_EQ(t.value, ast::type::ImageFormat::kRgba32Float); diff --git a/src/reader/wgsl/parser_impl_inclusive_or_expression_test.cc b/src/reader/wgsl/parser_impl_inclusive_or_expression_test.cc index e01042955a..e1bf011239 100644 --- a/src/reader/wgsl/parser_impl_inclusive_or_expression_test.cc +++ b/src/reader/wgsl/parser_impl_inclusive_or_expression_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, InclusiveOrExpression_Parses) { - auto* p = parser("a | true"); + auto p = parser("a | true"); auto e = p->inclusive_or_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, InclusiveOrExpression_Parses) { } TEST_F(ParserImplTest, InclusiveOrExpression_InvalidLHS) { - auto* p = parser("if (a) {} | true"); + auto p = parser("if (a) {} | true"); auto e = p->inclusive_or_expression(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); @@ -58,7 +58,7 @@ TEST_F(ParserImplTest, InclusiveOrExpression_InvalidLHS) { } TEST_F(ParserImplTest, InclusiveOrExpression_InvalidRHS) { - auto* p = parser("true | if (a) {}"); + auto p = parser("true | if (a) {}"); auto e = p->inclusive_or_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -68,7 +68,7 @@ TEST_F(ParserImplTest, InclusiveOrExpression_InvalidRHS) { } TEST_F(ParserImplTest, InclusiveOrExpression_NoOr_ReturnsLHS) { - auto* p = parser("a true"); + auto p = parser("a true"); auto e = p->inclusive_or_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); diff --git a/src/reader/wgsl/parser_impl_logical_and_expression_test.cc b/src/reader/wgsl/parser_impl_logical_and_expression_test.cc index 0235cad37f..e291ce9199 100644 --- a/src/reader/wgsl/parser_impl_logical_and_expression_test.cc +++ b/src/reader/wgsl/parser_impl_logical_and_expression_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, LogicalAndExpression_Parses) { - auto* p = parser("a && true"); + auto p = parser("a && true"); auto e = p->logical_and_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, LogicalAndExpression_Parses) { } TEST_F(ParserImplTest, LogicalAndExpression_InvalidLHS) { - auto* p = parser("if (a) {} && true"); + auto p = parser("if (a) {} && true"); auto e = p->logical_and_expression(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); @@ -58,7 +58,7 @@ TEST_F(ParserImplTest, LogicalAndExpression_InvalidLHS) { } TEST_F(ParserImplTest, LogicalAndExpression_InvalidRHS) { - auto* p = parser("true && if (a) {}"); + auto p = parser("true && if (a) {}"); auto e = p->logical_and_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -68,7 +68,7 @@ TEST_F(ParserImplTest, LogicalAndExpression_InvalidRHS) { } TEST_F(ParserImplTest, LogicalAndExpression_NoOr_ReturnsLHS) { - auto* p = parser("a true"); + auto p = parser("a true"); auto e = p->logical_and_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); diff --git a/src/reader/wgsl/parser_impl_logical_or_expression_test.cc b/src/reader/wgsl/parser_impl_logical_or_expression_test.cc index fd8c9348b8..006f06f01b 100644 --- a/src/reader/wgsl/parser_impl_logical_or_expression_test.cc +++ b/src/reader/wgsl/parser_impl_logical_or_expression_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, LogicalOrExpression_Parses) { - auto* p = parser("a || true"); + auto p = parser("a || true"); auto e = p->logical_or_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, LogicalOrExpression_Parses) { } TEST_F(ParserImplTest, LogicalOrExpression_InvalidLHS) { - auto* p = parser("if (a) {} || true"); + auto p = parser("if (a) {} || true"); auto e = p->logical_or_expression(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); @@ -58,7 +58,7 @@ TEST_F(ParserImplTest, LogicalOrExpression_InvalidLHS) { } TEST_F(ParserImplTest, LogicalOrExpression_InvalidRHS) { - auto* p = parser("true || if (a) {}"); + auto p = parser("true || if (a) {}"); auto e = p->logical_or_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -68,7 +68,7 @@ TEST_F(ParserImplTest, LogicalOrExpression_InvalidRHS) { } TEST_F(ParserImplTest, LogicalOrExpression_NoOr_ReturnsLHS) { - auto* p = parser("a true"); + auto p = parser("a true"); auto e = p->logical_or_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); diff --git a/src/reader/wgsl/parser_impl_loop_stmt_test.cc b/src/reader/wgsl/parser_impl_loop_stmt_test.cc index f9198a07e0..043afca612 100644 --- a/src/reader/wgsl/parser_impl_loop_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_loop_stmt_test.cc @@ -22,7 +22,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, LoopStmt_BodyNoContinuing) { - auto* p = parser("loop { discard; }"); + auto p = parser("loop { discard; }"); auto e = p->loop_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -36,7 +36,7 @@ TEST_F(ParserImplTest, LoopStmt_BodyNoContinuing) { } TEST_F(ParserImplTest, LoopStmt_BodyWithContinuing) { - auto* p = parser("loop { discard; continuing { discard; }}"); + auto p = parser("loop { discard; continuing { discard; }}"); auto e = p->loop_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -51,7 +51,7 @@ TEST_F(ParserImplTest, LoopStmt_BodyWithContinuing) { } TEST_F(ParserImplTest, LoopStmt_NoBodyNoContinuing) { - auto* p = parser("loop { }"); + auto p = parser("loop { }"); auto e = p->loop_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -62,7 +62,7 @@ TEST_F(ParserImplTest, LoopStmt_NoBodyNoContinuing) { } TEST_F(ParserImplTest, LoopStmt_NoBodyWithContinuing) { - auto* p = parser("loop { continuing { discard; }}"); + auto p = parser("loop { continuing { discard; }}"); auto e = p->loop_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -74,7 +74,7 @@ TEST_F(ParserImplTest, LoopStmt_NoBodyWithContinuing) { } TEST_F(ParserImplTest, LoopStmt_MissingBracketLeft) { - auto* p = parser("loop discard; }"); + auto p = parser("loop discard; }"); auto e = p->loop_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -84,7 +84,7 @@ TEST_F(ParserImplTest, LoopStmt_MissingBracketLeft) { } TEST_F(ParserImplTest, LoopStmt_MissingBracketRight) { - auto* p = parser("loop { discard; "); + auto p = parser("loop { discard; "); auto e = p->loop_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -94,7 +94,7 @@ TEST_F(ParserImplTest, LoopStmt_MissingBracketRight) { } TEST_F(ParserImplTest, LoopStmt_InvalidStatements) { - auto* p = parser("loop { discard }"); + auto p = parser("loop { discard }"); auto e = p->loop_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -104,7 +104,7 @@ TEST_F(ParserImplTest, LoopStmt_InvalidStatements) { } TEST_F(ParserImplTest, LoopStmt_InvalidContinuing) { - auto* p = parser("loop { continuing { discard }}"); + auto p = parser("loop { continuing { discard }}"); auto e = p->loop_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_multiplicative_expression_test.cc b/src/reader/wgsl/parser_impl_multiplicative_expression_test.cc index 19936e9ebc..38f4dac56f 100644 --- a/src/reader/wgsl/parser_impl_multiplicative_expression_test.cc +++ b/src/reader/wgsl/parser_impl_multiplicative_expression_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Multiply) { - auto* p = parser("a * true"); + auto p = parser("a * true"); auto e = p->multiplicative_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Multiply) { } TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Divide) { - auto* p = parser("a / true"); + auto p = parser("a / true"); auto e = p->multiplicative_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -72,7 +72,7 @@ TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Divide) { } TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Modulo) { - auto* p = parser("a % true"); + auto p = parser("a % true"); auto e = p->multiplicative_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -95,7 +95,7 @@ TEST_F(ParserImplTest, MultiplicativeExpression_Parses_Modulo) { } TEST_F(ParserImplTest, MultiplicativeExpression_InvalidLHS) { - auto* p = parser("if (a) {} * true"); + auto p = parser("if (a) {} * true"); auto e = p->multiplicative_expression(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); @@ -104,7 +104,7 @@ TEST_F(ParserImplTest, MultiplicativeExpression_InvalidLHS) { } TEST_F(ParserImplTest, MultiplicativeExpression_InvalidRHS) { - auto* p = parser("true * if (a) {}"); + auto p = parser("true * if (a) {}"); auto e = p->multiplicative_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -114,7 +114,7 @@ TEST_F(ParserImplTest, MultiplicativeExpression_InvalidRHS) { } TEST_F(ParserImplTest, MultiplicativeExpression_NoOr_ReturnsLHS) { - auto* p = parser("a true"); + auto p = parser("a true"); auto e = p->multiplicative_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); diff --git a/src/reader/wgsl/parser_impl_param_list_test.cc b/src/reader/wgsl/parser_impl_param_list_test.cc index 03eea45060..a969b90eac 100644 --- a/src/reader/wgsl/parser_impl_param_list_test.cc +++ b/src/reader/wgsl/parser_impl_param_list_test.cc @@ -31,7 +31,7 @@ namespace { TEST_F(ParserImplTest, ParamList_Single) { auto* i32 = tm()->Get(std::make_unique()); - auto* p = parser("a : i32"); + auto p = parser("a : i32"); auto e = p->expect_param_list(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); @@ -52,7 +52,7 @@ TEST_F(ParserImplTest, ParamList_Multiple) { auto* f32 = tm()->Get(std::make_unique()); auto* vec2 = tm()->Get(std::make_unique(f32, 2)); - auto* p = parser("a : i32, b: f32, c: vec2"); + auto p = parser("a : i32, b: f32, c: vec2"); auto e = p->expect_param_list(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); @@ -87,7 +87,7 @@ TEST_F(ParserImplTest, ParamList_Multiple) { } TEST_F(ParserImplTest, ParamList_Empty) { - auto* p = parser(""); + auto p = parser(""); auto e = p->expect_param_list(); ASSERT_FALSE(p->has_error()); ASSERT_FALSE(e.errored); @@ -95,7 +95,7 @@ TEST_F(ParserImplTest, ParamList_Empty) { } TEST_F(ParserImplTest, ParamList_HangingComma) { - auto* p = parser("a : i32,"); + auto p = parser("a : i32,"); auto e = p->expect_param_list(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc b/src/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc index 9cdcf4f51b..85b7d3cfdc 100644 --- a/src/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc @@ -22,7 +22,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, ParenRhsStmt) { - auto* p = parser("(a + b)"); + auto p = parser("(a + b)"); auto e = p->expect_paren_rhs_stmt(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(e.errored); @@ -31,7 +31,7 @@ TEST_F(ParserImplTest, ParenRhsStmt) { } TEST_F(ParserImplTest, ParenRhsStmt_MissingLeftParen) { - auto* p = parser("true)"); + auto p = parser("true)"); auto e = p->expect_paren_rhs_stmt(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -40,7 +40,7 @@ TEST_F(ParserImplTest, ParenRhsStmt_MissingLeftParen) { } TEST_F(ParserImplTest, ParenRhsStmt_MissingRightParen) { - auto* p = parser("(true"); + auto p = parser("(true"); auto e = p->expect_paren_rhs_stmt(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, ParenRhsStmt_MissingRightParen) { } TEST_F(ParserImplTest, ParenRhsStmt_InvalidExpression) { - auto* p = parser("(if (a() {})"); + auto p = parser("(if (a() {})"); auto e = p->expect_paren_rhs_stmt(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); @@ -58,7 +58,7 @@ TEST_F(ParserImplTest, ParenRhsStmt_InvalidExpression) { } TEST_F(ParserImplTest, ParenRhsStmt_MissingExpression) { - auto* p = parser("()"); + auto p = parser("()"); auto e = p->expect_paren_rhs_stmt(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_pipeline_stage_test.cc b/src/reader/wgsl/parser_impl_pipeline_stage_test.cc index 4cae54e206..009d24cc7e 100644 --- a/src/reader/wgsl/parser_impl_pipeline_stage_test.cc +++ b/src/reader/wgsl/parser_impl_pipeline_stage_test.cc @@ -34,7 +34,7 @@ class PipelineStageTest : public ParserImplTestWithParam {}; TEST_P(PipelineStageTest, Parses) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto stage = p->expect_pipeline_stage(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -57,7 +57,7 @@ INSTANTIATE_TEST_SUITE_P( PipelineStageData{"compute", ast::PipelineStage::kCompute})); TEST_F(ParserImplTest, PipelineStage_NoMatch) { - auto* p = parser("not-a-stage"); + auto p = parser("not-a-stage"); auto stage = p->expect_pipeline_stage(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(stage.errored); diff --git a/src/reader/wgsl/parser_impl_postfix_expression_test.cc b/src/reader/wgsl/parser_impl_postfix_expression_test.cc index 90b5cfecba..10730da694 100644 --- a/src/reader/wgsl/parser_impl_postfix_expression_test.cc +++ b/src/reader/wgsl/parser_impl_postfix_expression_test.cc @@ -29,7 +29,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, PostfixExpression_Array_ConstantIndex) { - auto* p = parser("a[1]"); + auto p = parser("a[1]"); auto e = p->postfix_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -51,7 +51,7 @@ TEST_F(ParserImplTest, PostfixExpression_Array_ConstantIndex) { } TEST_F(ParserImplTest, PostfixExpression_Array_ExpressionIndex) { - auto* p = parser("a[1 + b / 4]"); + auto p = parser("a[1 + b / 4]"); auto e = p->postfix_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -69,7 +69,7 @@ TEST_F(ParserImplTest, PostfixExpression_Array_ExpressionIndex) { } TEST_F(ParserImplTest, PostfixExpression_Array_MissingIndex) { - auto* p = parser("a[]"); + auto p = parser("a[]"); auto e = p->postfix_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -79,7 +79,7 @@ TEST_F(ParserImplTest, PostfixExpression_Array_MissingIndex) { } TEST_F(ParserImplTest, PostfixExpression_Array_MissingRightBrace) { - auto* p = parser("a[1"); + auto p = parser("a[1"); auto e = p->postfix_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -89,7 +89,7 @@ TEST_F(ParserImplTest, PostfixExpression_Array_MissingRightBrace) { } TEST_F(ParserImplTest, PostfixExpression_Array_InvalidIndex) { - auto* p = parser("a[if(a() {})]"); + auto p = parser("a[if(a() {})]"); auto e = p->postfix_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -99,7 +99,7 @@ TEST_F(ParserImplTest, PostfixExpression_Array_InvalidIndex) { } TEST_F(ParserImplTest, PostfixExpression_Call_Empty) { - auto* p = parser("a()"); + auto p = parser("a()"); auto e = p->postfix_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -117,7 +117,7 @@ TEST_F(ParserImplTest, PostfixExpression_Call_Empty) { } TEST_F(ParserImplTest, PostfixExpression_Call_WithArgs) { - auto* p = parser("test(1, b, 2 + 3 / b)"); + auto p = parser("test(1, b, 2 + 3 / b)"); auto e = p->postfix_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -138,7 +138,7 @@ TEST_F(ParserImplTest, PostfixExpression_Call_WithArgs) { } TEST_F(ParserImplTest, PostfixExpression_Call_InvalidArg) { - auto* p = parser("a(if(a) {})"); + auto p = parser("a(if(a) {})"); auto e = p->postfix_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -148,7 +148,7 @@ TEST_F(ParserImplTest, PostfixExpression_Call_InvalidArg) { } TEST_F(ParserImplTest, PostfixExpression_Call_HangingComma) { - auto* p = parser("a(b, )"); + auto p = parser("a(b, )"); auto e = p->postfix_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -158,7 +158,7 @@ TEST_F(ParserImplTest, PostfixExpression_Call_HangingComma) { } TEST_F(ParserImplTest, PostfixExpression_Call_MissingRightParen) { - auto* p = parser("a("); + auto p = parser("a("); auto e = p->postfix_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -168,7 +168,7 @@ TEST_F(ParserImplTest, PostfixExpression_Call_MissingRightParen) { } TEST_F(ParserImplTest, PostfixExpression_MemberAccessor) { - auto* p = parser("a.b"); + auto p = parser("a.b"); auto e = p->postfix_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -185,7 +185,7 @@ TEST_F(ParserImplTest, PostfixExpression_MemberAccessor) { } TEST_F(ParserImplTest, PostfixExpression_MemberAccesssor_InvalidIdent) { - auto* p = parser("a.if"); + auto p = parser("a.if"); auto e = p->postfix_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -195,7 +195,7 @@ TEST_F(ParserImplTest, PostfixExpression_MemberAccesssor_InvalidIdent) { } TEST_F(ParserImplTest, PostfixExpression_MemberAccessor_MissingIdent) { - auto* p = parser("a."); + auto p = parser("a."); auto e = p->postfix_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -205,7 +205,7 @@ TEST_F(ParserImplTest, PostfixExpression_MemberAccessor_MissingIdent) { } TEST_F(ParserImplTest, PostfixExpression_NonMatch_returnLHS) { - auto* p = parser("a b"); + auto p = parser("a b"); auto e = p->postfix_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); diff --git a/src/reader/wgsl/parser_impl_primary_expression_test.cc b/src/reader/wgsl/parser_impl_primary_expression_test.cc index ab77de9f2a..4d1cc5e7d1 100644 --- a/src/reader/wgsl/parser_impl_primary_expression_test.cc +++ b/src/reader/wgsl/parser_impl_primary_expression_test.cc @@ -33,7 +33,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, PrimaryExpression_Ident) { - auto* p = parser("a"); + auto p = parser("a"); auto e = p->primary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -45,7 +45,7 @@ TEST_F(ParserImplTest, PrimaryExpression_Ident) { } TEST_F(ParserImplTest, PrimaryExpression_TypeDecl) { - auto* p = parser("vec4(1, 2, 3, 4))"); + auto p = parser("vec4(1, 2, 3, 4))"); auto e = p->primary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -83,7 +83,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl) { } TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_ZeroConstructor) { - auto* p = parser("vec4()"); + auto p = parser("vec4()"); auto e = p->primary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -97,7 +97,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_ZeroConstructor) { } TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_InvalidTypeDecl) { - auto* p = parser("vec4(2., 3., 4., 5.)"); + auto p = parser("vec4(2., 3., 4., 5.)"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -107,7 +107,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_InvalidTypeDecl) { } TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_MissingLeftParen) { - auto* p = parser("vec4 2., 3., 4., 5.)"); + auto p = parser("vec4 2., 3., 4., 5.)"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -117,7 +117,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_MissingLeftParen) { } TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_MissingRightParen) { - auto* p = parser("vec4(2., 3., 4., 5."); + auto p = parser("vec4(2., 3., 4., 5."); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -127,7 +127,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_MissingRightParen) { } TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_InvalidValue) { - auto* p = parser("i32(if(a) {})"); + auto p = parser("i32(if(a) {})"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -137,7 +137,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_InvalidValue) { } TEST_F(ParserImplTest, PrimaryExpression_ConstLiteral_True) { - auto* p = parser("true"); + auto p = parser("true"); auto e = p->primary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -151,7 +151,7 @@ TEST_F(ParserImplTest, PrimaryExpression_ConstLiteral_True) { } TEST_F(ParserImplTest, PrimaryExpression_ParenExpr) { - auto* p = parser("(a == b)"); + auto p = parser("(a == b)"); auto e = p->primary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -161,7 +161,7 @@ TEST_F(ParserImplTest, PrimaryExpression_ParenExpr) { } TEST_F(ParserImplTest, PrimaryExpression_ParenExpr_MissingRightParen) { - auto* p = parser("(a == b"); + auto p = parser("(a == b"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -171,7 +171,7 @@ TEST_F(ParserImplTest, PrimaryExpression_ParenExpr_MissingRightParen) { } TEST_F(ParserImplTest, PrimaryExpression_ParenExpr_MissingExpr) { - auto* p = parser("()"); + auto p = parser("()"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -181,7 +181,7 @@ TEST_F(ParserImplTest, PrimaryExpression_ParenExpr_MissingExpr) { } TEST_F(ParserImplTest, PrimaryExpression_ParenExpr_InvalidExpr) { - auto* p = parser("(if (a) {})"); + auto p = parser("(if (a) {})"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -193,7 +193,7 @@ TEST_F(ParserImplTest, PrimaryExpression_ParenExpr_InvalidExpr) { TEST_F(ParserImplTest, PrimaryExpression_Cast) { auto* f32_type = tm()->Get(std::make_unique()); - auto* p = parser("f32(1)"); + auto p = parser("f32(1)"); auto e = p->primary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -213,7 +213,7 @@ TEST_F(ParserImplTest, PrimaryExpression_Cast) { TEST_F(ParserImplTest, PrimaryExpression_Bitcast) { auto* f32_type = tm()->Get(std::make_unique()); - auto* p = parser("bitcast(1)"); + auto p = parser("bitcast(1)"); auto e = p->primary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -229,7 +229,7 @@ TEST_F(ParserImplTest, PrimaryExpression_Bitcast) { } TEST_F(ParserImplTest, PrimaryExpression_Bitcast_MissingGreaterThan) { - auto* p = parser("bitcastprimary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -239,7 +239,7 @@ TEST_F(ParserImplTest, PrimaryExpression_Bitcast_MissingGreaterThan) { } TEST_F(ParserImplTest, PrimaryExpression_Bitcast_MissingType) { - auto* p = parser("bitcast<>(1)"); + auto p = parser("bitcast<>(1)"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -249,7 +249,7 @@ TEST_F(ParserImplTest, PrimaryExpression_Bitcast_MissingType) { } TEST_F(ParserImplTest, PrimaryExpression_Bitcast_InvalidType) { - auto* p = parser("bitcast(1)"); + auto p = parser("bitcast(1)"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -259,7 +259,7 @@ TEST_F(ParserImplTest, PrimaryExpression_Bitcast_InvalidType) { } TEST_F(ParserImplTest, PrimaryExpression_Bitcast_MissingLeftParen) { - auto* p = parser("bitcast1)"); + auto p = parser("bitcast1)"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -269,7 +269,7 @@ TEST_F(ParserImplTest, PrimaryExpression_Bitcast_MissingLeftParen) { } TEST_F(ParserImplTest, PrimaryExpression_Bitcast_MissingRightParen) { - auto* p = parser("bitcast(1"); + auto p = parser("bitcast(1"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -279,7 +279,7 @@ TEST_F(ParserImplTest, PrimaryExpression_Bitcast_MissingRightParen) { } TEST_F(ParserImplTest, PrimaryExpression_Bitcast_MissingExpression) { - auto* p = parser("bitcast()"); + auto p = parser("bitcast()"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -289,7 +289,7 @@ TEST_F(ParserImplTest, PrimaryExpression_Bitcast_MissingExpression) { } TEST_F(ParserImplTest, PrimaryExpression_bitcast_InvalidExpression) { - auto* p = parser("bitcast(if (a) {})"); + auto p = parser("bitcast(if (a) {})"); auto e = p->primary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_relational_expression_test.cc b/src/reader/wgsl/parser_impl_relational_expression_test.cc index f679dd8929..70f9a708ac 100644 --- a/src/reader/wgsl/parser_impl_relational_expression_test.cc +++ b/src/reader/wgsl/parser_impl_relational_expression_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, RelationalExpression_Parses_LessThan) { - auto* p = parser("a < true"); + auto p = parser("a < true"); auto e = p->relational_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, RelationalExpression_Parses_LessThan) { } TEST_F(ParserImplTest, RelationalExpression_Parses_GreaterThan) { - auto* p = parser("a > true"); + auto p = parser("a > true"); auto e = p->relational_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -72,7 +72,7 @@ TEST_F(ParserImplTest, RelationalExpression_Parses_GreaterThan) { } TEST_F(ParserImplTest, RelationalExpression_Parses_LessThanEqual) { - auto* p = parser("a <= true"); + auto p = parser("a <= true"); auto e = p->relational_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -95,7 +95,7 @@ TEST_F(ParserImplTest, RelationalExpression_Parses_LessThanEqual) { } TEST_F(ParserImplTest, RelationalExpression_Parses_GreaterThanEqual) { - auto* p = parser("a >= true"); + auto p = parser("a >= true"); auto e = p->relational_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -118,7 +118,7 @@ TEST_F(ParserImplTest, RelationalExpression_Parses_GreaterThanEqual) { } TEST_F(ParserImplTest, RelationalExpression_InvalidLHS) { - auto* p = parser("if (a) {} < true"); + auto p = parser("if (a) {} < true"); auto e = p->relational_expression(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); @@ -127,7 +127,7 @@ TEST_F(ParserImplTest, RelationalExpression_InvalidLHS) { } TEST_F(ParserImplTest, RelationalExpression_InvalidRHS) { - auto* p = parser("true < if (a) {}"); + auto p = parser("true < if (a) {}"); auto e = p->relational_expression(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(e.value, nullptr); @@ -135,7 +135,7 @@ TEST_F(ParserImplTest, RelationalExpression_InvalidRHS) { } TEST_F(ParserImplTest, RelationalExpression_NoOr_ReturnsLHS) { - auto* p = parser("a true"); + auto p = parser("a true"); auto e = p->relational_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); diff --git a/src/reader/wgsl/parser_impl_sampled_texture_type_test.cc b/src/reader/wgsl/parser_impl_sampled_texture_type_test.cc index 9406bdcd67..deda8b7bd3 100644 --- a/src/reader/wgsl/parser_impl_sampled_texture_type_test.cc +++ b/src/reader/wgsl/parser_impl_sampled_texture_type_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, SampledTextureType_Invalid) { - auto* p = parser("1234"); + auto p = parser("1234"); auto t = p->sampled_texture_type(); EXPECT_FALSE(t.matched); EXPECT_FALSE(t.errored); @@ -31,7 +31,7 @@ TEST_F(ParserImplTest, SampledTextureType_Invalid) { } TEST_F(ParserImplTest, SampledTextureType_1d_Old) { - auto* p = parser("texture_sampled_1d"); + auto p = parser("texture_sampled_1d"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -40,7 +40,7 @@ TEST_F(ParserImplTest, SampledTextureType_1d_Old) { } TEST_F(ParserImplTest, SampledTextureType_1dArray_Old) { - auto* p = parser("texture_sampled_1d_array"); + auto p = parser("texture_sampled_1d_array"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, SampledTextureType_1dArray_Old) { } TEST_F(ParserImplTest, SampledTextureType_2d_Old) { - auto* p = parser("texture_sampled_2d"); + auto p = parser("texture_sampled_2d"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -58,7 +58,7 @@ TEST_F(ParserImplTest, SampledTextureType_2d_Old) { } TEST_F(ParserImplTest, SampledTextureType_2dArray_Old) { - auto* p = parser("texture_sampled_2d_array"); + auto p = parser("texture_sampled_2d_array"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -67,7 +67,7 @@ TEST_F(ParserImplTest, SampledTextureType_2dArray_Old) { } TEST_F(ParserImplTest, SampledTextureType_3d_Old) { - auto* p = parser("texture_sampled_3d"); + auto p = parser("texture_sampled_3d"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -76,7 +76,7 @@ TEST_F(ParserImplTest, SampledTextureType_3d_Old) { } TEST_F(ParserImplTest, SampledTextureType_Cube_Old) { - auto* p = parser("texture_sampled_cube"); + auto p = parser("texture_sampled_cube"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -85,7 +85,7 @@ TEST_F(ParserImplTest, SampledTextureType_Cube_Old) { } TEST_F(ParserImplTest, SampledTextureType_kCubeArray_Old) { - auto* p = parser("texture_sampled_cube_array"); + auto p = parser("texture_sampled_cube_array"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -94,7 +94,7 @@ TEST_F(ParserImplTest, SampledTextureType_kCubeArray_Old) { } TEST_F(ParserImplTest, SampledTextureType_1d) { - auto* p = parser("texture_1d"); + auto p = parser("texture_1d"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -103,7 +103,7 @@ TEST_F(ParserImplTest, SampledTextureType_1d) { } TEST_F(ParserImplTest, SampledTextureType_1dArray) { - auto* p = parser("texture_1d_array"); + auto p = parser("texture_1d_array"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -112,7 +112,7 @@ TEST_F(ParserImplTest, SampledTextureType_1dArray) { } TEST_F(ParserImplTest, SampledTextureType_2d) { - auto* p = parser("texture_2d"); + auto p = parser("texture_2d"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -121,7 +121,7 @@ TEST_F(ParserImplTest, SampledTextureType_2d) { } TEST_F(ParserImplTest, SampledTextureType_2dArray) { - auto* p = parser("texture_2d_array"); + auto p = parser("texture_2d_array"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -130,7 +130,7 @@ TEST_F(ParserImplTest, SampledTextureType_2dArray) { } TEST_F(ParserImplTest, SampledTextureType_3d) { - auto* p = parser("texture_3d"); + auto p = parser("texture_3d"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -139,7 +139,7 @@ TEST_F(ParserImplTest, SampledTextureType_3d) { } TEST_F(ParserImplTest, SampledTextureType_Cube) { - auto* p = parser("texture_cube"); + auto p = parser("texture_cube"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -148,7 +148,7 @@ TEST_F(ParserImplTest, SampledTextureType_Cube) { } TEST_F(ParserImplTest, SampledTextureType_kCubeArray) { - auto* p = parser("texture_cube_array"); + auto p = parser("texture_cube_array"); auto t = p->sampled_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); diff --git a/src/reader/wgsl/parser_impl_sampler_type_test.cc b/src/reader/wgsl/parser_impl_sampler_type_test.cc index d1c69ed243..76e376a959 100644 --- a/src/reader/wgsl/parser_impl_sampler_type_test.cc +++ b/src/reader/wgsl/parser_impl_sampler_type_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, SamplerType_Invalid) { - auto* p = parser("1234"); + auto p = parser("1234"); auto t = p->sampler_type(); EXPECT_FALSE(t.matched); EXPECT_FALSE(t.errored); @@ -32,7 +32,7 @@ TEST_F(ParserImplTest, SamplerType_Invalid) { } TEST_F(ParserImplTest, SamplerType_Sampler) { - auto* p = parser("sampler"); + auto p = parser("sampler"); auto t = p->sampler_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -43,7 +43,7 @@ TEST_F(ParserImplTest, SamplerType_Sampler) { } TEST_F(ParserImplTest, SamplerType_ComparisonSampler) { - auto* p = parser("sampler_comparison"); + auto p = parser("sampler_comparison"); auto t = p->sampler_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); diff --git a/src/reader/wgsl/parser_impl_shift_expression_test.cc b/src/reader/wgsl/parser_impl_shift_expression_test.cc index 9118cfdc2e..4bda7f419d 100644 --- a/src/reader/wgsl/parser_impl_shift_expression_test.cc +++ b/src/reader/wgsl/parser_impl_shift_expression_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, ShiftExpression_Parses_ShiftLeft) { - auto* p = parser("a << true"); + auto p = parser("a << true"); auto e = p->shift_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, ShiftExpression_Parses_ShiftLeft) { } TEST_F(ParserImplTest, ShiftExpression_Parses_ShiftRight) { - auto* p = parser("a >> true"); + auto p = parser("a >> true"); auto e = p->shift_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -72,7 +72,7 @@ TEST_F(ParserImplTest, ShiftExpression_Parses_ShiftRight) { } TEST_F(ParserImplTest, ShiftExpression_InvalidLHS) { - auto* p = parser("if (a) {} << true"); + auto p = parser("if (a) {} << true"); auto e = p->shift_expression(); EXPECT_FALSE(e.matched); EXPECT_FALSE(e.errored); @@ -81,7 +81,7 @@ TEST_F(ParserImplTest, ShiftExpression_InvalidLHS) { } TEST_F(ParserImplTest, ShiftExpression_InvalidRHS) { - auto* p = parser("true << if (a) {}"); + auto p = parser("true << if (a) {}"); auto e = p->shift_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -91,7 +91,7 @@ TEST_F(ParserImplTest, ShiftExpression_InvalidRHS) { } TEST_F(ParserImplTest, ShiftExpression_NoOr_ReturnsLHS) { - auto* p = parser("a true"); + auto p = parser("a true"); auto e = p->shift_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); diff --git a/src/reader/wgsl/parser_impl_statement_test.cc b/src/reader/wgsl/parser_impl_statement_test.cc index 166a94974a..85489deaae 100644 --- a/src/reader/wgsl/parser_impl_statement_test.cc +++ b/src/reader/wgsl/parser_impl_statement_test.cc @@ -24,7 +24,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, Statement) { - auto* p = parser("return;"); + auto p = parser("return;"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -33,13 +33,13 @@ TEST_F(ParserImplTest, Statement) { } TEST_F(ParserImplTest, Statement_Semicolon) { - auto* p = parser(";"); + auto p = parser(";"); p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); } TEST_F(ParserImplTest, Statement_Return_NoValue) { - auto* p = parser("return;"); + auto p = parser("return;"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -50,7 +50,7 @@ TEST_F(ParserImplTest, Statement_Return_NoValue) { } TEST_F(ParserImplTest, Statement_Return_Value) { - auto* p = parser("return a + b * (.1 - .2);"); + auto p = parser("return a + b * (.1 - .2);"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); @@ -63,7 +63,7 @@ TEST_F(ParserImplTest, Statement_Return_Value) { } TEST_F(ParserImplTest, Statement_Return_MissingSemi) { - auto* p = parser("return"); + auto p = parser("return"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -73,7 +73,7 @@ TEST_F(ParserImplTest, Statement_Return_MissingSemi) { } TEST_F(ParserImplTest, Statement_Return_Invalid) { - auto* p = parser("return if(a) {};"); + auto p = parser("return if(a) {};"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -83,7 +83,7 @@ TEST_F(ParserImplTest, Statement_Return_Invalid) { } TEST_F(ParserImplTest, Statement_If) { - auto* p = parser("if (a) {}"); + auto p = parser("if (a) {}"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -92,7 +92,7 @@ TEST_F(ParserImplTest, Statement_If) { } TEST_F(ParserImplTest, Statement_If_Invalid) { - auto* p = parser("if (a) { fn main() -> {}}"); + auto p = parser("if (a) { fn main() -> {}}"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -102,7 +102,7 @@ TEST_F(ParserImplTest, Statement_If_Invalid) { } TEST_F(ParserImplTest, Statement_Variable) { - auto* p = parser("var a : i32 = 1;"); + auto p = parser("var a : i32 = 1;"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -111,7 +111,7 @@ TEST_F(ParserImplTest, Statement_Variable) { } TEST_F(ParserImplTest, Statement_Variable_Invalid) { - auto* p = parser("var a : i32 =;"); + auto p = parser("var a : i32 =;"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -121,7 +121,7 @@ TEST_F(ParserImplTest, Statement_Variable_Invalid) { } TEST_F(ParserImplTest, Statement_Variable_MissingSemicolon) { - auto* p = parser("var a : i32"); + auto p = parser("var a : i32"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -131,7 +131,7 @@ TEST_F(ParserImplTest, Statement_Variable_MissingSemicolon) { } TEST_F(ParserImplTest, Statement_Switch) { - auto* p = parser("switch (a) {}"); + auto p = parser("switch (a) {}"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -140,7 +140,7 @@ TEST_F(ParserImplTest, Statement_Switch) { } TEST_F(ParserImplTest, Statement_Switch_Invalid) { - auto* p = parser("switch (a) { case: {}}"); + auto p = parser("switch (a) { case: {}}"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -150,7 +150,7 @@ TEST_F(ParserImplTest, Statement_Switch_Invalid) { } TEST_F(ParserImplTest, Statement_Loop) { - auto* p = parser("loop {}"); + auto p = parser("loop {}"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -159,7 +159,7 @@ TEST_F(ParserImplTest, Statement_Loop) { } TEST_F(ParserImplTest, Statement_Loop_Invalid) { - auto* p = parser("loop discard; }"); + auto p = parser("loop discard; }"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -169,7 +169,7 @@ TEST_F(ParserImplTest, Statement_Loop_Invalid) { } TEST_F(ParserImplTest, Statement_Assignment) { - auto* p = parser("a = b;"); + auto p = parser("a = b;"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -178,7 +178,7 @@ TEST_F(ParserImplTest, Statement_Assignment) { } TEST_F(ParserImplTest, Statement_Assignment_Invalid) { - auto* p = parser("a = if(b) {};"); + auto p = parser("a = if(b) {};"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -188,7 +188,7 @@ TEST_F(ParserImplTest, Statement_Assignment_Invalid) { } TEST_F(ParserImplTest, Statement_Assignment_MissingSemicolon) { - auto* p = parser("a = b"); + auto p = parser("a = b"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -198,7 +198,7 @@ TEST_F(ParserImplTest, Statement_Assignment_MissingSemicolon) { } TEST_F(ParserImplTest, Statement_Break) { - auto* p = parser("break;"); + auto p = parser("break;"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -207,7 +207,7 @@ TEST_F(ParserImplTest, Statement_Break) { } TEST_F(ParserImplTest, Statement_Break_MissingSemicolon) { - auto* p = parser("break"); + auto p = parser("break"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -217,7 +217,7 @@ TEST_F(ParserImplTest, Statement_Break_MissingSemicolon) { } TEST_F(ParserImplTest, Statement_Continue) { - auto* p = parser("continue;"); + auto p = parser("continue;"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -226,7 +226,7 @@ TEST_F(ParserImplTest, Statement_Continue) { } TEST_F(ParserImplTest, Statement_Continue_MissingSemicolon) { - auto* p = parser("continue"); + auto p = parser("continue"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -236,7 +236,7 @@ TEST_F(ParserImplTest, Statement_Continue_MissingSemicolon) { } TEST_F(ParserImplTest, Statement_Discard) { - auto* p = parser("discard;"); + auto p = parser("discard;"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); @@ -246,7 +246,7 @@ TEST_F(ParserImplTest, Statement_Discard) { } TEST_F(ParserImplTest, Statement_Discard_MissingSemicolon) { - auto* p = parser("discard"); + auto p = parser("discard"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_EQ(e.value, nullptr); @@ -256,7 +256,7 @@ TEST_F(ParserImplTest, Statement_Discard_MissingSemicolon) { } TEST_F(ParserImplTest, Statement_Body) { - auto* p = parser("{ var i: i32; }"); + auto p = parser("{ var i: i32; }"); auto e = p->statement(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -266,7 +266,7 @@ TEST_F(ParserImplTest, Statement_Body) { } TEST_F(ParserImplTest, Statement_Body_Invalid) { - auto* p = parser("{ fn main() -> {}}"); + auto p = parser("{ fn main() -> {}}"); auto e = p->statement(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_statements_test.cc b/src/reader/wgsl/parser_impl_statements_test.cc index 58cdc215bc..55bd91909f 100644 --- a/src/reader/wgsl/parser_impl_statements_test.cc +++ b/src/reader/wgsl/parser_impl_statements_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, Statements) { - auto* p = parser("discard; return;"); + auto p = parser("discard; return;"); auto e = p->expect_statements(); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); @@ -33,7 +33,7 @@ TEST_F(ParserImplTest, Statements) { } TEST_F(ParserImplTest, Statements_Empty) { - auto* p = parser(""); + auto p = parser(""); auto e = p->expect_statements(); EXPECT_FALSE(e.errored); EXPECT_FALSE(p->has_error()) << p->error(); diff --git a/src/reader/wgsl/parser_impl_storage_class_test.cc b/src/reader/wgsl/parser_impl_storage_class_test.cc index 2945512324..5e0f0cc38d 100644 --- a/src/reader/wgsl/parser_impl_storage_class_test.cc +++ b/src/reader/wgsl/parser_impl_storage_class_test.cc @@ -35,7 +35,7 @@ class StorageClassTest : public ParserImplTestWithParam {}; TEST_P(StorageClassTest, Parses) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto sc = p->expect_storage_class("test"); EXPECT_FALSE(sc.errored); @@ -61,7 +61,7 @@ INSTANTIATE_TEST_SUITE_P( StorageClassData{"function", ast::StorageClass::kFunction})); TEST_F(ParserImplTest, StorageClass_NoMatch) { - auto* p = parser("not-a-storage-class"); + auto p = parser("not-a-storage-class"); auto sc = p->expect_storage_class("test"); EXPECT_EQ(sc.errored, true); EXPECT_TRUE(p->has_error()); diff --git a/src/reader/wgsl/parser_impl_storage_texture_type_test.cc b/src/reader/wgsl/parser_impl_storage_texture_type_test.cc index 2f6df88c96..ea6744d0f2 100644 --- a/src/reader/wgsl/parser_impl_storage_texture_type_test.cc +++ b/src/reader/wgsl/parser_impl_storage_texture_type_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, StorageTextureType_Invalid) { - auto* p = parser("abc"); + auto p = parser("abc"); auto t = p->storage_texture_type(); EXPECT_FALSE(t.matched); EXPECT_FALSE(t.errored); @@ -31,7 +31,7 @@ TEST_F(ParserImplTest, StorageTextureType_Invalid) { } TEST_F(ParserImplTest, StorageTextureType_Readonly1d_Old) { - auto* p = parser("texture_ro_1d"); + auto p = parser("texture_ro_1d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -41,7 +41,7 @@ TEST_F(ParserImplTest, StorageTextureType_Readonly1d_Old) { } TEST_F(ParserImplTest, StorageTextureType_Readonly1dArray_Old) { - auto* p = parser("texture_ro_1d_array"); + auto p = parser("texture_ro_1d_array"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -51,7 +51,7 @@ TEST_F(ParserImplTest, StorageTextureType_Readonly1dArray_Old) { } TEST_F(ParserImplTest, StorageTextureType_Readonly2d_Old) { - auto* p = parser("texture_ro_2d"); + auto p = parser("texture_ro_2d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -61,7 +61,7 @@ TEST_F(ParserImplTest, StorageTextureType_Readonly2d_Old) { } TEST_F(ParserImplTest, StorageTextureType_Readonly2dArray_Old) { - auto* p = parser("texture_ro_2d_array"); + auto p = parser("texture_ro_2d_array"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -71,7 +71,7 @@ TEST_F(ParserImplTest, StorageTextureType_Readonly2dArray_Old) { } TEST_F(ParserImplTest, StorageTextureType_Readonly3d_Old) { - auto* p = parser("texture_ro_3d"); + auto p = parser("texture_ro_3d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -81,7 +81,7 @@ TEST_F(ParserImplTest, StorageTextureType_Readonly3d_Old) { } TEST_F(ParserImplTest, StorageTextureType_Writeonly1d_Old) { - auto* p = parser("texture_wo_1d"); + auto p = parser("texture_wo_1d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -91,7 +91,7 @@ TEST_F(ParserImplTest, StorageTextureType_Writeonly1d_Old) { } TEST_F(ParserImplTest, StorageTextureType_Writeonly1dArray_Old) { - auto* p = parser("texture_wo_1d_array"); + auto p = parser("texture_wo_1d_array"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -101,7 +101,7 @@ TEST_F(ParserImplTest, StorageTextureType_Writeonly1dArray_Old) { } TEST_F(ParserImplTest, StorageTextureType_Writeonly2d_Old) { - auto* p = parser("texture_wo_2d"); + auto p = parser("texture_wo_2d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -111,7 +111,7 @@ TEST_F(ParserImplTest, StorageTextureType_Writeonly2d_Old) { } TEST_F(ParserImplTest, StorageTextureType_Writeonly2dArray_Old) { - auto* p = parser("texture_wo_2d_array"); + auto p = parser("texture_wo_2d_array"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -121,7 +121,7 @@ TEST_F(ParserImplTest, StorageTextureType_Writeonly2dArray_Old) { } TEST_F(ParserImplTest, StorageTextureType_Writeonly3d_Old) { - auto* p = parser("texture_wo_3d"); + auto p = parser("texture_wo_3d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -131,7 +131,7 @@ TEST_F(ParserImplTest, StorageTextureType_Writeonly3d_Old) { } TEST_F(ParserImplTest, StorageTextureType_ro_1d) { - auto* p = parser("texture_storage_ro_1d"); + auto p = parser("texture_storage_ro_1d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -141,7 +141,7 @@ TEST_F(ParserImplTest, StorageTextureType_ro_1d) { } TEST_F(ParserImplTest, StorageTextureType_ro_1dArray) { - auto* p = parser("texture_storage_ro_1d_array"); + auto p = parser("texture_storage_ro_1d_array"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -151,7 +151,7 @@ TEST_F(ParserImplTest, StorageTextureType_ro_1dArray) { } TEST_F(ParserImplTest, StorageTextureType_ro_2d) { - auto* p = parser("texture_storage_ro_2d"); + auto p = parser("texture_storage_ro_2d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -161,7 +161,7 @@ TEST_F(ParserImplTest, StorageTextureType_ro_2d) { } TEST_F(ParserImplTest, StorageTextureType_ro_2dArray) { - auto* p = parser("texture_storage_ro_2d_array"); + auto p = parser("texture_storage_ro_2d_array"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -171,7 +171,7 @@ TEST_F(ParserImplTest, StorageTextureType_ro_2dArray) { } TEST_F(ParserImplTest, StorageTextureType_ro_3d) { - auto* p = parser("texture_storage_ro_3d"); + auto p = parser("texture_storage_ro_3d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -181,7 +181,7 @@ TEST_F(ParserImplTest, StorageTextureType_ro_3d) { } TEST_F(ParserImplTest, StorageTextureType_wo_1d) { - auto* p = parser("texture_storage_wo_1d"); + auto p = parser("texture_storage_wo_1d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -191,7 +191,7 @@ TEST_F(ParserImplTest, StorageTextureType_wo_1d) { } TEST_F(ParserImplTest, StorageTextureType_wo_1dArray) { - auto* p = parser("texture_storage_wo_1d_array"); + auto p = parser("texture_storage_wo_1d_array"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -201,7 +201,7 @@ TEST_F(ParserImplTest, StorageTextureType_wo_1dArray) { } TEST_F(ParserImplTest, StorageTextureType_wo_2d) { - auto* p = parser("texture_storage_wo_2d"); + auto p = parser("texture_storage_wo_2d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -211,7 +211,7 @@ TEST_F(ParserImplTest, StorageTextureType_wo_2d) { } TEST_F(ParserImplTest, StorageTextureType_wo_2dArray) { - auto* p = parser("texture_storage_wo_2d_array"); + auto p = parser("texture_storage_wo_2d_array"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -221,7 +221,7 @@ TEST_F(ParserImplTest, StorageTextureType_wo_2dArray) { } TEST_F(ParserImplTest, StorageTextureType_wo_3d) { - auto* p = parser("texture_storage_wo_3d"); + auto p = parser("texture_storage_wo_3d"); auto t = p->storage_texture_type(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); diff --git a/src/reader/wgsl/parser_impl_struct_body_decl_test.cc b/src/reader/wgsl/parser_impl_struct_body_decl_test.cc index a12507489c..767273b665 100644 --- a/src/reader/wgsl/parser_impl_struct_body_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_body_decl_test.cc @@ -26,7 +26,7 @@ namespace { TEST_F(ParserImplTest, StructBodyDecl_Parses) { auto* i32 = tm()->Get(std::make_unique()); - auto* p = parser("{a : i32;}"); + auto p = parser("{a : i32;}"); auto m = p->expect_struct_body_decl(); ASSERT_FALSE(p->has_error()); ASSERT_FALSE(m.errored); @@ -39,7 +39,7 @@ TEST_F(ParserImplTest, StructBodyDecl_Parses) { } TEST_F(ParserImplTest, StructBodyDecl_ParsesEmpty) { - auto* p = parser("{}"); + auto p = parser("{}"); auto m = p->expect_struct_body_decl(); ASSERT_FALSE(p->has_error()); ASSERT_FALSE(m.errored); @@ -47,7 +47,7 @@ TEST_F(ParserImplTest, StructBodyDecl_ParsesEmpty) { } TEST_F(ParserImplTest, StructBodyDecl_InvalidMember) { - auto* p = parser(R"( + auto p = parser(R"( { [[offset(nan)]] a : i32; })"); @@ -59,7 +59,7 @@ TEST_F(ParserImplTest, StructBodyDecl_InvalidMember) { } TEST_F(ParserImplTest, StructBodyDecl_MissingClosingBracket) { - auto* p = parser("{a : i32;"); + auto p = parser("{a : i32;"); auto m = p->expect_struct_body_decl(); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(m.errored); @@ -67,7 +67,7 @@ TEST_F(ParserImplTest, StructBodyDecl_MissingClosingBracket) { } TEST_F(ParserImplTest, StructBodyDecl_InvalidToken) { - auto* p = parser(R"( + auto p = parser(R"( { a : i32; 1.23 diff --git a/src/reader/wgsl/parser_impl_struct_decl_test.cc b/src/reader/wgsl/parser_impl_struct_decl_test.cc index 59a91ebcde..87e40e59f5 100644 --- a/src/reader/wgsl/parser_impl_struct_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_decl_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, StructDecl_Parses) { - auto* p = parser(R"( + auto p = parser(R"( struct S { a : i32; [[offset(4)]] b : f32; @@ -45,7 +45,7 @@ struct S { } TEST_F(ParserImplTest, StructDecl_ParsesWithDecoration) { - auto* p = parser(R"( + auto p = parser(R"( [[block]] struct B { a : f32; b : f32; @@ -69,7 +69,7 @@ TEST_F(ParserImplTest, StructDecl_ParsesWithDecoration) { } TEST_F(ParserImplTest, StructDecl_ParsesWithMultipleDecoration) { - auto* p = parser(R"( + auto p = parser(R"( [[block]] [[block]] struct S { a : f32; @@ -95,7 +95,7 @@ TEST_F(ParserImplTest, StructDecl_ParsesWithMultipleDecoration) { } TEST_F(ParserImplTest, StructDecl_EmptyMembers) { - auto* p = parser("struct S {}"); + auto p = parser("struct S {}"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_FALSE(decos.matched); @@ -110,7 +110,7 @@ TEST_F(ParserImplTest, StructDecl_EmptyMembers) { } TEST_F(ParserImplTest, StructDecl_MissingIdent) { - auto* p = parser("struct {}"); + auto p = parser("struct {}"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_FALSE(decos.matched); @@ -126,7 +126,7 @@ TEST_F(ParserImplTest, StructDecl_MissingIdent) { } TEST_F(ParserImplTest, StructDecl_MissingBracketLeft) { - auto* p = parser("struct S }"); + auto p = parser("struct S }"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_FALSE(decos.matched); @@ -142,7 +142,7 @@ TEST_F(ParserImplTest, StructDecl_MissingBracketLeft) { } TEST_F(ParserImplTest, StructDecl_InvalidStructBody) { - auto* p = parser("struct S { a : B; }"); + auto p = parser("struct S { a : B; }"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_FALSE(decos.matched); @@ -158,7 +158,7 @@ TEST_F(ParserImplTest, StructDecl_InvalidStructBody) { } TEST_F(ParserImplTest, StructDecl_InvalidStructDecorationDecl) { - auto* p = parser("[[block struct S { a : i32; }"); + auto p = parser("[[block struct S { a : i32; }"); auto decos = p->decoration_list(); EXPECT_TRUE(decos.errored); EXPECT_FALSE(decos.matched); @@ -173,7 +173,7 @@ TEST_F(ParserImplTest, StructDecl_InvalidStructDecorationDecl) { } TEST_F(ParserImplTest, StructDecl_MissingStruct) { - auto* p = parser("[[block]] S {}"); + auto p = parser("[[block]] S {}"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_TRUE(decos.matched); diff --git a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc index 08358f29b5..a7f320d40f 100644 --- a/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_decoration_decl_test.cc @@ -22,7 +22,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, StructDecorationDecl_Parses) { - auto* p = parser("[[block]]"); + auto p = parser("[[block]]"); auto decos = p->decoration_list(); EXPECT_FALSE(p->has_error()); EXPECT_FALSE(decos.errored); @@ -33,7 +33,7 @@ TEST_F(ParserImplTest, StructDecorationDecl_Parses) { } TEST_F(ParserImplTest, StructDecorationDecl_MissingAttrRight) { - auto* p = parser("[[block"); + auto p = parser("[[block"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -43,7 +43,7 @@ TEST_F(ParserImplTest, StructDecorationDecl_MissingAttrRight) { } TEST_F(ParserImplTest, StructDecorationDecl_InvalidDecoration) { - auto* p = parser("[[invalid]]"); + auto p = parser("[[invalid]]"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); diff --git a/src/reader/wgsl/parser_impl_struct_decoration_test.cc b/src/reader/wgsl/parser_impl_struct_decoration_test.cc index b18f486914..9e5f09a775 100644 --- a/src/reader/wgsl/parser_impl_struct_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_struct_decoration_test.cc @@ -36,7 +36,7 @@ class StructDecorationTest TEST_P(StructDecorationTest, Parses) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto deco = p->decoration(); ASSERT_FALSE(p->has_error()); @@ -52,7 +52,7 @@ INSTANTIATE_TEST_SUITE_P(ParserImplTest, testing::Values(StructDecorationData{"block", true})); TEST_F(ParserImplTest, StructDecoration_NoMatch) { - auto* p = parser("not-a-stage"); + auto p = parser("not-a-stage"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_FALSE(deco.errored); diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc index 0ef8b44a6d..d158cec62c 100644 --- a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, StructMemberDecorationDecl_EmptyStr) { - auto* p = parser(""); + auto p = parser(""); auto decos = p->decoration_list(); EXPECT_FALSE(p->has_error()); EXPECT_FALSE(decos.errored); @@ -32,7 +32,7 @@ TEST_F(ParserImplTest, StructMemberDecorationDecl_EmptyStr) { } TEST_F(ParserImplTest, StructMemberDecorationDecl_EmptyBlock) { - auto* p = parser("[[]]"); + auto p = parser("[[]]"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -42,7 +42,7 @@ TEST_F(ParserImplTest, StructMemberDecorationDecl_EmptyBlock) { } TEST_F(ParserImplTest, StructMemberDecorationDecl_Single) { - auto* p = parser("[[offset(4)]]"); + auto p = parser("[[offset(4)]]"); auto decos = p->decoration_list(); EXPECT_FALSE(p->has_error()); EXPECT_FALSE(decos.errored); @@ -54,7 +54,7 @@ TEST_F(ParserImplTest, StructMemberDecorationDecl_Single) { } TEST_F(ParserImplTest, StructMemberDecorationDecl_InvalidDecoration) { - auto* p = parser("[[offset(nan)]]"); + auto p = parser("[[offset(nan)]]"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()) << p->error(); EXPECT_TRUE(decos.errored); @@ -64,7 +64,7 @@ TEST_F(ParserImplTest, StructMemberDecorationDecl_InvalidDecoration) { } TEST_F(ParserImplTest, StructMemberDecorationDecl_MissingClose) { - auto* p = parser("[[offset(4)"); + auto p = parser("[[offset(4)"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()) << p->error(); EXPECT_TRUE(decos.errored); diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc index 963d32a9e7..76da67abc5 100644 --- a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, StructMemberDecoration_Offset) { - auto* p = parser("offset(4)"); + auto p = parser("offset(4)"); auto deco = p->decoration(); EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); @@ -39,7 +39,7 @@ TEST_F(ParserImplTest, StructMemberDecoration_Offset) { } TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingLeftParen) { - auto* p = parser("offset 4)"); + auto p = parser("offset 4)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -49,7 +49,7 @@ TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingLeftParen) { } TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingRightParen) { - auto* p = parser("offset(4"); + auto p = parser("offset(4"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -59,7 +59,7 @@ TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingRightParen) { } TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingValue) { - auto* p = parser("offset()"); + auto p = parser("offset()"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -70,7 +70,7 @@ TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingValue) { } TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingInvalid) { - auto* p = parser("offset(nan)"); + auto p = parser("offset(nan)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); diff --git a/src/reader/wgsl/parser_impl_struct_member_test.cc b/src/reader/wgsl/parser_impl_struct_member_test.cc index 2ae818a4ac..867f53cbf2 100644 --- a/src/reader/wgsl/parser_impl_struct_member_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_test.cc @@ -27,7 +27,7 @@ namespace { TEST_F(ParserImplTest, StructMember_Parses) { auto* i32 = tm()->Get(std::make_unique()); - auto* p = parser("a : i32;"); + auto p = parser("a : i32;"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_FALSE(decos.matched); @@ -51,7 +51,7 @@ TEST_F(ParserImplTest, StructMember_Parses) { TEST_F(ParserImplTest, StructMember_ParsesWithDecoration) { auto* i32 = tm()->Get(std::make_unique()); - auto* p = parser("[[offset(2)]] a : i32;"); + auto p = parser("[[offset(2)]] a : i32;"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_TRUE(decos.matched); @@ -77,7 +77,7 @@ TEST_F(ParserImplTest, StructMember_ParsesWithDecoration) { TEST_F(ParserImplTest, StructMember_ParsesWithMultipleDecorations) { auto* i32 = tm()->Get(std::make_unique()); - auto* p = parser(R"([[offset(2)]] + auto p = parser(R"([[offset(2)]] [[offset(4)]] a : i32;)"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); @@ -104,7 +104,7 @@ TEST_F(ParserImplTest, StructMember_ParsesWithMultipleDecorations) { } TEST_F(ParserImplTest, StructMember_InvalidDecoration) { - auto* p = parser("[[offset(nan)]] a : i32;"); + auto p = parser("[[offset(nan)]] a : i32;"); auto decos = p->decoration_list(); EXPECT_TRUE(decos.errored); EXPECT_FALSE(decos.matched); @@ -119,7 +119,7 @@ TEST_F(ParserImplTest, StructMember_InvalidDecoration) { } TEST_F(ParserImplTest, StructMember_InvalidVariable) { - auto* p = parser("[[offset(4)]] a : B;"); + auto p = parser("[[offset(4)]] a : B;"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_TRUE(decos.matched); @@ -132,7 +132,7 @@ TEST_F(ParserImplTest, StructMember_InvalidVariable) { } TEST_F(ParserImplTest, StructMember_MissingSemicolon) { - auto* p = parser("a : i32"); + auto p = parser("a : i32"); auto decos = p->decoration_list(); EXPECT_FALSE(decos.errored); EXPECT_FALSE(decos.matched); diff --git a/src/reader/wgsl/parser_impl_switch_body_test.cc b/src/reader/wgsl/parser_impl_switch_body_test.cc index ae2f1b7d64..74ac8a37d3 100644 --- a/src/reader/wgsl/parser_impl_switch_body_test.cc +++ b/src/reader/wgsl/parser_impl_switch_body_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, SwitchBody_Case) { - auto* p = parser("case 1: { a = 4; }"); + auto p = parser("case 1: { a = 4; }"); auto e = p->switch_body(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -36,7 +36,7 @@ TEST_F(ParserImplTest, SwitchBody_Case) { } TEST_F(ParserImplTest, SwitchBody_Case_InvalidConstLiteral) { - auto* p = parser("case a == 4: { a = 4; }"); + auto p = parser("case a == 4: { a = 4; }"); auto e = p->switch_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -46,7 +46,7 @@ TEST_F(ParserImplTest, SwitchBody_Case_InvalidConstLiteral) { } TEST_F(ParserImplTest, SwitchBody_Case_InvalidSelector_bool) { - auto* p = parser("case true: { a = 4; }"); + auto p = parser("case true: { a = 4; }"); auto e = p->switch_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -56,7 +56,7 @@ TEST_F(ParserImplTest, SwitchBody_Case_InvalidSelector_bool) { } TEST_F(ParserImplTest, SwitchBody_Case_MissingConstLiteral) { - auto* p = parser("case: { a = 4; }"); + auto p = parser("case: { a = 4; }"); auto e = p->switch_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -66,7 +66,7 @@ TEST_F(ParserImplTest, SwitchBody_Case_MissingConstLiteral) { } TEST_F(ParserImplTest, SwitchBody_Case_MissingColon) { - auto* p = parser("case 1 { a = 4; }"); + auto p = parser("case 1 { a = 4; }"); auto e = p->switch_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -76,7 +76,7 @@ TEST_F(ParserImplTest, SwitchBody_Case_MissingColon) { } TEST_F(ParserImplTest, SwitchBody_Case_MissingBracketLeft) { - auto* p = parser("case 1: a = 4; }"); + auto p = parser("case 1: a = 4; }"); auto e = p->switch_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -86,7 +86,7 @@ TEST_F(ParserImplTest, SwitchBody_Case_MissingBracketLeft) { } TEST_F(ParserImplTest, SwitchBody_Case_MissingBracketRight) { - auto* p = parser("case 1: { a = 4; "); + auto p = parser("case 1: { a = 4; "); auto e = p->switch_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -96,7 +96,7 @@ TEST_F(ParserImplTest, SwitchBody_Case_MissingBracketRight) { } TEST_F(ParserImplTest, SwitchBody_Case_InvalidCaseBody) { - auto* p = parser("case 1: { fn main() -> void {} }"); + auto p = parser("case 1: { fn main() -> void {} }"); auto e = p->switch_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -106,7 +106,7 @@ TEST_F(ParserImplTest, SwitchBody_Case_InvalidCaseBody) { } TEST_F(ParserImplTest, SwitchBody_Default) { - auto* p = parser("default: { a = 4; }"); + auto p = parser("default: { a = 4; }"); auto e = p->switch_body(); EXPECT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(e.matched); @@ -119,7 +119,7 @@ TEST_F(ParserImplTest, SwitchBody_Default) { } TEST_F(ParserImplTest, SwitchBody_Default_MissingColon) { - auto* p = parser("default { a = 4; }"); + auto p = parser("default { a = 4; }"); auto e = p->switch_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -129,7 +129,7 @@ TEST_F(ParserImplTest, SwitchBody_Default_MissingColon) { } TEST_F(ParserImplTest, SwitchBody_Default_MissingBracketLeft) { - auto* p = parser("default: a = 4; }"); + auto p = parser("default: a = 4; }"); auto e = p->switch_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -139,7 +139,7 @@ TEST_F(ParserImplTest, SwitchBody_Default_MissingBracketLeft) { } TEST_F(ParserImplTest, SwitchBody_Default_MissingBracketRight) { - auto* p = parser("default: { a = 4; "); + auto p = parser("default: { a = 4; "); auto e = p->switch_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); @@ -149,7 +149,7 @@ TEST_F(ParserImplTest, SwitchBody_Default_MissingBracketRight) { } TEST_F(ParserImplTest, SwitchBody_Default_InvalidCaseBody) { - auto* p = parser("default: { fn main() -> void {} }"); + auto p = parser("default: { fn main() -> void {} }"); auto e = p->switch_body(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_switch_stmt_test.cc b/src/reader/wgsl/parser_impl_switch_stmt_test.cc index 85a5a97d15..b4d3394730 100644 --- a/src/reader/wgsl/parser_impl_switch_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_switch_stmt_test.cc @@ -24,7 +24,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, SwitchStmt_WithoutDefault) { - auto* p = parser(R"(switch(a) { + auto p = parser(R"(switch(a) { case 1: {} case 2: {} })"); @@ -40,7 +40,7 @@ TEST_F(ParserImplTest, SwitchStmt_WithoutDefault) { } TEST_F(ParserImplTest, SwitchStmt_Empty) { - auto* p = parser("switch(a) { }"); + auto p = parser("switch(a) { }"); auto e = p->switch_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -51,7 +51,7 @@ TEST_F(ParserImplTest, SwitchStmt_Empty) { } TEST_F(ParserImplTest, SwitchStmt_DefaultInMiddle) { - auto* p = parser(R"(switch(a) { + auto p = parser(R"(switch(a) { case 1: {} default: {} case 2: {} @@ -70,7 +70,7 @@ TEST_F(ParserImplTest, SwitchStmt_DefaultInMiddle) { } TEST_F(ParserImplTest, SwitchStmt_InvalidExpression) { - auto* p = parser("switch(a=b) {}"); + auto p = parser("switch(a=b) {}"); auto e = p->switch_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -80,7 +80,7 @@ TEST_F(ParserImplTest, SwitchStmt_InvalidExpression) { } TEST_F(ParserImplTest, SwitchStmt_MissingExpression) { - auto* p = parser("switch {}"); + auto p = parser("switch {}"); auto e = p->switch_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -90,7 +90,7 @@ TEST_F(ParserImplTest, SwitchStmt_MissingExpression) { } TEST_F(ParserImplTest, SwitchStmt_MissingBracketLeft) { - auto* p = parser("switch(a) }"); + auto p = parser("switch(a) }"); auto e = p->switch_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -100,7 +100,7 @@ TEST_F(ParserImplTest, SwitchStmt_MissingBracketLeft) { } TEST_F(ParserImplTest, SwitchStmt_MissingBracketRight) { - auto* p = parser("switch(a) {"); + auto p = parser("switch(a) {"); auto e = p->switch_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -110,7 +110,7 @@ TEST_F(ParserImplTest, SwitchStmt_MissingBracketRight) { } TEST_F(ParserImplTest, SwitchStmt_InvalidBody) { - auto* p = parser(R"(switch(a) { + auto p = parser(R"(switch(a) { case: {} })"); auto e = p->switch_stmt(); diff --git a/src/reader/wgsl/parser_impl_test.cc b/src/reader/wgsl/parser_impl_test.cc index 096a1d0a7f..829b203940 100644 --- a/src/reader/wgsl/parser_impl_test.cc +++ b/src/reader/wgsl/parser_impl_test.cc @@ -24,12 +24,12 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, Empty) { - auto* p = parser(""); + auto p = parser(""); ASSERT_TRUE(p->Parse()) << p->error(); } TEST_F(ParserImplTest, Parses) { - auto* p = parser(R"( + auto p = parser(R"( [[location(0)]] var gl_FragColor : vec4; [[stage(vertex)]] @@ -45,7 +45,7 @@ fn main() -> void { } TEST_F(ParserImplTest, HandlesError) { - auto* p = parser(R"( + auto p = parser(R"( fn main() -> { # missing return type return; })"); @@ -56,7 +56,7 @@ fn main() -> { # missing return type } TEST_F(ParserImplTest, GetRegisteredType) { - auto* p = parser(""); + auto p = parser(""); ast::type::I32Type i32; p->register_constructed("my_alias", &i32); @@ -66,7 +66,7 @@ TEST_F(ParserImplTest, GetRegisteredType) { } TEST_F(ParserImplTest, GetUnregisteredType) { - auto* p = parser(""); + auto p = parser(""); auto* alias = p->get_constructed("my_alias"); ASSERT_EQ(alias, nullptr); } diff --git a/src/reader/wgsl/parser_impl_test_helper.cc b/src/reader/wgsl/parser_impl_test_helper.cc index 462182354c..acc67aee20 100644 --- a/src/reader/wgsl/parser_impl_test_helper.cc +++ b/src/reader/wgsl/parser_impl_test_helper.cc @@ -21,15 +21,6 @@ ParserImplTest::ParserImplTest() = default; ParserImplTest::~ParserImplTest() = default; -void ParserImplTest::SetUp() { - ctx_.Reset(); -} - -void ParserImplTest::TearDown() { - impl_ = nullptr; - files_.clear(); -} - } // namespace wgsl } // namespace reader } // namespace tint diff --git a/src/reader/wgsl/parser_impl_test_helper.h b/src/reader/wgsl/parser_impl_test_helper.h index d8d5652aa6..d77a9094db 100644 --- a/src/reader/wgsl/parser_impl_test_helper.h +++ b/src/reader/wgsl/parser_impl_test_helper.h @@ -35,20 +35,14 @@ class ParserImplTest : public testing::Test { ParserImplTest(); ~ParserImplTest() override; - /// Sets up the test helper - void SetUp() override; - - /// Tears down the test helper - void TearDown() override; - /// Retrieves the parser from the helper /// @param str the string to parse /// @returns the parser implementation - ParserImpl* parser(const std::string& str) { + std::unique_ptr parser(const std::string& str) { auto file = std::make_unique("test.wgsl", str); - impl_ = std::make_unique(&ctx_, file.get()); + auto impl = std::make_unique(&ctx_, file.get()); files_.emplace_back(std::move(file)); - return impl_.get(); + return impl; } /// @returns the type manager @@ -56,7 +50,6 @@ class ParserImplTest : public testing::Test { private: std::vector> files_; - std::unique_ptr impl_; Context ctx_; }; @@ -68,23 +61,14 @@ class ParserImplTestWithParam : public testing::TestWithParam { ParserImplTestWithParam() = default; ~ParserImplTestWithParam() override = default; - /// Sets up the test helper - void SetUp() override { ctx_.Reset(); } - - /// Tears down the test helper - void TearDown() override { - impl_ = nullptr; - files_.clear(); - } - /// Retrieves the parser from the helper /// @param str the string to parse /// @returns the parser implementation - ParserImpl* parser(const std::string& str) { + std::unique_ptr parser(const std::string& str) { auto file = std::make_unique("test.wgsl", str); - impl_ = std::make_unique(&ctx_, file.get()); + auto impl = std::make_unique(&ctx_, file.get()); files_.emplace_back(std::move(file)); - return impl_.get(); + return impl; } /// @returns the type manager @@ -92,7 +76,7 @@ class ParserImplTestWithParam : public testing::TestWithParam { private: std::vector> files_; - std::unique_ptr impl_; + std::unique_ptr impl; Context ctx_; }; diff --git a/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc b/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc index bfc4474e88..f4d354aa38 100644 --- a/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc +++ b/src/reader/wgsl/parser_impl_texture_sampler_types_test.cc @@ -25,7 +25,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, TextureSamplerTypes_Invalid) { - auto* p = parser("1234"); + auto p = parser("1234"); auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -34,7 +34,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_Invalid) { } TEST_F(ParserImplTest, TextureSamplerTypes_Sampler) { - auto* p = parser("sampler"); + auto p = parser("sampler"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -45,7 +45,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_Sampler) { } TEST_F(ParserImplTest, TextureSamplerTypes_SamplerComparison) { - auto* p = parser("sampler_comparison"); + auto p = parser("sampler_comparison"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -56,7 +56,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SamplerComparison) { } TEST_F(ParserImplTest, TextureSamplerTypes_DepthTexture) { - auto* p = parser("texture_depth_2d"); + auto p = parser("texture_depth_2d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -68,7 +68,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_DepthTexture) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32_Old) { - auto* p = parser("texture_sampled_1d"); + auto p = parser("texture_sampled_1d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -81,7 +81,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32_Old) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_I32_Old) { - auto* p = parser("texture_sampled_2d"); + auto p = parser("texture_sampled_2d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -94,7 +94,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_I32_Old) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_U32_Old) { - auto* p = parser("texture_sampled_3d"); + auto p = parser("texture_sampled_3d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -107,7 +107,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_U32_Old) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_Invalid_Old) { - auto* p = parser("texture_sampled_1d"); + auto p = parser("texture_sampled_1d"); auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); @@ -117,7 +117,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_Invalid_Old) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType_Old) { - auto* p = parser("texture_sampled_1d<>"); + auto p = parser("texture_sampled_1d<>"); auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); @@ -127,7 +127,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType_Old) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan_Old) { - auto* p = parser("texture_sampled_1d"); + auto p = parser("texture_sampled_1d"); auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); @@ -138,7 +138,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan_Old) { TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingGreaterThan_Old) { - auto* p = parser("texture_sampled_1dtexture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); @@ -148,7 +148,7 @@ TEST_F(ParserImplTest, } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32) { - auto* p = parser("texture_1d"); + auto p = parser("texture_1d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -161,7 +161,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_F32) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_I32) { - auto* p = parser("texture_2d"); + auto p = parser("texture_2d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -174,7 +174,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_I32) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_U32) { - auto* p = parser("texture_3d"); + auto p = parser("texture_3d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -187,7 +187,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_U32) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_Invalid) { - auto* p = parser("texture_1d"); + auto p = parser("texture_1d"); auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); @@ -197,7 +197,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_Invalid) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType) { - auto* p = parser("texture_1d<>"); + auto p = parser("texture_1d<>"); auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); @@ -207,7 +207,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingType) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan) { - auto* p = parser("texture_1d"); + auto p = parser("texture_1d"); auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); @@ -217,7 +217,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingLessThan) { } TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingGreaterThan) { - auto* p = parser("texture_1dtexture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); @@ -227,7 +227,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SampledTexture_MissingGreaterThan) { } TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_I32) { - auto* p = parser("texture_multisampled_2d"); + auto p = parser("texture_multisampled_2d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -240,7 +240,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_I32) { } TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_Invalid) { - auto* p = parser("texture_multisampled_2d"); + auto p = parser("texture_multisampled_2d"); auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); @@ -250,7 +250,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_Invalid) { } TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingType) { - auto* p = parser("texture_multisampled_2d<>"); + auto p = parser("texture_multisampled_2d<>"); auto t = p->texture_sampler_types(); ASSERT_TRUE(p->has_error()); EXPECT_EQ(t.value, nullptr); @@ -261,7 +261,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingType) { TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingLessThan) { - auto* p = parser("texture_multisampled_2d"); + auto p = parser("texture_multisampled_2d"); auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -271,7 +271,7 @@ TEST_F(ParserImplTest, TEST_F(ParserImplTest, TextureSamplerTypes_MultisampledTexture_MissingGreaterThan) { - auto* p = parser("texture_multisampled_2dtexture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -281,7 +281,7 @@ TEST_F(ParserImplTest, TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Readonly1dR8Unorm_Old) { - auto* p = parser("texture_ro_1d"); + auto p = parser("texture_ro_1d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -298,7 +298,7 @@ TEST_F(ParserImplTest, TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Writeonly2dR16Float_Old) { - auto* p = parser("texture_wo_2d"); + auto p = parser("texture_wo_2d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -314,7 +314,7 @@ TEST_F(ParserImplTest, } TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType_Old) { - auto* p = parser("texture_ro_1d"); + auto p = parser("texture_ro_1d"); auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -323,7 +323,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType_Old) { } TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType_Old) { - auto* p = parser("texture_wo_1d<>"); + auto p = parser("texture_wo_1d<>"); auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -332,7 +332,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType_Old) { } TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan_Old) { - auto* p = parser("texture_ro_1d"); + auto p = parser("texture_ro_1d"); auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -342,7 +342,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan_Old) { TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingGreaterThan_Old) { - auto* p = parser("texture_wo_1dtexture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -351,7 +351,7 @@ TEST_F(ParserImplTest, } TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Readonly1dR8Unorm) { - auto* p = parser("texture_storage_ro_1d"); + auto p = parser("texture_storage_ro_1d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -367,7 +367,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Readonly1dR8Unorm) { } TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Writeonly2dR16Float) { - auto* p = parser("texture_storage_wo_2d"); + auto p = parser("texture_storage_wo_2d"); auto t = p->texture_sampler_types(); ASSERT_FALSE(p->has_error()) << p->error(); EXPECT_TRUE(t.matched); @@ -383,7 +383,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_Writeonly2dR16Float) { } TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType) { - auto* p = parser("texture_storage_ro_1d"); + auto p = parser("texture_storage_ro_1d"); auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -392,7 +392,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType) { } TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType) { - auto* p = parser("texture_storage_ro_1d<>"); + auto p = parser("texture_storage_ro_1d<>"); auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -401,7 +401,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType) { } TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan) { - auto* p = parser("texture_storage_ro_1d"); + auto p = parser("texture_storage_ro_1d"); auto t = p->texture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); @@ -410,7 +410,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan) { } TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingGreaterThan) { - auto* p = parser("texture_storage_ro_1dtexture_sampler_types(); EXPECT_EQ(t.value, nullptr); EXPECT_FALSE(t.matched); diff --git a/src/reader/wgsl/parser_impl_type_alias_test.cc b/src/reader/wgsl/parser_impl_type_alias_test.cc index cbfb7a101a..02360d6d70 100644 --- a/src/reader/wgsl/parser_impl_type_alias_test.cc +++ b/src/reader/wgsl/parser_impl_type_alias_test.cc @@ -29,7 +29,7 @@ namespace { TEST_F(ParserImplTest, TypeDecl_ParsesType) { auto* i32 = tm()->Get(std::make_unique()); - auto* p = parser("type a = i32"); + auto p = parser("type a = i32"); auto t = p->type_alias(); EXPECT_FALSE(p->has_error()); EXPECT_FALSE(t.errored); @@ -44,7 +44,7 @@ TEST_F(ParserImplTest, TypeDecl_ParsesType) { TEST_F(ParserImplTest, TypeDecl_ParsesStruct_Ident) { ast::type::StructType str("B", {}); - auto* p = parser("type a = B"); + auto p = parser("type a = B"); p->register_constructed("B", &str); auto t = p->type_alias(); @@ -62,7 +62,7 @@ TEST_F(ParserImplTest, TypeDecl_ParsesStruct_Ident) { } TEST_F(ParserImplTest, TypeDecl_MissingIdent) { - auto* p = parser("type = i32"); + auto p = parser("type = i32"); auto t = p->type_alias(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -72,7 +72,7 @@ TEST_F(ParserImplTest, TypeDecl_MissingIdent) { } TEST_F(ParserImplTest, TypeDecl_InvalidIdent) { - auto* p = parser("type 123 = i32"); + auto p = parser("type 123 = i32"); auto t = p->type_alias(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -82,7 +82,7 @@ TEST_F(ParserImplTest, TypeDecl_InvalidIdent) { } TEST_F(ParserImplTest, TypeDecl_MissingEqual) { - auto* p = parser("type a i32"); + auto p = parser("type a i32"); auto t = p->type_alias(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -92,7 +92,7 @@ TEST_F(ParserImplTest, TypeDecl_MissingEqual) { } TEST_F(ParserImplTest, TypeDecl_InvalidType) { - auto* p = parser("type a = B"); + auto p = parser("type a = B"); auto t = p->type_alias(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); diff --git a/src/reader/wgsl/parser_impl_type_decl_test.cc b/src/reader/wgsl/parser_impl_type_decl_test.cc index 587b09dbc5..ffec52dbbb 100644 --- a/src/reader/wgsl/parser_impl_type_decl_test.cc +++ b/src/reader/wgsl/parser_impl_type_decl_test.cc @@ -36,7 +36,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, TypeDecl_Invalid) { - auto* p = parser("1234"); + auto p = parser("1234"); auto t = p->type_decl(); EXPECT_EQ(t.errored, false); EXPECT_EQ(t.matched, false); @@ -45,7 +45,7 @@ TEST_F(ParserImplTest, TypeDecl_Invalid) { } TEST_F(ParserImplTest, TypeDecl_Identifier) { - auto* p = parser("A"); + auto p = parser("A"); auto* int_type = tm()->Get(std::make_unique()); // Pre-register to make sure that it's the same type. @@ -67,7 +67,7 @@ TEST_F(ParserImplTest, TypeDecl_Identifier) { } TEST_F(ParserImplTest, TypeDecl_Identifier_NotFound) { - auto* p = parser("B"); + auto p = parser("B"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); @@ -78,7 +78,7 @@ TEST_F(ParserImplTest, TypeDecl_Identifier_NotFound) { } TEST_F(ParserImplTest, TypeDecl_Bool) { - auto* p = parser("bool"); + auto p = parser("bool"); auto* bool_type = tm()->Get(std::make_unique()); @@ -91,7 +91,7 @@ TEST_F(ParserImplTest, TypeDecl_Bool) { } TEST_F(ParserImplTest, TypeDecl_F32) { - auto* p = parser("f32"); + auto p = parser("f32"); auto* float_type = tm()->Get(std::make_unique()); @@ -104,7 +104,7 @@ TEST_F(ParserImplTest, TypeDecl_F32) { } TEST_F(ParserImplTest, TypeDecl_I32) { - auto* p = parser("i32"); + auto p = parser("i32"); auto* int_type = tm()->Get(std::make_unique()); @@ -117,7 +117,7 @@ TEST_F(ParserImplTest, TypeDecl_I32) { } TEST_F(ParserImplTest, TypeDecl_U32) { - auto* p = parser("u32"); + auto p = parser("u32"); auto* uint_type = tm()->Get(std::make_unique()); @@ -142,7 +142,7 @@ class VecTest : public ParserImplTestWithParam {}; TEST_P(VecTest, Parse) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto t = p->type_decl(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -161,7 +161,7 @@ class VecMissingGreaterThanTest : public ParserImplTestWithParam {}; TEST_P(VecMissingGreaterThanTest, Handles_Missing_GreaterThan) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -179,7 +179,7 @@ class VecMissingLessThanTest : public ParserImplTestWithParam {}; TEST_P(VecMissingLessThanTest, Handles_Missing_GreaterThan) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -197,7 +197,7 @@ class VecBadType : public ParserImplTestWithParam {}; TEST_P(VecBadType, Handles_Unknown_Type) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -215,7 +215,7 @@ class VecMissingType : public ParserImplTestWithParam {}; TEST_P(VecMissingType, Handles_Missing_Type) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -230,7 +230,7 @@ INSTANTIATE_TEST_SUITE_P(ParserImplTest, VecData{"vec4<>", 4})); TEST_F(ParserImplTest, TypeDecl_Ptr) { - auto* p = parser("ptr"); + auto p = parser("ptr"); auto t = p->type_decl(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -244,7 +244,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr) { } TEST_F(ParserImplTest, TypeDecl_Ptr_ToVec) { - auto* p = parser("ptr>"); + auto p = parser("ptr>"); auto t = p->type_decl(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -262,7 +262,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_ToVec) { } TEST_F(ParserImplTest, TypeDecl_Ptr_MissingLessThan) { - auto* p = parser("ptr private, f32>"); + auto p = parser("ptr private, f32>"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -272,7 +272,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingLessThan) { } TEST_F(ParserImplTest, TypeDecl_Ptr_MissingGreaterThan) { - auto* p = parser("ptrtype_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -282,7 +282,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingGreaterThan) { } TEST_F(ParserImplTest, TypeDecl_Ptr_MissingComma) { - auto* p = parser("ptr"); + auto p = parser("ptr"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -292,7 +292,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingComma) { } TEST_F(ParserImplTest, TypeDecl_Ptr_MissingStorageClass) { - auto* p = parser("ptr<, f32>"); + auto p = parser("ptr<, f32>"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -302,7 +302,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingStorageClass) { } TEST_F(ParserImplTest, TypeDecl_Ptr_MissingParams) { - auto* p = parser("ptr<>"); + auto p = parser("ptr<>"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -312,7 +312,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingParams) { } TEST_F(ParserImplTest, TypeDecl_Ptr_MissingType) { - auto* p = parser("ptr"); + auto p = parser("ptr"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -322,7 +322,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_MissingType) { } TEST_F(ParserImplTest, TypeDecl_Ptr_BadStorageClass) { - auto* p = parser("ptr"); + auto p = parser("ptr"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -332,7 +332,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_BadStorageClass) { } TEST_F(ParserImplTest, TypeDecl_Ptr_BadType) { - auto* p = parser("ptr"); + auto p = parser("ptr"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -342,7 +342,7 @@ TEST_F(ParserImplTest, TypeDecl_Ptr_BadType) { } TEST_F(ParserImplTest, TypeDecl_Array) { - auto* p = parser("array"); + auto p = parser("array"); auto t = p->type_decl(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -358,7 +358,7 @@ TEST_F(ParserImplTest, TypeDecl_Array) { } TEST_F(ParserImplTest, TypeDecl_Array_Stride) { - auto* p = parser("[[stride(16)]] array"); + auto p = parser("[[stride(16)]] array"); auto t = p->type_decl(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -375,7 +375,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Stride) { } TEST_F(ParserImplTest, TypeDecl_Array_Runtime_Stride) { - auto* p = parser("[[stride(16)]] array"); + auto p = parser("[[stride(16)]] array"); auto t = p->type_decl(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -391,7 +391,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Runtime_Stride) { } TEST_F(ParserImplTest, TypeDecl_Array_MultipleDecorations_OneBlock) { - auto* p = parser("[[stride(16), stride(32)]] array"); + auto p = parser("[[stride(16), stride(32)]] array"); auto t = p->type_decl(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -412,7 +412,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_MultipleDecorations_OneBlock) { } TEST_F(ParserImplTest, TypeDecl_Array_MultipleDecorations_MultipleBlocks) { - auto* p = parser("[[stride(16)]] [[stride(32)]] array"); + auto p = parser("[[stride(16)]] [[stride(32)]] array"); auto t = p->type_decl(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -433,7 +433,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_MultipleDecorations_MultipleBlocks) { } TEST_F(ParserImplTest, TypeDecl_Array_Decoration_MissingArray) { - auto* p = parser("[[stride(16)]] f32"); + auto p = parser("[[stride(16)]] f32"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -443,7 +443,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Decoration_MissingArray) { } TEST_F(ParserImplTest, TypeDecl_Array_Decoration_MissingClosingAttr) { - auto* p = parser("[[stride(16) array"); + auto p = parser("[[stride(16) array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -453,7 +453,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Decoration_MissingClosingAttr) { } TEST_F(ParserImplTest, TypeDecl_Array_Decoration_UnknownDecoration) { - auto* p = parser("[[unknown 16]] array"); + auto p = parser("[[unknown 16]] array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -463,7 +463,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Decoration_UnknownDecoration) { } TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingLeftParen) { - auto* p = parser("[[stride 4)]] array"); + auto p = parser("[[stride 4)]] array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -473,7 +473,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingLeftParen) { } TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingRightParen) { - auto* p = parser("[[stride(4]] array"); + auto p = parser("[[stride(4]] array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -483,7 +483,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingRightParen) { } TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingValue) { - auto* p = parser("[[stride()]] array"); + auto p = parser("[[stride()]] array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -494,7 +494,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Stride_MissingValue) { } TEST_F(ParserImplTest, TypeDecl_Array_Stride_InvalidValue) { - auto* p = parser("[[stride(invalid)]] array"); + auto p = parser("[[stride(invalid)]] array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -505,7 +505,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Stride_InvalidValue) { } TEST_F(ParserImplTest, TypeDecl_Array_Stride_InvalidValue_Negative) { - auto* p = parser("[[stride(-1)]] array"); + auto p = parser("[[stride(-1)]] array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -515,7 +515,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Stride_InvalidValue_Negative) { } TEST_F(ParserImplTest, TypeDecl_Array_Runtime) { - auto* p = parser("array"); + auto p = parser("array"); auto t = p->type_decl(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -529,7 +529,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_Runtime) { } TEST_F(ParserImplTest, TypeDecl_Array_BadType) { - auto* p = parser("array"); + auto p = parser("array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -539,7 +539,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_BadType) { } TEST_F(ParserImplTest, TypeDecl_Array_ZeroSize) { - auto* p = parser("array"); + auto p = parser("array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -549,7 +549,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_ZeroSize) { } TEST_F(ParserImplTest, TypeDecl_Array_NegativeSize) { - auto* p = parser("array"); + auto p = parser("array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -559,7 +559,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_NegativeSize) { } TEST_F(ParserImplTest, TypeDecl_Array_BadSize) { - auto* p = parser("array"); + auto p = parser("array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -569,7 +569,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_BadSize) { } TEST_F(ParserImplTest, TypeDecl_Array_MissingLessThan) { - auto* p = parser("array f32>"); + auto p = parser("array f32>"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -579,7 +579,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_MissingLessThan) { } TEST_F(ParserImplTest, TypeDecl_Array_MissingGreaterThan) { - auto* p = parser("arraytype_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -589,7 +589,7 @@ TEST_F(ParserImplTest, TypeDecl_Array_MissingGreaterThan) { } TEST_F(ParserImplTest, TypeDecl_Array_MissingComma) { - auto* p = parser("array"); + auto p = parser("array"); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -612,7 +612,7 @@ class MatrixTest : public ParserImplTestWithParam {}; TEST_P(MatrixTest, Parse) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto t = p->type_decl(); EXPECT_TRUE(t.matched); EXPECT_FALSE(t.errored); @@ -640,7 +640,7 @@ class MatrixMissingGreaterThanTest TEST_P(MatrixMissingGreaterThanTest, Handles_Missing_GreaterThan) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -664,7 +664,7 @@ class MatrixMissingLessThanTest : public ParserImplTestWithParam {}; TEST_P(MatrixMissingLessThanTest, Handles_Missing_GreaterThan) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -688,7 +688,7 @@ class MatrixBadType : public ParserImplTestWithParam {}; TEST_P(MatrixBadType, Handles_Unknown_Type) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -712,7 +712,7 @@ class MatrixMissingType : public ParserImplTestWithParam {}; TEST_P(MatrixMissingType, Handles_Missing_Type) { auto params = GetParam(); - auto* p = parser(params.input); + auto p = parser(params.input); auto t = p->type_decl(); EXPECT_TRUE(t.errored); EXPECT_FALSE(t.matched); @@ -733,7 +733,7 @@ INSTANTIATE_TEST_SUITE_P(ParserImplTest, MatrixData{"mat4x4<>", 4, 4})); TEST_F(ParserImplTest, TypeDecl_Sampler) { - auto* p = parser("sampler"); + auto p = parser("sampler"); auto* type = tm()->Get(std::make_unique( ast::type::SamplerKind::kSampler)); @@ -748,7 +748,7 @@ TEST_F(ParserImplTest, TypeDecl_Sampler) { } TEST_F(ParserImplTest, TypeDecl_Texture_Old) { - auto* p = parser("texture_sampled_cube"); + auto p = parser("texture_sampled_cube"); ast::type::F32Type f32; auto* type = tm()->Get(std::make_unique( @@ -765,7 +765,7 @@ TEST_F(ParserImplTest, TypeDecl_Texture_Old) { } TEST_F(ParserImplTest, TypeDecl_Texture) { - auto* p = parser("texture_cube"); + auto p = parser("texture_cube"); ast::type::F32Type f32; auto* type = tm()->Get(std::make_unique( diff --git a/src/reader/wgsl/parser_impl_unary_expression_test.cc b/src/reader/wgsl/parser_impl_unary_expression_test.cc index 57787cabff..6817ed70ce 100644 --- a/src/reader/wgsl/parser_impl_unary_expression_test.cc +++ b/src/reader/wgsl/parser_impl_unary_expression_test.cc @@ -27,7 +27,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, UnaryExpression_Postix) { - auto* p = parser("a[2]"); + auto p = parser("a[2]"); auto e = p->unary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -48,7 +48,7 @@ TEST_F(ParserImplTest, UnaryExpression_Postix) { } TEST_F(ParserImplTest, UnaryExpression_Minus) { - auto* p = parser("- 1"); + auto p = parser("- 1"); auto e = p->unary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -68,7 +68,7 @@ TEST_F(ParserImplTest, UnaryExpression_Minus) { } TEST_F(ParserImplTest, UnaryExpression_Minus_InvalidRHS) { - auto* p = parser("-if(a) {}"); + auto p = parser("-if(a) {}"); auto e = p->unary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -78,7 +78,7 @@ TEST_F(ParserImplTest, UnaryExpression_Minus_InvalidRHS) { } TEST_F(ParserImplTest, UnaryExpression_Bang) { - auto* p = parser("!1"); + auto p = parser("!1"); auto e = p->unary_expression(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -98,7 +98,7 @@ TEST_F(ParserImplTest, UnaryExpression_Bang) { } TEST_F(ParserImplTest, UnaryExpression_Bang_InvalidRHS) { - auto* p = parser("!if (a) {}"); + auto p = parser("!if (a) {}"); auto e = p->unary_expression(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_variable_decl_test.cc b/src/reader/wgsl/parser_impl_variable_decl_test.cc index f84f0d9e87..64fb71e17b 100644 --- a/src/reader/wgsl/parser_impl_variable_decl_test.cc +++ b/src/reader/wgsl/parser_impl_variable_decl_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, VariableDecl_Parses) { - auto* p = parser("var my_var : f32"); + auto p = parser("var my_var : f32"); auto var = p->variable_decl(); EXPECT_FALSE(p->has_error()); EXPECT_TRUE(var.matched); @@ -40,7 +40,7 @@ TEST_F(ParserImplTest, VariableDecl_Parses) { } TEST_F(ParserImplTest, VariableDecl_MissingVar) { - auto* p = parser("my_var : f32"); + auto p = parser("my_var : f32"); auto v = p->variable_decl(); EXPECT_EQ(v.value, nullptr); EXPECT_FALSE(v.matched); @@ -52,7 +52,7 @@ TEST_F(ParserImplTest, VariableDecl_MissingVar) { } TEST_F(ParserImplTest, VariableDecl_InvalidIdentDecl) { - auto* p = parser("var my_var f32"); + auto p = parser("var my_var f32"); auto v = p->variable_decl(); EXPECT_FALSE(v.matched); EXPECT_TRUE(v.errored); @@ -62,7 +62,7 @@ TEST_F(ParserImplTest, VariableDecl_InvalidIdentDecl) { } TEST_F(ParserImplTest, VariableDecl_WithStorageClass) { - auto* p = parser("var my_var : f32"); + auto p = parser("var my_var : f32"); auto v = p->variable_decl(); EXPECT_TRUE(v.matched); EXPECT_FALSE(v.errored); @@ -79,7 +79,7 @@ TEST_F(ParserImplTest, VariableDecl_WithStorageClass) { } TEST_F(ParserImplTest, VariableDecl_InvalidStorageClass) { - auto* p = parser("var my_var : f32"); + auto p = parser("var my_var : f32"); auto v = p->variable_decl(); EXPECT_FALSE(v.matched); EXPECT_TRUE(v.errored); diff --git a/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc b/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc index 60d9a49dcc..f10b13dded 100644 --- a/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc +++ b/src/reader/wgsl/parser_impl_variable_decoration_list_test.cc @@ -24,7 +24,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, VariableDecorationList_Parses) { - auto* p = parser(R"([[location(4), builtin(position)]])"); + auto p = parser(R"([[location(4), builtin(position)]])"); auto decos = p->decoration_list(); ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(decos.errored); @@ -43,7 +43,7 @@ TEST_F(ParserImplTest, VariableDecorationList_Parses) { } TEST_F(ParserImplTest, VariableDecorationList_Empty) { - auto* p = parser(R"([[]])"); + auto p = parser(R"([[]])"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -53,7 +53,7 @@ TEST_F(ParserImplTest, VariableDecorationList_Empty) { } TEST_F(ParserImplTest, VariableDecorationList_Invalid) { - auto* p = parser(R"([[invalid]])"); + auto p = parser(R"([[invalid]])"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -63,7 +63,7 @@ TEST_F(ParserImplTest, VariableDecorationList_Invalid) { } TEST_F(ParserImplTest, VariableDecorationList_ExtraComma) { - auto* p = parser(R"([[builtin(position), ]])"); + auto p = parser(R"([[builtin(position), ]])"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -73,7 +73,7 @@ TEST_F(ParserImplTest, VariableDecorationList_ExtraComma) { } TEST_F(ParserImplTest, VariableDecorationList_MissingComma) { - auto* p = parser(R"([[binding(4) location(5)]])"); + auto p = parser(R"([[binding(4) location(5)]])"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -83,7 +83,7 @@ TEST_F(ParserImplTest, VariableDecorationList_MissingComma) { } TEST_F(ParserImplTest, VariableDecorationList_BadDecoration) { - auto* p = parser(R"([[location(bad)]])"); + auto p = parser(R"([[location(bad)]])"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); @@ -94,7 +94,7 @@ TEST_F(ParserImplTest, VariableDecorationList_BadDecoration) { } TEST_F(ParserImplTest, VariableDecorationList_InvalidBuiltin) { - auto* p = parser("[[builtin(invalid)]]"); + auto p = parser("[[builtin(invalid)]]"); auto decos = p->decoration_list(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(decos.errored); diff --git a/src/reader/wgsl/parser_impl_variable_decoration_test.cc b/src/reader/wgsl/parser_impl_variable_decoration_test.cc index e992a61618..ecef7b0ac6 100644 --- a/src/reader/wgsl/parser_impl_variable_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_variable_decoration_test.cc @@ -26,7 +26,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, VariableDecoration_Location) { - auto* p = parser("location(4)"); + auto p = parser("location(4)"); auto deco = p->decoration(); EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); @@ -41,7 +41,7 @@ TEST_F(ParserImplTest, VariableDecoration_Location) { } TEST_F(ParserImplTest, VariableDecoration_Location_MissingLeftParen) { - auto* p = parser("location 4)"); + auto p = parser("location 4)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -51,7 +51,7 @@ TEST_F(ParserImplTest, VariableDecoration_Location_MissingLeftParen) { } TEST_F(ParserImplTest, VariableDecoration_Location_MissingRightParen) { - auto* p = parser("location(4"); + auto p = parser("location(4"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -61,7 +61,7 @@ TEST_F(ParserImplTest, VariableDecoration_Location_MissingRightParen) { } TEST_F(ParserImplTest, VariableDecoration_Location_MissingValue) { - auto* p = parser("location()"); + auto p = parser("location()"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -72,7 +72,7 @@ TEST_F(ParserImplTest, VariableDecoration_Location_MissingValue) { } TEST_F(ParserImplTest, VariableDecoration_Location_MissingInvalid) { - auto* p = parser("location(nan)"); + auto p = parser("location(nan)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -95,7 +95,7 @@ class BuiltinTest : public ParserImplTestWithParam {}; TEST_P(BuiltinTest, VariableDecoration_Builtin) { auto params = GetParam(); - auto* p = parser(std::string("builtin(") + params.input + ")"); + auto p = parser(std::string("builtin(") + params.input + ")"); auto deco = p->decoration(); EXPECT_TRUE(deco.matched); @@ -125,7 +125,7 @@ INSTANTIATE_TEST_SUITE_P( ast::Builtin::kGlobalInvocationId})); TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingLeftParen) { - auto* p = parser("builtin position)"); + auto p = parser("builtin position)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -135,7 +135,7 @@ TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingLeftParen) { } TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingRightParen) { - auto* p = parser("builtin(position"); + auto p = parser("builtin(position"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -145,7 +145,7 @@ TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingRightParen) { } TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingValue) { - auto* p = parser("builtin()"); + auto p = parser("builtin()"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -155,7 +155,7 @@ TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingValue) { } TEST_F(ParserImplTest, VariableDecoration_Builtin_InvalidValue) { - auto* p = parser("builtin(other_thingy)"); + auto p = parser("builtin(other_thingy)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -165,7 +165,7 @@ TEST_F(ParserImplTest, VariableDecoration_Builtin_InvalidValue) { } TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingInvalid) { - auto* p = parser("builtin(3)"); + auto p = parser("builtin(3)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -175,7 +175,7 @@ TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingInvalid) { } TEST_F(ParserImplTest, VariableDecoration_Binding) { - auto* p = parser("binding(4)"); + auto p = parser("binding(4)"); auto deco = p->decoration(); EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); @@ -190,7 +190,7 @@ TEST_F(ParserImplTest, VariableDecoration_Binding) { } TEST_F(ParserImplTest, VariableDecoration_Binding_MissingLeftParen) { - auto* p = parser("binding 4)"); + auto p = parser("binding 4)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -200,7 +200,7 @@ TEST_F(ParserImplTest, VariableDecoration_Binding_MissingLeftParen) { } TEST_F(ParserImplTest, VariableDecoration_Binding_MissingRightParen) { - auto* p = parser("binding(4"); + auto p = parser("binding(4"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -210,7 +210,7 @@ TEST_F(ParserImplTest, VariableDecoration_Binding_MissingRightParen) { } TEST_F(ParserImplTest, VariableDecoration_Binding_MissingValue) { - auto* p = parser("binding()"); + auto p = parser("binding()"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -221,7 +221,7 @@ TEST_F(ParserImplTest, VariableDecoration_Binding_MissingValue) { } TEST_F(ParserImplTest, VariableDecoration_Binding_MissingInvalid) { - auto* p = parser("binding(nan)"); + auto p = parser("binding(nan)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -232,7 +232,7 @@ TEST_F(ParserImplTest, VariableDecoration_Binding_MissingInvalid) { } TEST_F(ParserImplTest, VariableDecoration_set) { - auto* p = parser("set(4)"); + auto p = parser("set(4)"); auto deco = p->decoration(); EXPECT_TRUE(deco.matched); EXPECT_FALSE(deco.errored); @@ -247,7 +247,7 @@ TEST_F(ParserImplTest, VariableDecoration_set) { } TEST_F(ParserImplTest, VariableDecoration_Set_MissingLeftParen) { - auto* p = parser("set 2)"); + auto p = parser("set 2)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -257,7 +257,7 @@ TEST_F(ParserImplTest, VariableDecoration_Set_MissingLeftParen) { } TEST_F(ParserImplTest, VariableDecoration_Set_MissingRightParen) { - auto* p = parser("set(2"); + auto p = parser("set(2"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -267,7 +267,7 @@ TEST_F(ParserImplTest, VariableDecoration_Set_MissingRightParen) { } TEST_F(ParserImplTest, VariableDecoration_Set_MissingValue) { - auto* p = parser("set()"); + auto p = parser("set()"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); @@ -278,7 +278,7 @@ TEST_F(ParserImplTest, VariableDecoration_Set_MissingValue) { } TEST_F(ParserImplTest, VariableDecoration_Set_MissingInvalid) { - auto* p = parser("set(nan)"); + auto p = parser("set(nan)"); auto deco = p->decoration(); EXPECT_FALSE(deco.matched); EXPECT_TRUE(deco.errored); diff --git a/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc b/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc index 08d0a39e0b..f4af02700f 100644 --- a/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc +++ b/src/reader/wgsl/parser_impl_variable_ident_decl_test.cc @@ -22,7 +22,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, VariableIdentDecl_Parses) { - auto* p = parser("my_var : f32"); + auto p = parser("my_var : f32"); auto decl = p->expect_variable_ident_decl("test"); ASSERT_FALSE(p->has_error()); ASSERT_FALSE(decl.errored); @@ -37,7 +37,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_Parses) { } TEST_F(ParserImplTest, VariableIdentDecl_MissingIdent) { - auto* p = parser(": f32"); + auto p = parser(": f32"); auto decl = p->expect_variable_ident_decl("test"); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(decl.errored); @@ -45,7 +45,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_MissingIdent) { } TEST_F(ParserImplTest, VariableIdentDecl_MissingColon) { - auto* p = parser("my_var f32"); + auto p = parser("my_var f32"); auto decl = p->expect_variable_ident_decl("test"); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(decl.errored); @@ -53,7 +53,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_MissingColon) { } TEST_F(ParserImplTest, VariableIdentDecl_MissingType) { - auto* p = parser("my_var :"); + auto p = parser("my_var :"); auto decl = p->expect_variable_ident_decl("test"); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(decl.errored); @@ -61,7 +61,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_MissingType) { } TEST_F(ParserImplTest, VariableIdentDecl_InvalidIdent) { - auto* p = parser("123 : f32"); + auto p = parser("123 : f32"); auto decl = p->expect_variable_ident_decl("test"); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(decl.errored); @@ -69,7 +69,7 @@ TEST_F(ParserImplTest, VariableIdentDecl_InvalidIdent) { } TEST_F(ParserImplTest, VariableIdentDecl_InvalidType) { - auto* p = parser("my_var : invalid"); + auto p = parser("my_var : invalid"); auto decl = p->expect_variable_ident_decl("test"); ASSERT_TRUE(p->has_error()); ASSERT_TRUE(decl.errored); diff --git a/src/reader/wgsl/parser_impl_variable_stmt_test.cc b/src/reader/wgsl/parser_impl_variable_stmt_test.cc index 20a966c709..fe6cc5a7b5 100644 --- a/src/reader/wgsl/parser_impl_variable_stmt_test.cc +++ b/src/reader/wgsl/parser_impl_variable_stmt_test.cc @@ -24,7 +24,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, VariableStmt_VariableDecl) { - auto* p = parser("var a : i32;"); + auto p = parser("var a : i32;"); auto e = p->variable_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -43,7 +43,7 @@ TEST_F(ParserImplTest, VariableStmt_VariableDecl) { } TEST_F(ParserImplTest, VariableStmt_VariableDecl_WithInit) { - auto* p = parser("var a : i32 = 1;"); + auto p = parser("var a : i32 = 1;"); auto e = p->variable_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -63,7 +63,7 @@ TEST_F(ParserImplTest, VariableStmt_VariableDecl_WithInit) { } TEST_F(ParserImplTest, VariableStmt_VariableDecl_Invalid) { - auto* p = parser("var a : invalid;"); + auto p = parser("var a : invalid;"); auto e = p->variable_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -73,7 +73,7 @@ TEST_F(ParserImplTest, VariableStmt_VariableDecl_Invalid) { } TEST_F(ParserImplTest, VariableStmt_VariableDecl_ConstructorInvalid) { - auto* p = parser("var a : i32 = if(a) {}"); + auto p = parser("var a : i32 = if(a) {}"); auto e = p->variable_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -83,7 +83,7 @@ TEST_F(ParserImplTest, VariableStmt_VariableDecl_ConstructorInvalid) { } TEST_F(ParserImplTest, VariableStmt_Const) { - auto* p = parser("const a : i32 = 1"); + auto p = parser("const a : i32 = 1"); auto e = p->variable_stmt(); EXPECT_TRUE(e.matched); EXPECT_FALSE(e.errored); @@ -98,7 +98,7 @@ TEST_F(ParserImplTest, VariableStmt_Const) { } TEST_F(ParserImplTest, VariableStmt_Const_InvalidVarIdent) { - auto* p = parser("const a : invalid = 1"); + auto p = parser("const a : invalid = 1"); auto e = p->variable_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -108,7 +108,7 @@ TEST_F(ParserImplTest, VariableStmt_Const_InvalidVarIdent) { } TEST_F(ParserImplTest, VariableStmt_Const_MissingEqual) { - auto* p = parser("const a : i32 1"); + auto p = parser("const a : i32 1"); auto e = p->variable_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -118,7 +118,7 @@ TEST_F(ParserImplTest, VariableStmt_Const_MissingEqual) { } TEST_F(ParserImplTest, VariableStmt_Const_MissingConstructor) { - auto* p = parser("const a : i32 ="); + auto p = parser("const a : i32 ="); auto e = p->variable_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); @@ -128,7 +128,7 @@ TEST_F(ParserImplTest, VariableStmt_Const_MissingConstructor) { } TEST_F(ParserImplTest, VariableStmt_Const_InvalidConstructor) { - auto* p = parser("const a : i32 = if (a) {}"); + auto p = parser("const a : i32 = if (a) {}"); auto e = p->variable_stmt(); EXPECT_FALSE(e.matched); EXPECT_TRUE(e.errored); diff --git a/src/reader/wgsl/parser_impl_variable_storage_decoration_test.cc b/src/reader/wgsl/parser_impl_variable_storage_decoration_test.cc index 75daebf2eb..5f8c6ca31d 100644 --- a/src/reader/wgsl/parser_impl_variable_storage_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_variable_storage_decoration_test.cc @@ -36,7 +36,7 @@ class VariableStorageTest TEST_P(VariableStorageTest, Parses) { auto params = GetParam(); - auto* p = parser(std::string("<") + params.input + ">"); + auto p = parser(std::string("<") + params.input + ">"); auto sc = p->variable_storage_decoration(); EXPECT_FALSE(p->has_error()); @@ -64,7 +64,7 @@ INSTANTIATE_TEST_SUITE_P( VariableStorageData{"function", ast::StorageClass::kFunction})); TEST_F(ParserImplTest, VariableStorageDecoration_NoMatch) { - auto* p = parser(""); + auto p = parser(""); auto sc = p->variable_storage_decoration(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(sc.errored); @@ -73,7 +73,7 @@ TEST_F(ParserImplTest, VariableStorageDecoration_NoMatch) { } TEST_F(ParserImplTest, VariableStorageDecoration_Empty) { - auto* p = parser("<>"); + auto p = parser("<>"); auto sc = p->variable_storage_decoration(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(sc.errored); @@ -82,7 +82,7 @@ TEST_F(ParserImplTest, VariableStorageDecoration_Empty) { } TEST_F(ParserImplTest, VariableStorageDecoration_MissingLessThan) { - auto* p = parser("in>"); + auto p = parser("in>"); auto sc = p->variable_storage_decoration(); EXPECT_FALSE(p->has_error()); EXPECT_FALSE(sc.errored); @@ -93,7 +93,7 @@ TEST_F(ParserImplTest, VariableStorageDecoration_MissingLessThan) { } TEST_F(ParserImplTest, VariableStorageDecoration_MissingGreaterThan) { - auto* p = parser("variable_storage_decoration(); EXPECT_TRUE(p->has_error()); EXPECT_TRUE(sc.errored);