[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.
diff --git a/llvm/test/FileCheck/allow-unused-prefixes.txt b/llvm/test/FileCheck/allow-unused-prefixes.txt index c61bb41..6903b04 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 d59607a..09d82d3 100644 --- a/llvm/utils/FileCheck/FileCheck.cpp +++ b/llvm/utils/FileCheck/FileCheck.cpp
@@ -78,7 +78,7 @@ "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(