[PATCH] D54769: [FileCheck] New option -warn

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 21 08:47:38 PST 2018


SjoerdMeijer updated this revision to Diff 174937.
SjoerdMeijer added a comment.

> This is small enough that I'd prefer to see it incorporated into the patch with the "real" warning, rather than have this temporary placeholder diagnostic.

Okidoki, thanks. I've removed the test and placeholder warning. Will leave this diff as it is now, and return to https://reviews.llvm.org/D53710 and make that dependent on this change (I could also abandon this change, but keeping it for now won't hurt).


https://reviews.llvm.org/D54769

Files:
  include/llvm/Support/FileCheck.h
  lib/Support/FileCheck.cpp
  utils/FileCheck/FileCheck.cpp


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<bool> Warn("warn", cl::init(false),
+                          cl::desc("Print warning messages.\n"));
+
 static const char * DumpInputEnv = "FILECHECK_DUMP_INPUT_ON_FAILURE";
 
 static cl::opt<bool> 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.
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: 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<FileCheckString> CheckStrings);
+
+  void PrintWarning(SourceMgr &SM, SMLoc Loc, const Twine &Msg);
 };
 } // namespace llvm
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54769.174937.patch
Type: text/x-patch
Size: 2129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181121/9e5feb40/attachment.bin>


More information about the llvm-commits mailing list