[llvm] r273962 - Document the ability to perform multi-line pattern matching in FileCheck.

Wolfgang Pieb via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 27 16:59:00 PDT 2016


Author: wolfgangp
Date: Mon Jun 27 18:59:00 2016
New Revision: 273962

URL: http://llvm.org/viewvc/llvm-project?rev=273962&view=rev
Log:
Document the ability to perform multi-line pattern matching in FileCheck.

Differential review: http://reviews.llvm.org/D21522

Modified:
    llvm/trunk/docs/CommandGuide/FileCheck.rst

Modified: llvm/trunk/docs/CommandGuide/FileCheck.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/FileCheck.rst?rev=273962&r1=273961&r2=273962&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/FileCheck.rst (original)
+++ llvm/trunk/docs/CommandGuide/FileCheck.rst Mon Jun 27 18:59:00 2016
@@ -461,3 +461,22 @@ relative line number references, for exa
    // 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``".




More information about the llvm-commits mailing list