[llvm] eec87db - [FileCheck] Make --allow-unused-prefixes cl::ZeroOrMore

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 15:18:07 PST 2021


Author: Fangrui Song
Date: 2021-02-02T15:18:00-08:00
New Revision: eec87db2a66dcc52ce8c89433631a6a2867fd508

URL: https://github.com/llvm/llvm-project/commit/eec87db2a66dcc52ce8c89433631a6a2867fd508
DIFF: https://github.com/llvm/llvm-project/commit/eec87db2a66dcc52ce8c89433631a6a2867fd508.diff

LOG: [FileCheck] Make --allow-unused-prefixes cl::ZeroOrMore

cl::ZeroOrMore allows the option to be specified multiple times, which makes
downstream projects possible to specify a default value in lit configuration
while some tests can override the value.

Added: 
    

Modified: 
    llvm/test/FileCheck/allow-unused-prefixes.txt
    llvm/utils/FileCheck/FileCheck.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/FileCheck/allow-unused-prefixes.txt b/llvm/test/FileCheck/allow-unused-prefixes.txt
index c61bb41e3947..6903b0452882 100644
--- a/llvm/test/FileCheck/allow-unused-prefixes.txt
+++ b/llvm/test/FileCheck/allow-unused-prefixes.txt
@@ -1,6 +1,7 @@
 ; RUN: %ProtectFileCheckOutput not FileCheck --allow-unused-prefixes=false --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt 2>&1 | FileCheck --check-prefix=MISSING-ONE %s
 ; RUN: %ProtectFileCheckOutput not FileCheck --allow-unused-prefixes=false --check-prefixes=P1,P2,P3 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt 2>&1 | FileCheck --check-prefix=MISSING-MORE %s
 ; RUN: FileCheck --allow-unused-prefixes=true  --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt 
+; RUN: FileCheck --allow-unused-prefixes=false --allow-unused-prefixes=true --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt
 
 ;; Note: the default will be changed to 'false', at which time this run line
 ;; should be changed accordingly.

diff  --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp
index d59607a2b932..09d82d3d302b 100644
--- a/llvm/utils/FileCheck/FileCheck.cpp
+++ b/llvm/utils/FileCheck/FileCheck.cpp
@@ -78,7 +78,7 @@ static cl::opt<bool> AllowEmptyInput(
              "checks that some error message does not occur, for example."));
 
 static cl::opt<bool> AllowUnusedPrefixes(
-    "allow-unused-prefixes", cl::init(true),
+    "allow-unused-prefixes", cl::init(true), cl::ZeroOrMore,
     cl::desc("Allow prefixes to be specified but not appear in the test."));
 
 static cl::opt<bool> MatchFullLines(


        


More information about the llvm-commits mailing list