summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/Error.h
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2011-06-21 22:55:50 +0000
committerJim Grosbach <grosbach@apple.com>2011-06-21 22:55:50 +0000
commit797cff050437d8bd9db53bd1de1e54e168155ae3 (patch)
treeba1ec250171f2626012be8efeb34c08a1b72096b /llvm/utils/TableGen/Error.h
parentd1955e78b4d5f2d6c592d10046bf9d23f804b304 (diff)
downloadbcm5719-llvm-797cff050437d8bd9db53bd1de1e54e168155ae3.tar.gz
bcm5719-llvm-797cff050437d8bd9db53bd1de1e54e168155ae3.zip
Consolidate some TableGen diagnostic helper functions.
TableGen had diagnostic printers sprinkled about in a few places. Pull them together into a single location in Error.cpp. llvm-svn: 133568
Diffstat (limited to 'llvm/utils/TableGen/Error.h')
-rw-r--r--llvm/utils/TableGen/Error.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/Error.h b/llvm/utils/TableGen/Error.h
new file mode 100644
index 00000000000..b3a01461940
--- /dev/null
+++ b/llvm/utils/TableGen/Error.h
@@ -0,0 +1,43 @@
+//===- Error.h - tblgen error handling helper routines ----------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains error handling helper routines to pretty-print diagnostic
+// messages from tblgen.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef ERROR_H
+#define ERROR_H
+
+#include "llvm/Support/SourceMgr.h"
+
+namespace llvm {
+
+class TGError {
+ SMLoc Loc;
+ std::string Message;
+public:
+ TGError(SMLoc loc, const std::string &message) : Loc(loc), Message(message) {}
+
+ SMLoc getLoc() const { return Loc; }
+ const std::string &getMessage() const { return Message; }
+};
+
+void PrintError(SMLoc ErrorLoc, const Twine &Msg);
+void PrintError(const char *Loc, const Twine &Msg);
+void PrintError(const Twine &Msg);
+void PrintError(const TGError &Error);
+
+
+extern SourceMgr SrcMgr;
+
+
+} // end namespace "llvm"
+
+#endif
OpenPOWER on IntegriCloud