retdec
|
A base class for all unary operators. More...
#include <unary_op_expr.h>
Public Member Functions | |
virtual ShPtr< Type > | getType () const override |
Returns the type of the expression. More... | |
virtual void | replace (ShPtr< Expression > oldExpr, ShPtr< Expression > newExpr) override |
Replaces all occurrences of oldExpr with newExpr in the current expression. More... | |
ShPtr< Expression > | getOperand () const |
Returns the operand. More... | |
void | setOperand (ShPtr< Expression > newOp) |
Sets a new operand. More... | |
Observer Interface | |
virtual void | update (ShPtr< Value > subject, ShPtr< Value > arg=nullptr) override |
Updates the operator according to the changes of subject. More... | |
![]() | |
virtual | ~Value ()=default |
virtual ShPtr< Value > | getSelf () override |
Returns a shared pointer of self. More... | |
virtual ShPtr< Value > | clone ()=0 |
Returns a clone of the value. More... | |
virtual bool | isEqualTo (ShPtr< Value > otherValue) const =0 |
Returns true if this value is equal to otherValue, false otherwise. More... | |
std::string | getTextRepr () |
Returns a textual representation of the value. More... | |
![]() | |
virtual void | accept (Visitor *v)=0 |
Visitor pattern implementation. More... | |
![]() | |
void | setMetadata (std::string data) |
Attaches new metadata. More... | |
std::string | getMetadata () const |
Returns the attached metadata. More... | |
bool | hasMetadata () const |
Are there any non-empty metadata? More... | |
![]() | |
Observer ()=default | |
Creates a new observer. More... | |
virtual | ~Observer ()=default |
Destructs the observer. More... | |
![]() | |
Subject () | |
Creates a new subject. More... | |
virtual | ~Subject ()=default |
Destructs the subject. More... | |
void | addObserver (ObserverPtr observer) |
Adds a new observer to the list of observers. More... | |
void | removeObserver (ObserverPtr observer) |
Removes the selected observer from the list of observers. More... | |
void | removeObservers () |
Removes all observers. More... | |
void | notifyObservers (ShPtr< Value > arg=nullptr) |
Notifies all observers by calling Observer::update() on them. More... | |
Protected Member Functions | |
UnaryOpExpr (ShPtr< Expression > op) | |
Constructs a unary operator. More... | |
![]() | |
Expression ()=default | |
![]() | |
Value ()=default | |
![]() | |
Visitable ()=default | |
~Visitable ()=default | |
![]() | |
Metadatable () | |
Constructs a new metadatable object. More... | |
![]() | |
observer_iterator | observer_begin () const |
Returns a constant iterator to the first observer. More... | |
observer_iterator | observer_end () const |
Returns a constant iterator past the last observer. More... | |
Protected Attributes | |
ShPtr< Expression > | op |
Operand. More... | |
Additional Inherited Members | |
![]() | |
using | ConcreteObserver = Observer< Value, Value > |
A concrete observer. More... | |
using | ObserverPtr = WkPtr< ConcreteObserver > |
A pointer to an observer. More... | |
![]() | |
static void | replaceExpression (ShPtr< Expression > oldExpr, ShPtr< Expression > newExpr) |
Replaces oldExpr with newExpr. More... | |
![]() | |
using | ObserverContainer = std::vector< ObserverPtr > |
A container to store observers. More... | |
using | observer_iterator = typename ObserverContainer::const_iterator |
A base class for all unary operators.
Instances of this class have reference object semantics.
|
explicitprotected |
Constructs a unary operator.
[in] | op | Operand. |
ShPtr< Expression > retdec::llvmir2hll::UnaryOpExpr::getOperand | ( | ) | const |
Returns the operand.
Returns the type of the expression.
If an appropriate type cannot be detected, UnknownType
is returned. This may happen, for example, when a binary operator have its operands of incompatible type.
Implements retdec::llvmir2hll::Expression.
Reimplemented in retdec::llvmir2hll::NotOpExpr.
|
overridevirtual |
Replaces all occurrences of oldExpr with newExpr in the current expression.
[in] | oldExpr | Old expression to be replaced. |
[in] | newExpr | Replacement. |
Note that if oldExpr is the current expression on which this function is called, nothing gets replaced, i.e. the replacements are done only in the members of the current expression on which this function is called.
Implements retdec::llvmir2hll::Expression.
void retdec::llvmir2hll::UnaryOpExpr::setOperand | ( | ShPtr< Expression > | newOp | ) |
Sets a new operand.
|
overridevirtual |
Updates the operator according to the changes of subject.
[in] | subject | Observable object. |
[in] | arg | Optional argument. |
Replaces subject with
This function does nothing when:
Reimplemented from retdec::llvmir2hll::Observer< Value >.
|
protected |
Operand.