From a0b679668701a9b47732757e5cb8b343c06cbd76 Mon Sep 17 00:00:00 2001 From: David Neto Date: Mon, 16 Nov 2020 17:35:57 +0000 Subject: [PATCH] spirv-reader: better message for unknown SPIR-V type Change-Id: I56a314d0c4eb1f1dfdb8804024a5824e5456356c Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32940 Commit-Queue: David Neto Commit-Queue: dan sinclair Auto-Submit: David Neto Reviewed-by: dan sinclair --- src/reader/spirv/parser_impl.cc | 3 ++- src/reader/spirv/parser_impl_convert_type_test.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/reader/spirv/parser_impl.cc b/src/reader/spirv/parser_impl.cc index 7cc274d485..7068857ffb 100644 --- a/src/reader/spirv/parser_impl.cc +++ b/src/reader/spirv/parser_impl.cc @@ -309,7 +309,8 @@ ast::type::Type* ParserImpl::ConvertType(uint32_t type_id) { break; } - Fail() << "unknown SPIR-V type: " << type_id; + Fail() << "unknown SPIR-V type with ID " << type_id << ": " + << def_use_mgr_->GetDef(type_id)->PrettyPrint(); return nullptr; } diff --git a/src/reader/spirv/parser_impl_convert_type_test.cc b/src/reader/spirv/parser_impl_convert_type_test.cc index 3f18da7060..567446575d 100644 --- a/src/reader/spirv/parser_impl_convert_type_test.cc +++ b/src/reader/spirv/parser_impl_convert_type_test.cc @@ -79,7 +79,8 @@ TEST_F(SpvParserTest, ConvertType_UnhandledType) { auto* type = p->ConvertType(70); EXPECT_EQ(nullptr, type); - EXPECT_THAT(p->error(), Eq("unknown SPIR-V type: 70")); + EXPECT_THAT(p->error(), + Eq("unknown SPIR-V type with ID 70: %70 = OpTypePipe WriteOnly")); } TEST_F(SpvParserTest, ConvertType_Void) {