summaryrefslogtreecommitdiffstats
path: root/llvm/test/FileCheck
diff options
context:
space:
mode:
authorArtem Belevich <tra@google.com>2017-03-09 17:59:04 +0000
committerArtem Belevich <tra@google.com>2017-03-09 17:59:04 +0000
commitf55e72a5a0a2473c2851c2b2c172d2ed53d15b1c (patch)
tree6f85dc5d420bcc6e186fd9ca4c583a43c081eb19 /llvm/test/FileCheck
parenta9520b94d56ba857284a3de9ba717116f884bb26 (diff)
downloadbcm5719-llvm-f55e72a5a0a2473c2851c2b2c172d2ed53d15b1c.tar.gz
bcm5719-llvm-f55e72a5a0a2473c2851c2b2c172d2ed53d15b1c.zip
[FileCheck] Added --enable-var-scope option to enable scope for regex variables.
If `--enable-var-scope` is in effect, variables with names that start with `$` are considered to be global. All other variables are local. All local variables get undefined at the beginning of each CHECK-LABEL block. Global variables are not affected by CHECK-LABEL. This makes it easier to ensure that individual tests are not affected by variables set in preceding tests. Differential Revision: https://reviews.llvm.org/D30749 llvm-svn: 297396
Diffstat (limited to 'llvm/test/FileCheck')
-rw-r--r--llvm/test/FileCheck/line-count.txt26
-rw-r--r--llvm/test/FileCheck/regex-scope.txt23
2 files changed, 36 insertions, 13 deletions
diff --git a/llvm/test/FileCheck/line-count.txt b/llvm/test/FileCheck/line-count.txt
index 6f91c2050bf..d39663e2dba 100644
--- a/llvm/test/FileCheck/line-count.txt
+++ b/llvm/test/FileCheck/line-count.txt
@@ -1,15 +1,15 @@
; RUN: FileCheck -input-file %s %s
-2
-3 aaa
-4 bbb
-5 ccc
-6 CHECK: [[@LINE-3]] {{a}}aa
-7 CHECK: [[@LINE-3]] {{b}}bb
-8 CHECK: [[@LINE-3]] {{c}}cc
-9 foobar
-10 CHECK: [[@LINE-1]] {{foo}}bar
-11
-12 arst CHECK: [[@LINE]] {{a}}rst
-13
+; RUN: not FileCheck -check-prefix BAD -input-file %s %s
+3
+4 aaa
+5 bbb
+6 ccc
+7 CHECK: [[@LINE-3]] {{a}}aa
+8 CHECK: [[@LINE-3]] {{b}}bb
+9 CHECK: [[@LINE-3]] {{c}}cc
+10 foobar
+11 CHECK: [[@LINE-1]] {{foo}}bar
+12
+13 arst CHECK: [[@LINE]] {{a}}rst
14
-
+15 BAD: [[@LINE:cant-have-regex]]
diff --git a/llvm/test/FileCheck/regex-scope.txt b/llvm/test/FileCheck/regex-scope.txt
new file mode 100644
index 00000000000..e77f3f6513a
--- /dev/null
+++ b/llvm/test/FileCheck/regex-scope.txt
@@ -0,0 +1,23 @@
+// RUN: FileCheck -check-prefix CHECK -input-file %s %s
+// RUN: FileCheck -check-prefixes CHECK,GLOBAL -input-file %s %s
+// RUN: FileCheck -check-prefixes CHECK,LOCAL -input-file %s %s
+// RUN: FileCheck -check-prefixes CHECK,GLOBAL --enable-var-scope -input-file %s %s
+// RUN: not FileCheck -check-prefixes CHECK,LOCAL --enable-var-scope -input-file %s %s
+
+local
+global
+; CHECK: [[LOCAL:loc.*]]
+; CHECK: [[$GLOBAL:glo.*]]
+
+local2
+global2
+; CHECK: [[LOCAL]]2
+; CHECK: [[$GLOBAL]]2
+
+barrier:
+; CHECK-LABEL: barrier
+
+local3
+global3
+; LOCAL: [[LOCAL]]3
+; GLOBAL: [[$GLOBAL]]3
OpenPOWER on IntegriCloud