]> granicus.if.org Git - llvm/commitdiff
Document the ability to perform multi-line pattern matching in FileCheck.
authorWolfgang Pieb <Wolfgang.Pieb@sony.com>
Mon, 27 Jun 2016 23:59:00 +0000 (23:59 +0000)
committerWolfgang Pieb <Wolfgang.Pieb@sony.com>
Mon, 27 Jun 2016 23:59:00 +0000 (23:59 +0000)
Differential review: http://reviews.llvm.org/D21522

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273962 91177308-0d34-0410-b5e6-96231b3b80d8

docs/CommandGuide/FileCheck.rst

index 3e4c29f1572aad6634091fe3ddc66ae568eedfa8..a0ca1bfe52f92d93928af8143ae1f7462234663b 100644 (file)
@@ -461,3 +461,22 @@ relative line number references, for example:
    // CHECK-NEXT: {{^     ;}}
    int a
 
+Matching Newline Characters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To match newline characters in regular expressions the character class
+``[[:space:]]`` can be used. For example, the following pattern:
+
+.. code-block:: c++
+
+   // CHECK: DW_AT_location [DW_FORM_sec_offset] ([[DLOC:0x[0-9a-f]+]]){{[[:space:]].*}}"intd"
+
+matches output of the form (from llvm-dwarfdump):
+
+.. code-block:: llvm
+
+       DW_AT_location [DW_FORM_sec_offset]   (0x00000233)
+       DW_AT_name [DW_FORM_strp]  ( .debug_str[0x000000c9] = "intd")
+
+letting us set the :program:`FileCheck` variable ``DLOC`` to the desired value 
+``0x00000233``, extracted from the line immediately preceding "``intd``".