[llvm] [RISCV] Report "too many operands" for surplus operands in AsmParser (PR #207142)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 10:18:26 PDT 2026
================
@@ -1705,10 +1705,25 @@ void RISCVAsmParser::FilterNearMisses(
std::multimap<unsigned, unsigned> OperandMissesSeen;
SmallSet<FeatureBitset, 4> FeatureMissesSeen;
bool ReportedTooFewOperands = false;
+ bool ReportedTooManyOperands = false;
for (NearMissInfo &I : NearMissesIn) {
switch (I.getKind()) {
case NearMissInfo::NearMissOperand: {
+ // When the matcher finds surplus operands, it records them as
+ // NearMissOperand with InvalidMatchClass. We detect this and report
+ // "too many operands" instead of "invalid operand".
+ if (I.getOperandClass() == InvalidMatchClass) {
+ if (!ReportedTooManyOperands) {
+ SMLoc OperandLoc =
----------------
topperc wrote:
Can we put this new code below the SMLoc OperandLoc on line 1727 so we don't need to do it separtely here?
https://github.com/llvm/llvm-project/pull/207142
More information about the llvm-commits
mailing list