[llvm-commits] [llvm] r89626 - in /llvm/trunk: docs/CommandGuide/FileCheck.pod utils/FileCheck/FileCheck.cpp

Daniel Dunbar daniel at zuster.org
Sun Nov 22 14:07:51 PST 2009


Author: ddunbar
Date: Sun Nov 22 16:07:50 2009
New Revision: 89626

URL: http://llvm.org/viewvc/llvm-project?rev=89626&view=rev
Log:
Allow '_' in FileCheck variable names, it is nice to have at least one
separate character.
 - Chris, OK?

Modified:
    llvm/trunk/docs/CommandGuide/FileCheck.pod
    llvm/trunk/utils/FileCheck/FileCheck.cpp

Modified: llvm/trunk/docs/CommandGuide/FileCheck.pod
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/FileCheck.pod?rev=89626&r1=89625&r2=89626&view=diff

==============================================================================
--- llvm/trunk/docs/CommandGuide/FileCheck.pod (original)
+++ llvm/trunk/docs/CommandGuide/FileCheck.pod Sun Nov 22 16:07:50 2009
@@ -224,7 +224,7 @@
 the variables "REGISTER".  The second line verifies that whatever is in REGISTER
 occurs later in the file after an "andw".  FileCheck variable references are
 always contained in <tt>[[ ]]</tt> pairs, are named, and their names can be
-formed with the regex "<tt>[a-zA-Z][a-zA-Z0-9]*</tt>".  If a colon follows the
+formed with the regex "<tt>[a-zA-Z_][a-zA-Z0-9_]*</tt>".  If a colon follows the
 name, then it is a definition of the variable, if not, it is a use.
 
 FileCheck variables can be defined multiple times, and uses always get the

Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=89626&r1=89625&r2=89626&view=diff

==============================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp Sun Nov 22 16:07:50 2009
@@ -140,7 +140,7 @@
     // Named RegEx matches.  These are of two forms: [[foo:.*]] which matches .*
     // (or some other regex) and assigns it to the FileCheck variable 'foo'. The
     // second form is [[foo]] which is a reference to foo.  The variable name
-    // itself must be of the form "[a-zA-Z][0-9a-zA-Z]*", otherwise we reject
+    // itself must be of the form "[a-zA-Z_][0-9a-zA-Z_]*", otherwise we reject
     // it.  This is to catch some common errors.
     if (PatternStr.size() >= 2 &&
         PatternStr[0] == '[' && PatternStr[1] == '[') {
@@ -167,7 +167,8 @@
 
       // Verify that the name is well formed.
       for (unsigned i = 0, e = Name.size(); i != e; ++i)
-        if ((Name[i] < 'a' || Name[i] > 'z') &&
+        if (Name[i] != '_' &&
+            (Name[i] < 'a' || Name[i] > 'z') &&
             (Name[i] < 'A' || Name[i] > 'Z') &&
             (Name[i] < '0' || Name[i] > '9')) {
           SM.PrintMessage(SMLoc::getFromPointer(Name.data()+i),





More information about the llvm-commits mailing list