From 871d658c9ceb391df34e43d8f7af596c0b8a36df Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Wed, 28 Oct 2020 17:44:13 -0700 Subject: [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 --- llvm/utils/FileCheck/FileCheck.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/utils/FileCheck/FileCheck.cpp') 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 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 AllowUnusedPrefixes( + "allow-unused-prefixes", cl::init(true), + cl::desc("Allow prefixes to be specified but not appear in the test.")); + static cl::opt 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; -- cgit v1.1