aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/FileCheck/FileCheck.cpp
diff options
context:
space:
mode:
authorMircea Trofin <mtrofin@google.com>2020-10-28 17:44:13 -0700
committerMircea Trofin <mtrofin@google.com>2020-10-30 12:39:29 -0700
commit871d658c9ceb391df34e43d8f7af596c0b8a36df (patch)
tree9a36a81b62496e154949a53dcbb9f684527e9fda /llvm/utils/FileCheck/FileCheck.cpp
parent5d9c80a6e6e0d6e0991030abb5623a2e3c9fa74b (diff)
downloadllvm-871d658c9ceb391df34e43d8f7af596c0b8a36df.zip
llvm-871d658c9ceb391df34e43d8f7af596c0b8a36df.tar.gz
llvm-871d658c9ceb391df34e43d8f7af596c0b8a36df.tar.bz2
[FileCheck] Report missing prefixes when more than one is provided.
If more than a prefix is provided - e.g. --check-prefixes=CHECK,FOO - we don't report if (say) FOO is never used. This may lead to a gap in our test coverage. This patch introduces a new option, --allow-unused-prefixes. It currently is set to true, keeping today's behavior. After we explicitly set it in tests where this behavior was actually intentional, we will switch it to false by default. Differential Revision: https://reviews.llvm.org/D90281
Diffstat (limited to 'llvm/utils/FileCheck/FileCheck.cpp')
-rw-r--r--llvm/utils/FileCheck/FileCheck.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp
index b48ae0b..1721b23 100644
--- a/llvm/utils/FileCheck/FileCheck.cpp
+++ b/llvm/utils/FileCheck/FileCheck.cpp
@@ -77,6 +77,10 @@ static cl::opt<bool> AllowEmptyInput(
cl::desc("Allow the input file to be empty. This is useful when making\n"
"checks that some error message does not occur, for example."));
+static cl::opt<bool> AllowUnusedPrefixes(
+ "allow-unused-prefixes", cl::init(true),
+ cl::desc("Allow prefixes to be specified but not appear in the test."));
+
static cl::opt<bool> MatchFullLines(
"match-full-lines", cl::init(false),
cl::desc("Require all positive matches to cover an entire input line.\n"
@@ -771,6 +775,7 @@ int main(int argc, char **argv) {
return 2;
Req.AllowEmptyInput = AllowEmptyInput;
+ Req.AllowUnusedPrefixes = AllowUnusedPrefixes;
Req.EnableVarScope = EnableVarScope;
Req.AllowDeprecatedDagOverlap = AllowDeprecatedDagOverlap;
Req.Verbose = Verbose;