[WebAssembly] Fix bug where -no-type-check failed to completely disable the typechecker

Related to <https://github.com/llvm/llvm-project/issues/55566>.
Committing directly (per LLVM's code review policy) as this is a trivial
fix.
This commit is contained in:
Alex Bradbury 2022-05-19 10:06:02 +01:00
parent 3948962b45
commit 4e8b2ac7c0
2 changed files with 15 additions and 1 deletions

View File

@ -1103,7 +1103,8 @@ public:
}
void onEndOfFunction(SMLoc ErrorLoc) {
TC.endOfFunction(ErrorLoc);
if (!SkipTypeCheck)
TC.endOfFunction(ErrorLoc);
// Reset the type checker state.
TC.Clear();

View File

@ -0,0 +1,13 @@
# RUN: llvm-mc -triple=wasm32 -no-type-check %s 2>&1
# Check no errors are produced when type checking is disabled.
correctly_typed:
.functype correctly_typed () -> (i32)
i32.const 1
end_function
incorrectly_typed:
.functype incorrectly_typed () -> (i32)
nop
end_function