OSDN Git Service

[MC] Defer asm errors to post-statement failure
authorNirav Dave <niravd@google.com>
Mon, 12 Sep 2016 20:03:02 +0000 (20:03 +0000)
committerNirav Dave <niravd@google.com>
Mon, 12 Sep 2016 20:03:02 +0000 (20:03 +0000)
commita50fabab60e309d8cb6aa7b90c94b0210802e5bb
treefcadbf917f9f48342187108dd4487d55a82ed7f7
parent06b5f13936674f995a7f46e03cf478f4cbb9b102
[MC] Defer asm errors to post-statement failure

Allow errors to be deferred and emitted as part of clean up to simplify
and shorten Assembly parser code. This will allow error messages to be
emitted in helper functions and be modified by the caller which has
better context.

As part of this many minor cleanups to the Parser:

* Unify parser cleanup on error
* Add Workaround for incorrect return values in ParseDirective instances
* Tighten checks on error-signifying return values for parser functions
  and fix in-tree TargetParsers to be more consistent with the changes.
* Fix AArch64 test cases checking for spurious error messages that are
  now fixed.

These changes should be backwards compatible with current Target Parsers
so long as the error status are correctly returned in appropriate
functions.

Reviewers: rnk, majnemer

Subscribers: aemerson, jyknight, llvm-commits

Differential Revision: https://reviews.llvm.org/D24047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281249 91177308-0d34-0410-b5e6-96231b3b80d8
16 files changed:
include/llvm/MC/MCParser/MCAsmLexer.h
include/llvm/MC/MCParser/MCAsmParser.h
include/llvm/Support/SMLoc.h
lib/MC/MCParser/AsmParser.cpp
lib/MC/MCParser/MCAsmLexer.cpp
lib/MC/MCParser/MCAsmParser.cpp
lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
lib/Target/ARM/AsmParser/ARMAsmParser.cpp
lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
lib/Target/Mips/AsmParser/MipsAsmParser.cpp
lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
lib/Target/X86/AsmParser/X86AsmParser.cpp
test/MC/AArch64/armv8.1a-rdma.s
test/MC/AArch64/inst-directive-diagnostic.s
test/MC/AArch64/neon-diagnostics.s