1#ifndef FREE_TENSOR_EXCEPT_H
2#define FREE_TENSOR_EXCEPT_H
4#include <source_location>
12 std::ostringstream os_;
20 operator std::string()
const {
return os_.str(); }
23#define FT_MSG MessageBuilder()
25class Error :
public std::runtime_error {
30 std::source_location loc = std::source_location::current())
31 :
std::runtime_error(
FT_MSG << loc.file_name() <<
":" << loc.line()
37template <
class T>
class Ref;
38typedef Ref<StmtNode>
Stmt;
43 std::source_location loc = std::source_location::current())
46 std::source_location loc = std::source_location::current());
48 const std::string &msg,
49 std::source_location loc = std::source_location::current());
55 std::source_location loc = std::source_location::current())
66 std::source_location loc = std::source_location::current())
76 std::source_location loc = std::source_location::current())
86 std::source_location loc = std::source_location::current())
93 std::source_location loc = std::source_location::current())
100 const std::string &msg,
101 std::source_location loc = std::source_location::current())
108 std::source_location loc = std::source_location::current())
115 const std::string &msg,
116 std::source_location loc = std::source_location::current())
143 throw ::freetensor::Error(msg); \
146#define WARNING(msg) \
148 reportWarning(FT_MSG << "[WARNING] " __FILE__ ":" << __LINE__ << ": " \
149 << std::string(msg)); \
152#define ASSERT(expr) \
155 ERROR("Assertion false: " #expr); \
AssertAlwaysFalse(const std::string &msg, std::source_location loc=std::source_location::current())
Definition: except.h:99
DriverError(const std::string &msg, std::source_location loc=std::source_location::current())
Definition: except.h:65
Error(const std::string &msg, std::source_location loc=std::source_location::current())
Definition: except.h:29
InterruptExcept()
Definition: except.cc:33
InvalidAutoGrad(const std::string &msg, std::source_location loc=std::source_location::current())
Definition: except.h:54
InvalidIO(const std::string &msg, std::source_location loc=std::source_location::current())
Definition: except.h:75
InvalidProgram(const std::string &msg, std::source_location loc=std::source_location::current())
Definition: except.h:85
InvalidSchedule(const std::string &msg, std::source_location loc=std::source_location::current())
Definition: except.h:42
MessageBuilder & operator<<(const T &obj)
Definition: except.h:15
ParserError(const std::string &msg, std::source_location loc=std::source_location::current())
Definition: except.h:107
SymbolNotFound(const std::string &msg, std::source_location loc=std::source_location::current())
Definition: except.h:92
UnexpectedQueryResult(const std::string &msg, std::source_location loc=std::source_location::current())
Definition: except.h:114
#define FT_MSG
Definition: except.h:23
Definition: allocator.h:9
void reportWarning(const std::string &msg)
Definition: except.cc:39
Ref< StmtNode > Stmt
Definition: ast.h:152