Error.h revision 97c02bf2409bccdb43c3822c438e3ff977d8514e
1//===- llvm/TableGen/Error.h - tblgen error handling helpers ----*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains error handling helper routines to pretty-print diagnostic
11// messages from tblgen.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_TABLEGEN_ERROR_H
16#define LLVM_TABLEGEN_ERROR_H
17
18#include "llvm/Support/SourceMgr.h"
19
20namespace llvm {
21
22class TGError {
23  SMLoc Loc;
24  std::string Message;
25public:
26  TGError(SMLoc loc, const std::string &message) : Loc(loc), Message(message) {}
27
28  SMLoc getLoc() const { return Loc; }
29  const std::string &getMessage() const { return Message; }
30};
31
32void PrintWarning(SMLoc WarningLoc, const Twine &Msg);
33void PrintWarning(const char *Loc, const Twine &Msg);
34void PrintWarning(const Twine &Msg);
35void PrintWarning(const TGError &Warning);
36
37void PrintError(SMLoc ErrorLoc, const Twine &Msg);
38void PrintError(const char *Loc, const Twine &Msg);
39void PrintError(const Twine &Msg);
40void PrintError(const TGError &Error);
41
42
43extern SourceMgr SrcMgr;
44
45
46} // end namespace "llvm"
47
48#endif
49