Index: include/llvm/Support/FileCheck.h =================================================================== --- include/llvm/Support/FileCheck.h +++ include/llvm/Support/FileCheck.h @@ -35,6 +35,7 @@ bool AllowDeprecatedDagOverlap = false; bool Verbose = false; bool VerboseVerbose = false; + bool Warn = false; }; @@ -218,6 +219,8 @@ /// Returns false if the input fails to satisfy the checks. bool CheckInput(SourceMgr &SM, StringRef Buffer, ArrayRef CheckStrings); + + void PrintWarning(SourceMgr &SM, SMLoc Loc, const Twine &Msg); }; } // namespace llvm #endif Index: lib/Support/FileCheck.cpp =================================================================== --- lib/Support/FileCheck.cpp +++ lib/Support/FileCheck.cpp @@ -25,6 +25,13 @@ using namespace llvm; +void FileCheck::PrintWarning(SourceMgr &SM, SMLoc Loc, const Twine &Msg) { + if (!Req.Warn) + return; + + SM.PrintMessage(Loc, SourceMgr::DK_Warning, Msg); +} + /// Parses the given string into the Pattern. /// /// \p Prefix provides which prefix is being matched, \p SM provides the Index: utils/FileCheck/FileCheck.cpp =================================================================== --- utils/FileCheck/FileCheck.cpp +++ utils/FileCheck/FileCheck.cpp @@ -85,6 +85,10 @@ "vv", cl::init(false), cl::desc("Print information helpful in diagnosing internal FileCheck\n" "issues. Implies -v.\n")); + +static cl::opt Warn("warn", cl::init(false), + cl::desc("Print warning messages.\n")); + static const char * DumpInputEnv = "FILECHECK_DUMP_INPUT_ON_FAILURE"; static cl::opt DumpInputOnFailure( @@ -130,6 +134,7 @@ Req.AllowEmptyInput = AllowEmptyInput; Req.EnableVarScope = EnableVarScope; Req.AllowDeprecatedDagOverlap = AllowDeprecatedDagOverlap; + Req.Warn = Warn; Req.Verbose = Verbose; Req.VerboseVerbose = VerboseVerbose; Req.NoCanonicalizeWhiteSpace = NoCanonicalizeWhiteSpace; @@ -157,7 +162,6 @@ return 2; } - SourceMgr SM; // Read the expected strings from the check file.