[llvm] r186512 - This patch checks for valid mnemonics at the	beginning of parseInstruction method,	thus giving the user the right error message for non-existing	instructions.
    Vladimir Medic 
    Vladimir.Medic at imgtec.com
       
    Wed Jul 17 08:00:42 PDT 2013
    
    
  
Author: vmedic
Date: Wed Jul 17 10:00:42 2013
New Revision: 186512
URL: http://llvm.org/viewvc/llvm-project?rev=186512&view=rev
Log:
This patch checks for valid mnemonics at the beginning of parseInstruction method, thus giving the user the right error message for non-existing instructions.
Modified:
    llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=186512&r1=186511&r2=186512&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Wed Jul 17 10:00:42 2013
@@ -1495,6 +1495,11 @@ MCSymbolRefExpr::VariantKind MipsAsmPars
 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));
 
    
    
More information about the llvm-commits
mailing list