![]() |
P4C
The P4 Compiler
|
Requires two types to be equal. More...
#include <typeConstraints.h>
Public Member Functions | |
EqualityConstraint (const IR::Type *left, const IR::Type *right, const IR::Node *origin) | |
EqualityConstraint (const IR::Type *left, const IR::Type *right, const TypeConstraint *derivedFrom) | |
BinaryConstraint * | create (const IR::Type *left, const IR::Type *right) const override |
void | dbprint (std::ostream &out) const override |
DECLARE_TYPEINFO (EqualityConstraint, BinaryConstraint) | |
bool | reportError (const TypeVariableSubstitution *subst) const override |
template<typename... Args> | |
bool | reportError (const TypeVariableSubstitution *subst, const char *format, Args &&...args) const |
![]() | |
DECLARE_TYPEINFO (BinaryConstraint, TypeConstraint) | |
![]() | |
DECLARE_TYPEINFO (TypeConstraint) | |
template<typename... Args> | |
bool | reportError (const TypeVariableSubstitution *subst, const char *format, Args &&...args) const |
void | setError (std::string_view format, std::initializer_list< const IR::Node * > nodes) |
![]() | |
void | print () const |
![]() | |
template<typename T > | |
T & | as () |
Tries to convert the class to type T. A BUG occurs if the cast fails. | |
template<typename T > | |
const T & | as () const |
Tries to convert the class to type T. A BUG occurs if the cast fails. | |
template<typename T > | |
T * | checkedTo () |
Performs a checked cast. A BUG occurs if the cast fails. | |
template<typename T > | |
const T * | checkedTo () const |
Performs a checked cast. A BUG occurs if the cast fails. | |
![]() | |
template<typename T > | |
bool | is () const noexcept |
virtual bool | isA (TypeId typeId) const noexcept=0 |
template<typename T > | |
const T * | to () const noexcept |
Same as to , but returns const pointer to T. | |
template<typename T > | |
T * | to () noexcept |
virtual TypeId | typeId () const noexcept=0 |
Additional Inherited Members | |
![]() | |
const IR::Type * | left |
const IR::Type * | right |
![]() | |
BinaryConstraint (const IR::Type *left, const IR::Type *right, const IR::Node *origin) | |
BinaryConstraint (const IR::Type *left, const IR::Type *right, const TypeConstraint *derivedFrom) | |
void | validate () const |
![]() | |
TypeConstraint (const IR::Node *origin) | |
TypeConstraint (const TypeConstraint *derivedFrom) | |
std::string | explain (size_t index, Explain *explainer) const |
std::string | localError (Explain *explainer) const |
![]() | |
virtual const void * | toImpl (TypeId typeId) const noexcept=0 |
![]() | |
const TypeConstraint * | derivedFrom = nullptr |
Constraint which produced this one. May be nullptr. | |
const IR::Node * | origin = nullptr |
Place in source code which originated the contraint. May be nullptr. | |
Requires two types to be equal.
|
inlineoverridevirtual |
Implements P4::BinaryConstraint.
|
inlineoverridevirtual |
Implements IHasDbPrint.
|
inlineoverridevirtual |
Implements P4::TypeConstraint.
|
inline |
The Constraints actually form a stack and the error message is composed in reverse order, from bottom to top. The top of the stack has no 'derivedFrom' field, and it contains the actual source position where the analysis started.