LLVM 20.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
25void PrintNote(const Twine &Msg);
26void PrintNote(function_ref<void(raw_ostream &OS)> PrintMsg);
27void PrintNote(ArrayRef<SMLoc> NoteLoc, const Twine &Msg);
28
29[[noreturn]] void PrintFatalNote(const Twine &Msg);
30[[noreturn]] void PrintFatalNote(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
31[[noreturn]] void PrintFatalNote(const Record *Rec, const Twine &Msg);
32[[noreturn]] void PrintFatalNote(const RecordVal *RecVal, const Twine &Msg);
33
34void PrintWarning(const Twine &Msg);
35void PrintWarning(ArrayRef<SMLoc> WarningLoc, const Twine &Msg);
36void PrintWarning(const char *Loc, const Twine &Msg);
37
38void PrintError(const Twine &Msg);
39void PrintError(function_ref<void(raw_ostream &OS)> PrintMsg);
40void PrintError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
41void PrintError(const char *Loc, const Twine &Msg);
42void PrintError(const Record *Rec, const Twine &Msg);
43void PrintError(const RecordVal *RecVal, const Twine &Msg);
44
45[[noreturn]] void PrintFatalError(const Twine &Msg);
46[[noreturn]] void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
47[[noreturn]] void PrintFatalError(const Record *Rec, const Twine &Msg);
48[[noreturn]] void PrintFatalError(const RecordVal *RecVal, const Twine &Msg);
49[[noreturn]] void PrintFatalError(function_ref<void(raw_ostream &OS)> PrintMsg);
50
51// Returns true if the assert failed.
52bool CheckAssert(SMLoc Loc, const Init *Condition, const Init *Message);
53void dumpMessage(SMLoc Loc, const Init *Message);
54
55extern SourceMgr SrcMgr;
56extern unsigned ErrorsPrinted;
57
58} // end namespace llvm
59
60#endif
raw_pwrite_stream & OS
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
unsigned ErrorsPrinted
Definition: Error.cpp:25
void PrintFatalError(const Twine &Msg)
Definition: Error.cpp:132
void PrintError(const Twine &Msg)
Definition: Error.cpp:104
bool CheckAssert(SMLoc Loc, const Init *Condition, const Init *Message)
Definition: Error.cpp:163
SourceMgr SrcMgr
Definition: Error.cpp:24
void PrintWarning(const Twine &Msg)
Definition: Error.cpp:92
void PrintNote(const Twine &Msg)
Definition: Error.cpp:52
void PrintFatalNote(const Twine &Msg)
Definition: Error.cpp:66
void dumpMessage(SMLoc Loc, const Init *Message)
Definition: Error.cpp:181