summaryrefslogtreecommitdiff
path: root/utils/TableGen
diff options
context:
space:
mode:
authorSander de Smalen <sander.desmalen@arm.com>2017-11-21 12:26:06 +0000
committerSander de Smalen <sander.desmalen@arm.com>2017-11-21 12:26:06 +0000
commit4f7355afcdd91c65fb29e9d43ed57ad0f89dacc4 (patch)
treef22da2ba2d7f8f17742689a64747720d8239460d /utils/TableGen
parent4ef99ab6831ad19f6eef62ca3b35e68f6320a984 (diff)
[TableGen] AsmMatcher: Fix bug with reported diagnostic for operand.
Summary: The generated diagnostic by the AsmMatcher isn't always applicable to the AsmOperand. This is because the code will only update the diagnostic if it is more specific than the previous diagnostic. However, when having validated operands and 'moved on' to a next operand (for some instruction/alias for which all previous operands are valid), if the diagnostic is InvalidOperand, than that should be set as the diagnostic, not the more specific message about a previous operand for some other instruction/alias candidate. Reviewers: craig.topper, olista01, rengolin, stoklund Reviewed By: olista01 Subscribers: javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D40011 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318759 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r--utils/TableGen/AsmMatcherEmitter.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp
index d279e8c3ae9..4761cfc23a3 100644
--- a/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/utils/TableGen/AsmMatcherEmitter.cpp
@@ -3397,10 +3397,9 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
OS << " // target predicate, that diagnostic is preferred.\n";
OS << " if (!HadMatchOtherThanPredicate &&\n";
OS << " (it == MnemonicRange.first || ErrorInfo <= ActualIdx)) {\n";
- OS << " ErrorInfo = ActualIdx;\n";
- OS << " // InvalidOperand is the default. Prefer specificity.\n";
- OS << " if (Diag != Match_InvalidOperand)\n";
+ OS << " if (Diag != Match_InvalidOperand || ErrorInfo != ActualIdx)\n";
OS << " RetCode = Diag;\n";
+ OS << " ErrorInfo = ActualIdx;\n";
OS << " }\n";
OS << " // Otherwise, just reject this instance of the mnemonic.\n";
OS << " OperandsValid = false;\n";