LLVM 23.0.0git
Error.h
Go to the documentation of this file.
1//===- llvm/TableGen/Error.h - tblgen error handling helpers ----*- C++ -*-===//
2//
3// 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
6//
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
19
20namespace llvm {
21class Record;
22class RecordVal;
23class Init;
24
25LLVM_ABI void PrintNote(const Twine &Msg);
26LLVM_ABI void PrintNote(function_ref<void(raw_ostream &OS)> PrintMsg);
27LLVM_ABI void PrintNote(ArrayRef<SMLoc> NoteLoc, const Twine &Msg);
28
29[[noreturn]] LLVM_ABI void PrintFatalNote(const Twine &Msg);
30[[noreturn]] LLVM_ABI void PrintFatalNote(ArrayRef<SMLoc> ErrorLoc,
31 const Twine &Msg);
32[[noreturn]] LLVM_ABI void PrintFatalNote(const Record *Rec, const Twine &Msg);
33[[noreturn]] LLVM_ABI void PrintFatalNote(const RecordVal *RecVal,
34 const Twine &Msg);
35
36LLVM_ABI void PrintWarning(const Twine &Msg);
37LLVM_ABI void PrintWarning(ArrayRef<SMLoc> WarningLoc, const Twine &Msg);
38LLVM_ABI void PrintWarning(const char *Loc, const Twine &Msg);
39
40LLVM_ABI void PrintError(const Twine &Msg);
41LLVM_ABI void PrintError(function_ref<void(raw_ostream &OS)> PrintMsg);
42LLVM_ABI void PrintError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
43LLVM_ABI void PrintError(const char *Loc, const Twine &Msg);
44LLVM_ABI void PrintError(const Record *Rec, const Twine &Msg);
45LLVM_ABI void PrintError(const RecordVal *RecVal, const Twine &Msg);
46
47[[noreturn]] LLVM_ABI void PrintFatalError(const Twine &Msg);
48[[noreturn]] LLVM_ABI void PrintFatalError(ArrayRef<SMLoc> ErrorLoc,
49 const Twine &Msg);
50[[noreturn]] LLVM_ABI void PrintFatalError(const Record *Rec, const Twine &Msg);
51[[noreturn]] LLVM_ABI void PrintFatalError(const RecordVal *RecVal,
52 const Twine &Msg);
53[[noreturn]] LLVM_ABI void
54PrintFatalError(function_ref<void(raw_ostream &OS)> PrintMsg);
55
56// Returns true if the assert failed.
57LLVM_ABI bool CheckAssert(SMLoc Loc, const Init *Condition,
58 const Init *Message);
59LLVM_ABI void dumpMessage(SMLoc Loc, const Init *Message);
60
62extern LLVM_ABI unsigned ErrorsPrinted;
63
64} // end namespace llvm
65
66#endif
#define LLVM_ABI
Definition Compiler.h:213
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
This class represents a field in a record, including its name, type, value, and source location.
Definition Record.h:1544
Represents a location in source code.
Definition SMLoc.h:22
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Definition SourceMgr.h:37
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI unsigned ErrorsPrinted
Definition Error.cpp:25
LLVM_ABI void PrintFatalError(const Twine &Msg)
Definition Error.cpp:132
LLVM_ABI void PrintError(const Twine &Msg)
Definition Error.cpp:104
LLVM_ABI bool CheckAssert(SMLoc Loc, const Init *Condition, const Init *Message)
Definition Error.cpp:163
LLVM_ABI SourceMgr SrcMgr
Definition Error.cpp:24
LLVM_ABI void PrintWarning(const Twine &Msg)
Definition Error.cpp:90
LLVM_ABI void PrintNote(const Twine &Msg)
Definition Error.cpp:52
LLVM_ABI void PrintFatalNote(const Twine &Msg)
Definition Error.cpp:64
LLVM_ABI void dumpMessage(SMLoc Loc, const Init *Message)
Definition Error.cpp:181