Demangler: Change signature of primary Demangle() function
Have this take a SymbolTable instead of a Program. Program will be split into Program (immutable) and ProgramBuilder (mutable). We'll need Demangler to support both. Bug: tint:390 Change-Id: I6447dd9674919d4867ed8ba126880cdfd9bf7128 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38550 Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
d7137d7233
commit
44bec80e5f
|
@ -60,7 +60,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|||
|
||||
// Expect the demangled AST printed with to_str() to match
|
||||
tint::Demangler d;
|
||||
ASSERT_EQ(d.Demangle(src, src.to_str()), d.Demangle(dst, dst.to_str()));
|
||||
ASSERT_EQ(d.Demangle(src), d.Demangle(dst));
|
||||
|
||||
// Check that none of the AST nodes or type pointers in dst are found in src
|
||||
std::unordered_set<tint::ast::Node*> src_nodes;
|
||||
|
|
|
@ -511,7 +511,7 @@ int main(int argc, const char** argv) {
|
|||
if (options.dump_ast) {
|
||||
auto ast_str = program.to_str();
|
||||
if (options.demangle) {
|
||||
ast_str = tint::Demangler().Demangle(program, ast_str);
|
||||
ast_str = tint::Demangler().Demangle(program.Symbols(), ast_str);
|
||||
}
|
||||
std::cout << std::endl << ast_str << std::endl;
|
||||
}
|
||||
|
@ -558,15 +558,13 @@ int main(int argc, const char** argv) {
|
|||
|
||||
#if TINT_BUILD_SPV_WRITER
|
||||
if (options.format == Format::kSpirv || options.format == Format::kSpvAsm) {
|
||||
writer =
|
||||
std::make_unique<tint::writer::spirv::Generator>(&program);
|
||||
writer = std::make_unique<tint::writer::spirv::Generator>(&program);
|
||||
}
|
||||
#endif // TINT_BUILD_SPV_WRITER
|
||||
|
||||
#if TINT_BUILD_WGSL_WRITER
|
||||
if (options.format == Format::kWgsl) {
|
||||
writer =
|
||||
std::make_unique<tint::writer::wgsl::Generator>(&program);
|
||||
writer = std::make_unique<tint::writer::wgsl::Generator>(&program);
|
||||
}
|
||||
#endif // TINT_BUILD_WGSL_WRITER
|
||||
|
||||
|
@ -578,8 +576,7 @@ int main(int argc, const char** argv) {
|
|||
|
||||
#if TINT_BUILD_HLSL_WRITER
|
||||
if (options.format == Format::kHlsl) {
|
||||
writer =
|
||||
std::make_unique<tint::writer::hlsl::Generator>(&program);
|
||||
writer = std::make_unique<tint::writer::hlsl::Generator>(&program);
|
||||
}
|
||||
#endif // TINT_BUILD_HLSL_WRITER
|
||||
|
||||
|
@ -644,7 +641,7 @@ int main(int argc, const char** argv) {
|
|||
auto* w = static_cast<tint::writer::Text*>(writer.get());
|
||||
auto output = w->result();
|
||||
if (options.demangle) {
|
||||
output = tint::Demangler().Demangle(program, output);
|
||||
output = tint::Demangler().Demangle(program.Symbols(), output);
|
||||
}
|
||||
if (!WriteFile(options.output_file, "w", output)) {
|
||||
return 1;
|
||||
|
|
|
@ -118,8 +118,8 @@ fn main() -> void {
|
|||
|
||||
// Expect the AST printed with to_str() to match
|
||||
Demangler demanger;
|
||||
EXPECT_EQ(demanger.Demangle(src, src.to_str()),
|
||||
demanger.Demangle(dst, dst.to_str()));
|
||||
EXPECT_EQ(demanger.Demangle(src.Symbols(), src.to_str()),
|
||||
demanger.Demangle(dst.Symbols(), dst.to_str()));
|
||||
|
||||
// Check that none of the AST nodes or type pointers in dst are found in src
|
||||
std::unordered_set<ast::Node*> src_nodes;
|
||||
|
|
|
@ -35,7 +35,7 @@ class TestHelperBase : public BASE, public BuilderWithProgram {
|
|||
/// @param s the string to demangle
|
||||
/// @returns the demangled string
|
||||
std::string demangle(const std::string& s) {
|
||||
return demanger.Demangle(*mod, s);
|
||||
return demanger.Demangle(mod->Symbols(), s);
|
||||
}
|
||||
|
||||
/// A demangler
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
|
||||
#include "src/demangler.h"
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/program.h"
|
||||
|
||||
namespace tint {
|
||||
namespace {
|
||||
|
||||
|
@ -26,7 +29,7 @@ Demangler::Demangler() = default;
|
|||
|
||||
Demangler::~Demangler() = default;
|
||||
|
||||
std::string Demangler::Demangle(const Program& program,
|
||||
std::string Demangler::Demangle(const SymbolTable& symbols,
|
||||
const std::string& str) const {
|
||||
auto ret = str;
|
||||
|
||||
|
@ -46,7 +49,7 @@ std::string Demangler::Demangle(const Program& program,
|
|||
auto id = ret.substr(start_idx, len);
|
||||
|
||||
Symbol sym(std::stoi(id));
|
||||
auto name = program.Symbols().NameFor(sym);
|
||||
auto name = symbols.NameFor(sym);
|
||||
ret.replace(idx, end_idx - idx, name);
|
||||
|
||||
pos = idx + name.length();
|
||||
|
@ -55,4 +58,8 @@ std::string Demangler::Demangle(const Program& program,
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::string Demangler::Demangle(const Program& program) const {
|
||||
return Demangle(program.Symbols(), program.AST().to_str());
|
||||
}
|
||||
|
||||
} // namespace tint
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "src/program.h"
|
||||
|
||||
namespace tint {
|
||||
|
||||
class Program;
|
||||
class SymbolTable;
|
||||
|
||||
/// Helper to demangle strings and replace symbols with original names
|
||||
class Demangler {
|
||||
public:
|
||||
|
@ -30,10 +31,17 @@ class Demangler {
|
|||
~Demangler();
|
||||
|
||||
/// Transforms given string and replaces any symbols with original names
|
||||
/// @param program the program where the symbols are registered
|
||||
/// @param symbols the symbol table
|
||||
/// @param str the string to replace
|
||||
/// @returns the string with any symbol replacements performed.
|
||||
std::string Demangle(const Program& program, const std::string& str) const;
|
||||
std::string Demangle(const SymbolTable& symbols,
|
||||
const std::string& str) const;
|
||||
|
||||
/// Returns the string returned by the `program.AST().to_str()` of the
|
||||
/// program with all symbols replaced with their original names.
|
||||
/// @param program the program where the symbols are registered
|
||||
/// @returns the string with any symbol replacements performed.
|
||||
std::string Demangle(const Program& program) const;
|
||||
};
|
||||
|
||||
} // namespace tint
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
// limitations under the License.
|
||||
|
||||
#include "src/demangler.h"
|
||||
#include "src/symbol_table.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "src/program.h"
|
||||
|
||||
namespace tint {
|
||||
namespace {
|
||||
|
@ -23,30 +23,30 @@ namespace {
|
|||
using DemanglerTest = testing::Test;
|
||||
|
||||
TEST_F(DemanglerTest, NoSymbols) {
|
||||
Program m;
|
||||
m.Symbols().Register("sym1");
|
||||
SymbolTable t;
|
||||
t.Register("sym1");
|
||||
|
||||
Demangler d;
|
||||
EXPECT_EQ("test str", d.Demangle(m, "test str"));
|
||||
EXPECT_EQ("test str", d.Demangle(t, "test str"));
|
||||
}
|
||||
|
||||
TEST_F(DemanglerTest, Symbol) {
|
||||
Program m;
|
||||
m.Symbols().Register("sym1");
|
||||
SymbolTable t;
|
||||
t.Register("sym1");
|
||||
|
||||
Demangler d;
|
||||
EXPECT_EQ("test sym1 str", d.Demangle(m, "test tint_symbol_1 str"));
|
||||
EXPECT_EQ("test sym1 str", d.Demangle(t, "test tint_symbol_1 str"));
|
||||
}
|
||||
|
||||
TEST_F(DemanglerTest, MultipleSymbols) {
|
||||
Program m;
|
||||
m.Symbols().Register("sym1");
|
||||
m.Symbols().Register("sym2");
|
||||
SymbolTable t;
|
||||
t.Register("sym1");
|
||||
t.Register("sym2");
|
||||
|
||||
Demangler d;
|
||||
EXPECT_EQ(
|
||||
"test sym1 sym2 sym1 str",
|
||||
d.Demangle(m, "test tint_symbol_1 tint_symbol_2 tint_symbol_1 str"));
|
||||
d.Demangle(t, "test tint_symbol_1 tint_symbol_2 tint_symbol_1 str"));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -216,8 +216,7 @@ TEST_F(SpvParserTest, EmitStatement_CallWithParams) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto program_ast_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto program_ast_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(program_ast_str, HasSubstr(R"(Module{
|
||||
Function x_50 -> __u32
|
||||
(
|
||||
|
|
|
@ -59,7 +59,7 @@ TEST_F(SpvParserTest, Emit_VoidFunctionWithoutParams) {
|
|||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.Emit());
|
||||
auto got = Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
auto got = Demangler().Demangle(p->get_program());
|
||||
std::string expect = R"(Module{
|
||||
Function x_100 -> __void
|
||||
()
|
||||
|
@ -83,7 +83,7 @@ TEST_F(SpvParserTest, Emit_NonVoidResultType) {
|
|||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.Emit());
|
||||
|
||||
auto got = Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
auto got = Demangler().Demangle(p->get_program());
|
||||
std::string expect = R"(Module{
|
||||
Function x_100 -> __f32
|
||||
()
|
||||
|
@ -115,7 +115,7 @@ TEST_F(SpvParserTest, Emit_MixedParamTypes) {
|
|||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.Emit());
|
||||
|
||||
auto got = Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
auto got = Demangler().Demangle(p->get_program());
|
||||
std::string expect = R"(Module{
|
||||
Function x_100 -> __void
|
||||
(
|
||||
|
@ -159,7 +159,7 @@ TEST_F(SpvParserTest, Emit_GenerateParamNames) {
|
|||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.Emit());
|
||||
|
||||
auto got = Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
auto got = Demangler().Demangle(p->get_program());
|
||||
std::string expect = R"(Module{
|
||||
Function x_100 -> __void
|
||||
(
|
||||
|
|
|
@ -813,8 +813,7 @@ TEST_F(SpvParserTest, RemapStorageBuffer_TypesAndVarDeclarations) {
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
|
||||
<< assembly << p->error();
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
RTArr -> __array__u32_stride_4
|
||||
S Struct{
|
||||
|
|
|
@ -329,7 +329,7 @@ TEST_P(SpvParserSwizzleTest, Sample) {
|
|||
ASSERT_NE(result, nullptr);
|
||||
std::ostringstream ss;
|
||||
result->to_str(ss, 0);
|
||||
auto str = Demangler().Demangle(p->get_program(), ss.str());
|
||||
auto str = Demangler().Demangle(p->get_program().Symbols(), ss.str());
|
||||
EXPECT_THAT(str, Eq(GetParam().expected_expr));
|
||||
} else {
|
||||
EXPECT_EQ(result, nullptr);
|
||||
|
|
|
@ -566,7 +566,8 @@ TEST_F(SpvParserTest, ConvertType_StructTwoMembers) {
|
|||
EXPECT_TRUE(type->Is<type::Struct>());
|
||||
std::stringstream ss;
|
||||
type->As<type::Struct>()->impl()->to_str(ss, 0);
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program(), ss.str()), Eq(R"(Struct{
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program().Symbols(), ss.str()),
|
||||
Eq(R"(Struct{
|
||||
StructMember{field0: __u32}
|
||||
StructMember{field1: __f32}
|
||||
}
|
||||
|
@ -587,7 +588,8 @@ TEST_F(SpvParserTest, ConvertType_StructWithBlockDecoration) {
|
|||
EXPECT_TRUE(type->Is<type::Struct>());
|
||||
std::stringstream ss;
|
||||
type->As<type::Struct>()->impl()->to_str(ss, 0);
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program(), ss.str()), Eq(R"(Struct{
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program().Symbols(), ss.str()),
|
||||
Eq(R"(Struct{
|
||||
[[block]]
|
||||
StructMember{field0: __u32}
|
||||
}
|
||||
|
@ -612,7 +614,8 @@ TEST_F(SpvParserTest, ConvertType_StructWithMemberDecorations) {
|
|||
EXPECT_TRUE(type->Is<type::Struct>());
|
||||
std::stringstream ss;
|
||||
type->As<type::Struct>()->impl()->to_str(ss, 0);
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program(), ss.str()), Eq(R"(Struct{
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program().Symbols(), ss.str()),
|
||||
Eq(R"(Struct{
|
||||
StructMember{[[ offset 0 ]] field0: __f32}
|
||||
StructMember{[[ offset 8 ]] field1: __vec_2__f32}
|
||||
StructMember{[[ offset 16 ]] field2: __mat_2_2__f32}
|
||||
|
|
|
@ -199,8 +199,7 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) {
|
|||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto program_ast =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto program_ast = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(program_ast, HasSubstr(R"(
|
||||
Function leaf -> __u32
|
||||
()
|
||||
|
@ -267,8 +266,7 @@ TEST_F(SpvParserTest, EmitFunctions_NonVoidResultType) {
|
|||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto program_ast =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto program_ast = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(program_ast, HasSubstr(R"(
|
||||
Function ret_float -> __f32
|
||||
()
|
||||
|
@ -297,8 +295,7 @@ TEST_F(SpvParserTest, EmitFunctions_MixedParamTypes) {
|
|||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto program_ast =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto program_ast = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(program_ast, HasSubstr(R"(
|
||||
Function mixed_params -> __void
|
||||
(
|
||||
|
@ -337,8 +334,7 @@ TEST_F(SpvParserTest, EmitFunctions_GenerateParamNames) {
|
|||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto program_ast =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto program_ast = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(program_ast, HasSubstr(R"(
|
||||
Function mixed_params -> __void
|
||||
(
|
||||
|
|
|
@ -1129,8 +1129,7 @@ TEST_P(SpvParserTest_DeclUnderspecifiedHandle, Variable) {
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error() << assembly;
|
||||
EXPECT_TRUE(p->error().empty()) << p->error();
|
||||
const auto program =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto program = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(program, HasSubstr(GetParam().var_decl)) << program;
|
||||
}
|
||||
|
||||
|
@ -1306,8 +1305,7 @@ TEST_P(SpvParserTest_SampledImageAccessTest, Variable) {
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error() << assembly;
|
||||
EXPECT_TRUE(p->error().empty()) << p->error();
|
||||
const auto program =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto program = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(program, HasSubstr(GetParam().var_decl))
|
||||
<< "DECLARATIONS ARE BAD " << program;
|
||||
EXPECT_THAT(program, HasSubstr(GetParam().texture_builtin))
|
||||
|
@ -2556,8 +2554,7 @@ TEST_P(SpvParserTest_ImageAccessTest, Variable) {
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error() << assembly;
|
||||
EXPECT_TRUE(p->error().empty()) << p->error();
|
||||
const auto program =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto program = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(program, HasSubstr(GetParam().var_decl))
|
||||
<< "DECLARATIONS ARE BAD " << program;
|
||||
EXPECT_THAT(program, HasSubstr(GetParam().texture_builtin))
|
||||
|
@ -3712,7 +3709,7 @@ TEST_P(SpvParserTest_ImageCoordsTest, MakeCoordinateOperandsForImageAccess) {
|
|||
for (auto* expr : result) {
|
||||
ASSERT_NE(expr, nullptr);
|
||||
result_strings.push_back(
|
||||
Demangler().Demangle(p->get_program(), expr->str()));
|
||||
Demangler().Demangle(p->get_program().Symbols(), expr->str()));
|
||||
}
|
||||
EXPECT_THAT(result_strings,
|
||||
::testing::ContainerEq(GetParam().expected_expressions));
|
||||
|
|
|
@ -143,8 +143,7 @@ TEST_F(SpvModuleScopeVarParserTest, AnonWorkgroupVar) {
|
|||
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Variable{
|
||||
x_52
|
||||
|
@ -163,8 +162,7 @@ TEST_F(SpvModuleScopeVarParserTest, NamedWorkgroupVar) {
|
|||
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Variable{
|
||||
the_counter
|
||||
|
@ -183,8 +181,7 @@ TEST_F(SpvModuleScopeVarParserTest, PrivateVar) {
|
|||
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Variable{
|
||||
my_own_private_idaho
|
||||
|
@ -203,8 +200,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinVertexIndex) {
|
|||
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Variable{
|
||||
Decorations{
|
||||
|
@ -254,8 +250,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPosition_MapsToModuleScopeVec4Var) {
|
|||
EXPECT_EQ(position_info.pointer_type_id, 11u);
|
||||
EXPECT_EQ(position_info.storage_class, SpvStorageClassOutput);
|
||||
EXPECT_EQ(position_info.per_vertex_var_id, 1u);
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Variable{
|
||||
Decorations{
|
||||
|
@ -335,8 +330,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPosition_StorePosition) {
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Assignment{
|
||||
Identifier[not set]{gl_Position}
|
||||
|
@ -389,8 +383,7 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Assignment{
|
||||
Identifier[not set]{gl_Position}
|
||||
|
@ -421,8 +414,7 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Assignment{
|
||||
MemberAccessor[not set]{
|
||||
|
@ -453,8 +445,7 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
{
|
||||
Assignment{
|
||||
|
@ -484,8 +475,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPointSize_Write1_IsErased) {
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_EQ(module_str, R"(Module{
|
||||
Variable{
|
||||
Decorations{
|
||||
|
@ -541,8 +531,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPointSize_ReadReplaced) {
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_EQ(module_str, R"(Module{
|
||||
Variable{
|
||||
x_900
|
||||
|
@ -609,8 +598,7 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_EQ(module_str, R"(Module{
|
||||
Variable{
|
||||
Decorations{
|
||||
|
@ -661,8 +649,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPointSize_Loose_Write1_IsErased) {
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_EQ(module_str, R"(Module{
|
||||
Function x_500 -> __void
|
||||
()
|
||||
|
@ -706,8 +693,7 @@ TEST_F(SpvModuleScopeVarParserTest, BuiltinPointSize_Loose_ReadReplaced) {
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_EQ(module_str, R"(Module{
|
||||
Variable{
|
||||
x_900
|
||||
|
@ -743,8 +729,7 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_EQ(module_str, R"(Module{
|
||||
Function x_500 -> __void
|
||||
()
|
||||
|
@ -771,8 +756,7 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty()) << p->error();
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_EQ(module_str, R"(Module{
|
||||
Function x_500 -> __void
|
||||
()
|
||||
|
@ -876,8 +860,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarInitializers) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_1
|
||||
private
|
||||
|
@ -934,8 +917,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarNullInitializers) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_1
|
||||
private
|
||||
|
@ -984,8 +966,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarUndefInitializers) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_1
|
||||
private
|
||||
|
@ -1029,8 +1010,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1053,8 +1033,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorBoolNullInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1077,8 +1056,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorBoolUndefInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1101,8 +1079,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorUintNullInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1125,8 +1102,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorUintUndefInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1149,8 +1125,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorIntNullInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1173,8 +1148,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorIntUndefInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1197,8 +1171,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorFloatNullInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1221,8 +1194,7 @@ TEST_F(SpvModuleScopeVarParserTest, VectorFloatUndefInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1251,8 +1223,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1288,8 +1259,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixNullInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1325,8 +1295,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixUndefInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1363,8 +1332,7 @@ TEST_F(SpvModuleScopeVarParserTest, ArrayInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1387,8 +1355,7 @@ TEST_F(SpvModuleScopeVarParserTest, ArrayNullInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1411,8 +1378,7 @@ TEST_F(SpvModuleScopeVarParserTest, ArrayUndefInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1437,8 +1403,7 @@ TEST_F(SpvModuleScopeVarParserTest, StructInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1467,8 +1432,7 @@ TEST_F(SpvModuleScopeVarParserTest, StructNullInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1497,8 +1461,7 @@ TEST_F(SpvModuleScopeVarParserTest, StructUndefInitializer) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(Variable{
|
||||
x_200
|
||||
private
|
||||
|
@ -1529,8 +1492,7 @@ TEST_F(SpvModuleScopeVarParserTest, LocationDecoration_Valid) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Variable{
|
||||
Decorations{
|
||||
|
@ -1582,8 +1544,7 @@ TEST_F(SpvModuleScopeVarParserTest, DescriptorGroupDecoration_Valid) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Variable{
|
||||
Decorations{
|
||||
|
@ -1637,8 +1598,7 @@ TEST_F(SpvModuleScopeVarParserTest, BindingDecoration_Valid) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Variable{
|
||||
Decorations{
|
||||
|
@ -1692,8 +1652,7 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
S Struct{
|
||||
[[block]]
|
||||
|
@ -1724,8 +1683,7 @@ TEST_F(SpvModuleScopeVarParserTest, ColMajorDecoration_Dropped) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
S Struct{
|
||||
[[block]]
|
||||
|
@ -1754,8 +1712,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration_Dropped) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
S Struct{
|
||||
[[block]]
|
||||
|
@ -1804,8 +1761,7 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_AllMembers) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
S Struct{
|
||||
[[block]]
|
||||
|
@ -1834,8 +1790,7 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_NotAllMembers) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
S Struct{
|
||||
[[block]]
|
||||
|
@ -1867,8 +1822,7 @@ TEST_F(
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
S Struct{
|
||||
[[block]]
|
||||
|
@ -1892,8 +1846,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_DeclareConst_True) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
VariableConst{
|
||||
Decorations{
|
||||
|
@ -1918,8 +1871,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_DeclareConst_False) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
VariableConst{
|
||||
Decorations{
|
||||
|
@ -1944,8 +1896,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_DeclareConst_U32) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
VariableConst{
|
||||
Decorations{
|
||||
|
@ -1970,8 +1921,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_DeclareConst_I32) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
VariableConst{
|
||||
Decorations{
|
||||
|
@ -1996,8 +1946,7 @@ TEST_F(SpvModuleScopeVarParserTest, ScalarSpecConstant_DeclareConst_F32) {
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
VariableConst{
|
||||
Decorations{
|
||||
|
@ -2023,8 +1972,7 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||
)"));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_program(), p->get_program().to_str());
|
||||
const auto module_str = Demangler().Demangle(p->get_program());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
VariableConst{
|
||||
myconst
|
||||
|
|
|
@ -40,8 +40,7 @@ TEST_F(SpvParserTest, NamedTypes_AnonStruct) {
|
|||
%s = OpTypeStruct %uint %uint
|
||||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program(), p->get_program().to_str()),
|
||||
HasSubstr("S Struct"));
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program()), HasSubstr("S Struct"));
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, NamedTypes_NamedStruct) {
|
||||
|
@ -51,7 +50,7 @@ TEST_F(SpvParserTest, NamedTypes_NamedStruct) {
|
|||
%s = OpTypeStruct %uint %uint
|
||||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program(), p->get_program().to_str()),
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program()),
|
||||
HasSubstr("mystruct Struct"));
|
||||
}
|
||||
|
||||
|
@ -62,8 +61,7 @@ TEST_F(SpvParserTest, NamedTypes_Dup_EmitBoth) {
|
|||
%s2 = OpTypeStruct %uint %uint
|
||||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule()) << p->error();
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program(), p->get_program().to_str()),
|
||||
HasSubstr(R"(S Struct{
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program()), HasSubstr(R"(S Struct{
|
||||
StructMember{field0: __u32}
|
||||
StructMember{field1: __u32}
|
||||
}
|
||||
|
@ -84,7 +82,7 @@ TEST_F(SpvParserTest, NamedTypes_AnonRTArrayWithDecoration) {
|
|||
%arr = OpTypeRuntimeArray %uint
|
||||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program(), p->get_program().to_str()),
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program()),
|
||||
HasSubstr("RTArr -> __array__u32_stride_8\n"));
|
||||
}
|
||||
|
||||
|
@ -97,7 +95,7 @@ TEST_F(SpvParserTest, NamedTypes_AnonRTArray_Dup_EmitBoth) {
|
|||
%arr2 = OpTypeRuntimeArray %uint
|
||||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program(), p->get_program().to_str()),
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program()),
|
||||
HasSubstr("RTArr -> __array__u32_stride_8\n RTArr_1 -> "
|
||||
"__array__u32_stride_8\n"));
|
||||
}
|
||||
|
@ -110,7 +108,7 @@ TEST_F(SpvParserTest, NamedTypes_NamedRTArray) {
|
|||
%arr = OpTypeRuntimeArray %uint
|
||||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program(), p->get_program().to_str()),
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program()),
|
||||
HasSubstr("myrtarr -> __array__u32_stride_8\n"));
|
||||
}
|
||||
|
||||
|
@ -124,7 +122,7 @@ TEST_F(SpvParserTest, NamedTypes_NamedArray) {
|
|||
%arr2 = OpTypeArray %uint %uint_5
|
||||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program(), p->get_program().to_str()),
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program()),
|
||||
HasSubstr("myarr -> __array__u32_5_stride_8"));
|
||||
}
|
||||
|
||||
|
@ -138,7 +136,7 @@ TEST_F(SpvParserTest, NamedTypes_AnonArray_Dup_EmitBoth) {
|
|||
%arr2 = OpTypeArray %uint %uint_5
|
||||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program(), p->get_program().to_str()),
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_program()),
|
||||
HasSubstr("Arr -> __array__u32_5_stride_8\n Arr_1 -> "
|
||||
"__array__u32_5_stride_8"));
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ inline std::string ToString(const Program& program,
|
|||
for (const auto* stmt : stmts) {
|
||||
stmt->to_str(outs, 0);
|
||||
}
|
||||
return Demangler().Demangle(program, outs.str());
|
||||
return Demangler().Demangle(program.Symbols(), outs.str());
|
||||
}
|
||||
|
||||
} // namespace spirv
|
||||
|
|
|
@ -35,7 +35,7 @@ class TestHelperBase : public BASE, public ast::BuilderWithProgram {
|
|||
/// @param s the string to demangle
|
||||
/// @returns the demangled string
|
||||
std::string demangle(const std::string& s) {
|
||||
return demanger.Demangle(*mod, s);
|
||||
return demanger.Demangle(mod->Symbols(), s);
|
||||
}
|
||||
|
||||
/// A demangler
|
||||
|
|
Loading…
Reference in New Issue