From 29c6ce5879c0c00fca3442d5211b6e28a0b336b5 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Wed, 26 Dec 2018 22:46:18 +0000 Subject: [WebAssembly] Make assembler check for proper nesting of control flow. Summary: It does so using a simple nesting stack, and gives clear errors upon violation. This is unique to wasm, since most CPUs do not have any nested constructs. Had to add an end of file check to the general assembler for this. Note: if/else/end instructions are not currently supported in our tablegen defs, so these tests will be enabled in a follow-up. They already pass the nesting check. Reviewers: dschuff, aheejin Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D55797 llvm-svn: 350078 --- llvm/lib/MC/MCParser/AsmParser.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp') diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 545da359ea5..cf42a6f7075 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -899,6 +899,9 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { eatToEndOfStatement(); } + getTargetParser().onEndOfFile(); + printPendingErrors(); + // All errors should have been emitted. assert(!hasPendingError() && "unexpected error from parseStatement"); -- cgit v1.2.3