[PATCH] D25834: [MC] Make llvm-mc fail cleanly on invalid output asm variant.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 31 09:13:49 PDT 2016
niravd updated this revision to Diff 76422.
niravd added a comment.
Changed error message.
https://reviews.llvm.org/D25834
Files:
test/MC/AsmParser/invalid-asm-variant.s
tools/llvm-mc/llvm-mc.cpp
Index: tools/llvm-mc/llvm-mc.cpp
===================================================================
--- tools/llvm-mc/llvm-mc.cpp
+++ tools/llvm-mc/llvm-mc.cpp
@@ -563,6 +563,14 @@
IP = TheTarget->createMCInstPrinter(Triple(TripleName), OutputAsmVariant,
*MAI, *MCII, *MRI);
+ if (!IP) {
+ errs()
+ << "error: unable to create instruction printer for target triple '"
+ << TheTriple.normalize() << "' with assembly variant "
+ << OutputAsmVariant << ".\n";
+ return 1;
+ }
+
// Set the display preference for hex vs. decimal immediates.
IP->setPrintImmHex(PrintImmHex);
Index: test/MC/AsmParser/invalid-asm-variant.s
===================================================================
--- /dev/null
+++ test/MC/AsmParser/invalid-asm-variant.s
@@ -0,0 +1,3 @@
+//RUN: not llvm-mc --disassemble -triple=x86_64 --output-asm-variant=2 %s -o - 2>&1 | FileCheck %s
+
+//CHECK: error: unable to create instruction printer for target triple 'x86_64' with assembly variant 2.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25834.76422.patch
Type: text/x-patch
Size: 1071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161031/b6250d6a/attachment.bin>
More information about the llvm-commits
mailing list