From: Vladimir Medic Date: Wed, 17 Jul 2013 15:00:42 +0000 (+0000) Subject: This patch checks for valid mnemonics at the beginning of parseInstruction method... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fce9279ac0265fd5ea637dd30253bad26f4273da;p=oota-llvm.git This patch checks for valid mnemonics at the beginning of parseInstruction method, thus giving the user the right error message for non-existing instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186512 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index a4f3721771e..de3c4fd7954 100644 --- a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -1495,6 +1495,11 @@ MCSymbolRefExpr::VariantKind MipsAsmParser::getVariantKind(StringRef Symbol) { bool MipsAsmParser:: ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc, SmallVectorImpl &Operands) { + // Check if we have valid mnemonic + if (!mnemonicIsValid(Name)) { + Parser.eatToEndOfStatement(); + return Error(NameLoc, "Unknown instruction"); + } // First operand in MCInst is instruction mnemonic. Operands.push_back(MipsOperand::CreateToken(Name, NameLoc));