[llvm] [FileCheck][Docs] Fix regex for FileCheck variable names (PR #97301)

Anton Lydike via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 07:28:02 PDT 2024


https://github.com/AntonLydike created https://github.com/llvm/llvm-project/pull/97301

This fixes a minor oversight in the FileCheck documentation on what is considered a valid variable name.

Global variables are prefixed with a `$`, which is explained two paragraphs below, but this was omitted in the presented regex in this paragraph.

>From f28462410d23bb57c6108933a6a1d242775e433d Mon Sep 17 00:00:00 2001
From: Anton Lydike <me at antonlydike.de>
Date: Mon, 1 Jul 2024 15:24:41 +0100
Subject: [PATCH] docs: Fix regex for FileCheck variable names

---
 llvm/docs/CommandGuide/FileCheck.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/docs/CommandGuide/FileCheck.rst b/llvm/docs/CommandGuide/FileCheck.rst
index 432dafa100bfd..af4930409da1a 100644
--- a/llvm/docs/CommandGuide/FileCheck.rst
+++ b/llvm/docs/CommandGuide/FileCheck.rst
@@ -731,7 +731,7 @@ The first check line matches a regex ``%[a-z]+`` and captures it into the
 string variable ``REGISTER``.  The second line verifies that whatever is in
 ``REGISTER`` occurs later in the file after an "``andw``". :program:`FileCheck`
 string substitution blocks are always contained in ``[[ ]]`` pairs, and string
-variable names can be formed with the regex ``[a-zA-Z_][a-zA-Z0-9_]*``.  If a
+variable names can be formed with the regex ``\$[a-zA-Z_][a-zA-Z0-9_]*``.  If a
 colon follows the name, then it is a definition of the variable; otherwise, it
 is a substitution.
 



More information about the llvm-commits mailing list