[llvm] r352309 - Revert "Detect incorrect FileCheck variable CLI definition"

Thomas Preud'homme via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 27 01:02:19 PST 2019


Author: thopre
Date: Sun Jan 27 01:02:19 2019
New Revision: 352309

URL: http://llvm.org/viewvc/llvm-project?rev=352309&view=rev
Log:
Revert "Detect incorrect FileCheck variable CLI definition"

This reverts commit r351039.

Modified:
    llvm/trunk/test/FileCheck/defines.txt
    llvm/trunk/utils/FileCheck/FileCheck.cpp

Modified: llvm/trunk/test/FileCheck/defines.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FileCheck/defines.txt?rev=352309&r1=352308&r2=352309&view=diff
==============================================================================
--- llvm/trunk/test/FileCheck/defines.txt (original)
+++ llvm/trunk/test/FileCheck/defines.txt Sun Jan 27 01:02:19 2019
@@ -3,32 +3,16 @@
 ;
 ; RUN: not FileCheck -DVALUE=10 -check-prefix NOT -input-file %s %s 2>&1 | FileCheck %s -check-prefix NOT-ERRMSG
 ; RUN: FileCheck -DVALUE=20 -check-prefix NOT -input-file %s %s
-; RUN: not FileCheck -DVALUE10 -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIEQ1
-; RUN: not FileCheck -D -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIEQ2
-; RUN: not FileCheck -D=10 -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIVAR1
-; RUN: not FileCheck -D= -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIVAR2
-; RUN: FileCheck -DVALUE= -check-prefix EMPTY -input-file %s %s 2>&1
 
 Value = 10
 ; CHECK: Value = [[VALUE]]
 ; NOT-NOT: Value = [[VALUE]]
 
-; ERRMSG: defines.txt:[[@LINE-3]]:10: error: CHECK: expected string not found in input
+; ERRMSG: defines.txt:8:10: error: CHECK: expected string not found in input
 ; ERRMSG: defines.txt:1:1: note: scanning from here
 ; ERRMSG: defines.txt:1:1: note: with variable "VALUE" equal to "20"
-; ERRMSG: defines.txt:[[@LINE-7]]:1: note: possible intended match here
+; ERRMSG: defines.txt:7:1: note: possible intended match here
 
-; NOT-ERRMSG: defines.txt:[[@LINE-7]]:12: error: {{NOT}}-NOT: excluded string found in input
-; NOT-ERRMSG: defines.txt:[[@LINE-10]]:1: note: found here
-; NOT-ERRMSG: defines.txt:[[@LINE-11]]:1: note: with variable "VALUE" equal to "10"
-
-; ERRCLIEQ1: Missing equal sign in command-line definition '-DVALUE10'
-
-; ERRCLIEQ2: FileCheck: for the -D option: requires a value!
-
-; ERRCLIVAR1: Missing pattern variable name in command-line definition '-D=10'
-
-; ERRCLIVAR2: Missing pattern variable name in command-line definition '-D='
-
-Empty value = @@
-; EMPTY: Empty value = @[[VALUE]]@
+; NOT-ERRMSG: defines.txt:9:12: error: {{NOT}}-NOT: excluded string found in input
+; NOT-ERRMSG: defines.txt:7:1: note: found here
+; NOT-ERRMSG: defines.txt:7:1: note: with variable "VALUE" equal to "10"
\ No newline at end of file

Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=352309&r1=352308&r2=352309&view=diff
==============================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp Sun Jan 27 01:02:19 2019
@@ -50,10 +50,9 @@ static cl::list<std::string> ImplicitChe
              "this pattern occur which are not matched by a positive pattern"),
     cl::value_desc("pattern"));
 
-static cl::list<std::string>
-    GlobalDefines("D", cl::AlwaysPrefix,
-                  cl::desc("Define a variable to be used in capture patterns."),
-                  cl::value_desc("VAR=VALUE"));
+static cl::list<std::string> GlobalDefines("D", cl::Prefix,
+    cl::desc("Define a variable to be used in capture patterns."),
+    cl::value_desc("VAR=VALUE"));
 
 static cl::opt<bool> AllowEmptyInput(
     "allow-empty", cl::init(false),
@@ -526,25 +525,8 @@ int main(int argc, char **argv) {
   for (auto CheckNot : ImplicitCheckNot)
     Req.ImplicitCheckNot.push_back(CheckNot);
 
-  bool GlobalDefineError = false;
-  for (auto G : GlobalDefines) {
-    size_t EqIdx = G.find('=');
-    if (EqIdx == std::string::npos) {
-      errs() << "Missing equal sign in command-line definition '-D" << G
-             << "'\n";
-      GlobalDefineError = true;
-      continue;
-    }
-    if (EqIdx == 0) {
-      errs() << "Missing pattern variable name in command-line definition '-D"
-             << G << "'\n";
-      GlobalDefineError = true;
-      continue;
-    }
+  for (auto G : GlobalDefines)
     Req.GlobalDefines.push_back(G);
-  }
-  if (GlobalDefineError)
-    return 2;
 
   Req.AllowEmptyInput = AllowEmptyInput;
   Req.EnableVarScope = EnableVarScope;




More information about the llvm-commits mailing list