This patch checks for valid mnemonics at the beginning of parseInstruction method...
authorVladimir Medic <Vladimir.Medic@imgtec.com>
Wed, 17 Jul 2013 15:00:42 +0000 (15:00 +0000)
committerVladimir Medic <Vladimir.Medic@imgtec.com>
Wed, 17 Jul 2013 15:00:42 +0000 (15:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186512 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/AsmParser/MipsAsmParser.cpp

index a4f3721771e02e762e68598b4451a9be0239cee3..de3c4fd7954b9ef3fc2b91b0c828e1843cf2c740 100644 (file)
@@ -1495,6 +1495,11 @@ MCSymbolRefExpr::VariantKind MipsAsmParser::getVariantKind(StringRef Symbol) {
 bool MipsAsmParser::
 ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc,
                  SmallVectorImpl<MCParsedAsmOperand*> &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));