retdec
|
An array constant. More...
#include <const_array.h>
Public Types | |
using | ArrayValue = std::vector< ShPtr< Expression > > |
Underlying type of the array's value. More... | |
using | init_iterator = ArrayValue::const_iterator |
Initialized array iterator. More... | |
![]() | |
using | ConcreteObserver = Observer< Value, Value > |
A concrete observer. More... | |
using | ObserverPtr = WkPtr< ConcreteObserver > |
A pointer to an observer. More... | |
Public Member Functions | |
virtual ShPtr< Value > | clone () override |
Returns a clone of the value. More... | |
virtual bool | isEqualTo (ShPtr< Value > otherValue) const override |
Returns true if this value is equal to otherValue, false otherwise. More... | |
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... | |
bool | isInitialized () const |
Returns true if the array is initialized, false otherwise. More... | |
bool | isEmpty () const |
Returns true if the array is empty, false otherwise. More... | |
ShPtr< Type > | getContainedType () const |
Returns the type of items in the array. More... | |
ArrayType::Dimensions | getDimensions () const |
Returns the dimensions of the array. More... | |
Initialized Array Accessors | |
const ArrayValue & | getInitializedValue () const |
Returns the value of an initialized array. More... | |
init_iterator | init_begin () const |
Returns an iterator to the first item of the initialized array. More... | |
init_iterator | init_end () const |
Returns an iterator past the last item of the initialized array. More... | |
Observer Interface | |
virtual void | update (ShPtr< Value > subject, ShPtr< Value > arg=nullptr) override |
Updates the array according to the changes of subject. More... | |
Visitor Interface | |
virtual void | accept (Visitor *v) override |
Visitor pattern implementation. More... | |
![]() | |
virtual | ~Value ()=default |
virtual ShPtr< Value > | getSelf () override |
Returns a shared pointer of self. More... | |
std::string | getTextRepr () |
Returns a textual representation of the value. 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... | |
Static Public Member Functions | |
static ShPtr< ConstArray > | create (ArrayValue value, ShPtr< ArrayType > type) |
Creates an array constant initialized to the given value and type. More... | |
static ShPtr< ConstArray > | createUninitialized (ShPtr< ArrayType > type) |
Creates an uninitialized array constant of the given type. More... | |
![]() | |
static void | replaceExpression (ShPtr< Expression > oldExpr, ShPtr< Expression > newExpr) |
Replaces oldExpr with newExpr. More... | |
Private Member Functions | |
ConstArray (ArrayValue value, ShPtr< ArrayType > type) | |
Constructs an array constant. More... | |
Private Attributes | |
ArrayValue | value |
Value of an initialized array. More... | |
bool | initialized |
Is the array initialized? More... | |
ShPtr< ArrayType > | type |
The type of the array. More... | |
Additional Inherited Members | |
![]() | |
using | ObserverContainer = std::vector< ObserverPtr > |
A container to store observers. More... | |
using | observer_iterator = typename ObserverContainer::const_iterator |
![]() | |
Constant ()=default | |
![]() | |
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... | |
An array constant.
Use create() or createUninitialized() to create instances. Instances of this class have reference object semantics. This class is not meant to be subclassed.
using retdec::llvmir2hll::ConstArray::ArrayValue = std::vector<ShPtr<Expression> > |
Underlying type of the array's value.
using retdec::llvmir2hll::ConstArray::init_iterator = ArrayValue::const_iterator |
Initialized array iterator.
|
private |
Constructs an array constant.
See create() or createUninitialized() for more information.
|
overridevirtual |
Visitor pattern implementation.
Subclasses should implement this method as:
where T
is the name of the subclass, and shared_from_this() and ucast<>
are from Decompiler/Support/SmartPtr.h.
Implements retdec::llvmir2hll::Visitable.
Returns a clone of the value.
A clone is (in most cases) an exact copy of the value. This member function provides the copy mechanism for reference objects.
The following parts of values are not cloned:
The following subclasses of Value are not cloned, i.e. they are returned without any copying:
Statements in compound statements (i.e. statements where isCompound()
returns true
) are cloned without their successors; therefore, e.g., just the first statement of every if's clause is cloned.
Implements retdec::llvmir2hll::Value.
|
static |
|
static |
Creates an uninitialized array constant of the given type.
[in] | type | Type of the constant. |
Returns the type of items in the array.
ArrayType::Dimensions retdec::llvmir2hll::ConstArray::getDimensions | ( | ) | const |
Returns the dimensions of the array.
const ConstArray::ArrayValue & retdec::llvmir2hll::ConstArray::getInitializedValue | ( | ) | const |
Returns the value of an initialized array.
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.
ConstArray::init_iterator retdec::llvmir2hll::ConstArray::init_begin | ( | ) | const |
Returns an iterator to the first item of the initialized array.
ConstArray::init_iterator retdec::llvmir2hll::ConstArray::init_end | ( | ) | const |
Returns an iterator past the last item of the initialized array.
bool retdec::llvmir2hll::ConstArray::isEmpty | ( | ) | const |
Returns true
if the array is empty, false
otherwise.
If the array is uninitialized, it needs to have no dimensions in order for this function to return true
.
Returns true
if this value is equal to otherValue, false
otherwise.
This member function brings the support of value object semantics into reference objects, namely equality based not only on identity.
This function doesn't consider observers, metadata, etc.
Implements retdec::llvmir2hll::Value.
bool retdec::llvmir2hll::ConstArray::isInitialized | ( | ) | const |
Returns true
if the array is initialized, false
otherwise.
|
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.
|
overridevirtual |
Updates the array according to the changes of subject.
[in] | subject | Observable object. |
[in] | arg | Optional argument. |
It replaces subject with
This function does nothing when:
Reimplemented from retdec::llvmir2hll::Observer< Value >.
|
private |
Is the array initialized?
|
private |
Value of an initialized array.