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 <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
David Neto 2020-11-16 17:35:57 +00:00 committed by Commit Bot service account
parent df2d92d5bb
commit a0b6796687
2 changed files with 4 additions and 2 deletions

View File

@ -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;
}

View File

@ -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) {