[LLVMdev] [PATCH] fix corruption in X86AsmParser

Maarten Lankhorst maarten.lankhorst at canonical.com
Wed Aug 14 08:28:34 PDT 2013


This fixes the failing x86_errors.s test.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>
---
diff -ru test/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm-toolchain-3.3-3.3/lib/Target/X86/AsmParser/X86AsmParser.cpp
--- test/lib/Target/X86/AsmParser/X86AsmParser.cpp	2013-05-05 02:40:33.000000000 +0200
+++ llvm-toolchain-3.3-3.3/lib/Target/X86/AsmParser/X86AsmParser.cpp	2013-08-14 16:26:44.721547396 +0200
@@ -2382,8 +2382,10 @@
     if (!WasOriginallyInvalidOperand) {
       ArrayRef<SMRange> Ranges = MatchingInlineAsm ? EmptyRanges :
         Op->getLocRange();
-      return Error(IDLoc, "invalid instruction mnemonic '" + Base + "'",
-                   Ranges, MatchingInlineAsm);
+      SmallString<126> Msg;
+      raw_svector_ostream OS(Msg);
+      OS << "invalid instruction mnemonic '" << Base << "'";
+      return Error(IDLoc, OS.str(), Ranges, MatchingInlineAsm);
     }
 
     // Recover location info for the operand if we know which was the problem.




More information about the llvm-dev mailing list