summaryrefslogtreecommitdiffstats
path: root/llvm/docs/CommandGuide
diff options
context:
space:
mode:
authorFedor Sergeev <fedor.sergeev@azul.com>2018-11-13 00:46:13 +0000
committerFedor Sergeev <fedor.sergeev@azul.com>2018-11-13 00:46:13 +0000
commit6c9e19b504f456090ff0060288e3d851ac3ad666 (patch)
treebd3d33df29b5c9802d002c9b487f0131d56dfc68 /llvm/docs/CommandGuide
parent106946329d579ec1036a511e3770a8f9f84a4a82 (diff)
downloadbcm5719-llvm-6c9e19b504f456090ff0060288e3d851ac3ad666.tar.gz
bcm5719-llvm-6c9e19b504f456090ff0060288e3d851ac3ad666.zip
[FileCheck] introduce CHECK-COUNT-<num> repetition directive
In some cases it is desirable to match the same pattern repeatedly many times. Currently the only way to do it is to copy the same check pattern as many times as needed. And that gets pretty unwieldy when its more than count is big. Introducing CHECK-COUNT-<num> directive which acts like a plain CHECK directive yet matches the same pattern exactly <num> times. Extended FileCheckType to a struct to add Count there. Changed some parsing routines to handle non-fixed length of directive (all currently existing directives were fixed-length). The code is generic enough to allow future support for COUNT in more than just PlainCheck directives. See motivating example for this feature in reviews.llvm.org/D54223. Reviewed By: chandlerc, dblaikie Differential Revision: https://reviews.llvm.org/D54336 llvm-svn: 346722
Diffstat (limited to 'llvm/docs/CommandGuide')
-rw-r--r--llvm/docs/CommandGuide/FileCheck.rst23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/docs/CommandGuide/FileCheck.rst b/llvm/docs/CommandGuide/FileCheck.rst
index 6581b33ba1c..89831cafe48 100644
--- a/llvm/docs/CommandGuide/FileCheck.rst
+++ b/llvm/docs/CommandGuide/FileCheck.rst
@@ -311,6 +311,29 @@ can be used:
; CHECK: ret i8
}
+The "CHECK-COUNT:" directive
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you need to match multiple lines with the same pattern over and over again
+you can repeat a plain ``CHECK:`` as many times as needed. If that looks too
+boring you can instead use a counted check "``CHECK-COUNT-<num>:``", where
+``<num>`` is a positive decimal number. It will match the pattern exactly
+``<num>`` times, no more and no less. If you specified a custom check prefix,
+just use "``<PREFIX>-COUNT-<num>:``" for the same effect.
+Here is a simple example:
+
+.. code-block:: llvm
+
+ Loop at depth 1
+ Loop at depth 1
+ Loop at depth 1
+ Loop at depth 1
+ Loop at depth 2
+ Loop at depth 3
+
+ ; CHECK-COUNT-6: Loop at depth {{[0-9]+}}
+ ; CHECK-NOT: Loop at depth {{[0-9]+}}
+
The "CHECK-DAG:" directive
~~~~~~~~~~~~~~~~~~~~~~~~~~
OpenPOWER on IntegriCloud