From a28343a33ed28b4d5c83c37e350aceaf09b5246f Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 5 Dec 2019 13:09:21 -0600 Subject: Add string parameter to WASM_UNREACHABLE (#2499) This works more like llvm's unreachable handler in that is preserves information even in release builds. --- src/wasm/wasm-validator.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/wasm/wasm-validator.cpp') diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index d3f03b76c..75121d4f4 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -1183,7 +1183,7 @@ void FunctionValidator::validateMemBytes(uint8_t bytes, case anyref: // anyref cannot be stored in memory case exnref: // exnref cannot be stored in memory case none: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("unexpected type"); case unreachable: break; } @@ -1387,7 +1387,7 @@ void FunctionValidator::visitBinary(Binary* curr) { break; } case InvalidBinary: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invliad binary op"); } shouldBeTrue(Features::get(curr->op) <= getModule()->features, curr, @@ -1601,7 +1601,7 @@ void FunctionValidator::visitUnary(Unary* curr) { shouldBeEqual(curr->value->type, v128, curr, "expected v128 operand"); break; case InvalidUnary: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid unary op"); } shouldBeTrue(Features::get(curr->op) <= getModule()->features, curr, @@ -1866,7 +1866,7 @@ void FunctionValidator::validateAlignment( case anyref: // anyref cannot be stored in memory case exnref: // exnref cannot be stored in memory case none: - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid type"); } } @@ -1995,7 +1995,7 @@ static void validateExports(Module& module, ValidationInfo& info) { name, "module event exports must be found"); } else { - WASM_UNREACHABLE(); + WASM_UNREACHABLE("invalid ExternalKind"); } Name exportName = exp->name; info.shouldBeFalse(exportNames.count(exportName) > 0, -- cgit v1.2.3