20#include "ir/gen-tree-macro.h"
21#include "lib/castable.h"
22#include "lib/cstring.h"
23#include "lib/exceptions.h"
25#include "lib/source_file.h"
38template <
class,
class =
void>
51 virtual const Node *getNode()
const = 0;
52 virtual Node *getNode() = 0;
54 virtual cstring node_type_name()
const = 0;
55 virtual void validate()
const {}
59 std::enable_if_t<!has_static_type_name_v<T>,
const T *> checkedTo()
const {
66 std::enable_if_t<has_static_type_name_v<T>,
const T *> checkedTo()
const {
67 const auto *result =
to<T>();
68 BUG_CHECK(result,
"Cast failed: %1% with type %2% is not a %3%.",
this, node_type_name(),
69 T::static_type_name());
73 DECLARE_TYPEINFO_WITH_TYPEID(
INode, NodeKind::INode);
const T * checkedTo() const
Performs a checked cast. A BUG occurs if the cast fails.
Definition castable.h:54
Definition stringify.h:33
Definition json_generator.h:39
Definition json_loader.h:41
Definition source_file.h:223
Definition constantParsing.h:22
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
T * to() noexcept
Definition rtti.h:226