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"
41template <
class,
class =
void>
54 virtual const Node *getNode()
const = 0;
55 virtual Node *getNode() = 0;
57 virtual cstring node_type_name()
const = 0;
58 virtual void validate()
const {}
62 std::enable_if_t<!has_static_type_name_v<T>,
const T *> checkedTo()
const {
69 std::enable_if_t<has_static_type_name_v<T>,
const T *> checkedTo()
const {
70 const auto *result =
to<T>();
71 BUG_CHECK(result,
"Cast failed: %1% with type %2% is not a %3%.",
this, node_type_name(),
72 T::static_type_name());
77 bool hasAnnotation(
cstring)
const;
78 const Annotation *getAnnotation(
cstring)
const;
81 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 ir/vector.h:59
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