[llvm-commits] [llvm] r155012 - in /llvm/trunk: include/llvm/TableGen/Error.h lib/TableGen/Error.cpp

Jim Grosbach grosbach at apple.com
Wed Apr 18 10:46:31 PDT 2012


Author: grosbach
Date: Wed Apr 18 12:46:31 2012
New Revision: 155012

URL: http://llvm.org/viewvc/llvm-project?rev=155012&view=rev
Log:
TableGen add warning diagnostic helper functions.

Modified:
    llvm/trunk/include/llvm/TableGen/Error.h
    llvm/trunk/lib/TableGen/Error.cpp

Modified: llvm/trunk/include/llvm/TableGen/Error.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Error.h?rev=155012&r1=155011&r2=155012&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Error.h (original)
+++ llvm/trunk/include/llvm/TableGen/Error.h Wed Apr 18 12:46:31 2012
@@ -29,6 +29,11 @@
   const std::string &getMessage() const { return Message; }
 };
 
+void PrintWarning(SMLoc WarningLoc, const Twine &Msg);
+void PrintWarning(const char *Loc, const Twine &Msg);
+void PrintWarning(const Twine &Msg);
+void PrintWarning(const TGError &Warning);
+
 void PrintError(SMLoc ErrorLoc, const Twine &Msg);
 void PrintError(const char *Loc, const Twine &Msg);
 void PrintError(const Twine &Msg);

Modified: llvm/trunk/lib/TableGen/Error.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Error.cpp?rev=155012&r1=155011&r2=155012&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Error.cpp (original)
+++ llvm/trunk/lib/TableGen/Error.cpp Wed Apr 18 12:46:31 2012
@@ -20,6 +20,22 @@
 
 SourceMgr SrcMgr;
 
+void PrintWarning(SMLoc WarningLoc, const Twine &Msg) {
+  SrcMgr.PrintMessage(WarningLoc, SourceMgr::DK_Warning, Msg);
+}
+
+void PrintWarning(const char *Loc, const Twine &Msg) {
+  SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), SourceMgr::DK_Warning, Msg);
+}
+
+void PrintWarning(const Twine &Msg) {
+  errs() << "error:" << Msg << "\n";
+}
+
+void PrintWarning(const TGError &Warning) {
+  PrintWarning(Warning.getLoc(), Warning.getMessage());
+}
+
 void PrintError(SMLoc ErrorLoc, const Twine &Msg) {
   SrcMgr.PrintMessage(ErrorLoc, SourceMgr::DK_Error, Msg);
 }





More information about the llvm-commits mailing list