- Make BranchProbability constructor public.
[llvm/stm8.git] / utils / TableGen / Error.cpp
blob3f6cda897729bfdeaf2f4b59c5fedfda86dfccd6
1 //===- Error.cpp - tblgen error handling helper routines --------*- 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.
13 //===----------------------------------------------------------------------===//
15 #include "Error.h"
16 #include "llvm/ADT/Twine.h"
17 #include "llvm/Support/raw_ostream.h"
19 namespace llvm {
21 SourceMgr SrcMgr;
23 void PrintError(SMLoc ErrorLoc, const Twine &Msg) {
24 SrcMgr.PrintMessage(ErrorLoc, Msg, "error");
27 void PrintError(const char *Loc, const Twine &Msg) {
28 SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg, "error");
31 void PrintError(const Twine &Msg) {
32 errs() << "error:" << Msg << "\n";
35 void PrintError(const TGError &Error) {
36 PrintError(Error.getLoc(), Error.getMessage());
39 } // end namespace llvm