blob: f63b50ad786c21f6bb50b6d010db67535ad42f31 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- llvm/TableGen/Error.h - tblgen error handling helpers ----*- C++ -*-===//
2//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01006//
7//===----------------------------------------------------------------------===//
8//
9// This file contains error handling helper routines to pretty-print diagnostic
10// messages from tblgen.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TABLEGEN_ERROR_H
15#define LLVM_TABLEGEN_ERROR_H
16
17#include "llvm/Support/SourceMgr.h"
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020018#include "llvm/TableGen/Record.h"
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010019
20namespace llvm {
21
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020022void PrintNote(const Twine &Msg);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010023void PrintNote(ArrayRef<SMLoc> NoteLoc, const Twine &Msg);
24
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020025LLVM_ATTRIBUTE_NORETURN void PrintFatalNote(const Twine &Msg);
26LLVM_ATTRIBUTE_NORETURN void PrintFatalNote(ArrayRef<SMLoc> ErrorLoc,
27 const Twine &Msg);
28LLVM_ATTRIBUTE_NORETURN void PrintFatalNote(const Record *Rec,
29 const Twine &Msg);
30LLVM_ATTRIBUTE_NORETURN void PrintFatalNote(const RecordVal *RecVal,
31 const Twine &Msg);
32
33void PrintWarning(const Twine &Msg);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010034void PrintWarning(ArrayRef<SMLoc> WarningLoc, const Twine &Msg);
35void PrintWarning(const char *Loc, const Twine &Msg);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010036
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020037void PrintError(const Twine &Msg);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010038void PrintError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
39void PrintError(const char *Loc, const Twine &Msg);
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020040void PrintError(const Record *Rec, const Twine &Msg);
41void PrintError(const RecordVal *RecVal, const Twine &Msg);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010042
43LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const Twine &Msg);
44LLVM_ATTRIBUTE_NORETURN void PrintFatalError(ArrayRef<SMLoc> ErrorLoc,
45 const Twine &Msg);
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020046LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const Record *Rec,
47 const Twine &Msg);
48LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const RecordVal *RecVal,
49 const Twine &Msg);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010050
51extern SourceMgr SrcMgr;
52extern unsigned ErrorsPrinted;
53
54} // end namespace "llvm"
55
56#endif