summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-02-23 23:02:23 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-02-23 23:02:23 +0000
commit66312539071bb2df545be7fda5b56afe15c04101 (patch)
treead87c2ffffe65ced06a5fdcbaf2dd30c818d2971 /test
parente3d661f5470d9fd8aa2cc2a3a20db34a1643e402 (diff)
downloadllvm-66312539071bb2df545be7fda5b56afe15c04101.tar.gz
llvm-66312539071bb2df545be7fda5b56afe15c04101.tar.bz2
llvm-66312539071bb2df545be7fda5b56afe15c04101.tar.xz
Asm Parser: support .error directive
The .error directive is similar to .err in that it will halt assembly if it is evaluated for assembly. However, it permits a user supplied message to be rendered. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201999 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/MC/AsmParser/directive-err-diagnostics.s17
-rw-r--r--test/MC/AsmParser/directive-err.s11
2 files changed, 28 insertions, 0 deletions
diff --git a/test/MC/AsmParser/directive-err-diagnostics.s b/test/MC/AsmParser/directive-err-diagnostics.s
new file mode 100644
index 0000000000..ccc5450d93
--- /dev/null
+++ b/test/MC/AsmParser/directive-err-diagnostics.s
@@ -0,0 +1,17 @@
+// RUN: not llvm-mc -triple i386 %s 2>&1 | FileCheck %s
+
+ .error 0
+// CHECK: error: .error argument must be a string
+// CHECK: .error 0
+// CHECK: ^
+
+ .ifeqs "0", "1"
+ .ifeqs "", ""
+ .error "message"
+ .endif
+ .endif
+// CHECK-NOT: error: message
+// CHECK-NOT: error: invalid instruction mnemonic 'message'
+// CHECK-NOT: .error "message"
+// CHECK-NOT: ^
+
diff --git a/test/MC/AsmParser/directive-err.s b/test/MC/AsmParser/directive-err.s
index 59c552a4a1..63b89397f7 100644
--- a/test/MC/AsmParser/directive-err.s
+++ b/test/MC/AsmParser/directive-err.s
@@ -17,3 +17,14 @@
.endif
// CHECK-NOT: error: .err encountered
+ .error "This is my error. There are many like it, but this one is mine."
+// CHECK: error: This is my error. There are many like it, but this one is mine.
+
+ .ifc one, two
+ .error "My error is my best friend."
+ .endif
+// CHECK-NOT: error: My error is my best friend.
+
+ .error
+// CHECK: error: .error directive invoked in source file
+