retdec
|
A representation of a function type. More...
#include <function_type.h>
Public Types | |
using | param_iterator = Params::const_iterator |
Parameter 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... | |
Return Type | |
void | setRetType (ShPtr< Type > retType) |
Sets a new return type. More... | |
ShPtr< Type > | getRetType () const |
Returns the return type. More... | |
Parameters | |
bool | hasParams () const |
Returns true if the function has some parameters, false otherwise. More... | |
bool | hasParam (std::size_t n) const |
Returns true if there is an n-th parameter, false otherwise. More... | |
std::size_t | getNumOfParams () const |
Returns the number of parameters. More... | |
void | addParam (ShPtr< Type > paramType) |
Adds a new parameter. More... | |
ShPtr< Type > | getParam (std::size_t n) const |
Returns the n-th parameter. More... | |
param_iterator | param_begin () const |
Returns a constant iterator to the parameter. More... | |
param_iterator | param_end () const |
Returns a constant iterator past the last parameter. More... | |
Variable Number of Arguments | |
void | setVarArg (bool isVarArg=true) |
Sets the function either as taking a variable number of arguments or not. More... | |
bool | isVarArg () const |
Returns true if the function takes a variable number of arguments, false otherwise. More... | |
Visitor Interface | |
virtual void | accept (Visitor *v) override |
Visitor pattern implementation. More... | |
![]() | |
virtual | ~Type ()=default |
![]() | |
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... | |
virtual void | update (ShPtr< Value > subject, ShPtr< Value > arg=nullptr) |
Subject has changed its state. 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< FunctionType > | create (ShPtr< Type > retType=VoidType::create()) |
Creates a new function type. More... | |
Private Types | |
using | Params = std::vector< ShPtr< Type > > |
Container to store types of parameters. More... | |
Private Member Functions | |
FunctionType (ShPtr< Type > retType=VoidType::create()) | |
Constructs a new function type. More... | |
Private Attributes | |
ShPtr< Type > | retType |
Return type. More... | |
Params | params |
Parameters. More... | |
bool | varArg |
Takes the function a variable number of arguments? More... | |
Additional Inherited Members | |
![]() | |
using | ObserverContainer = std::vector< ObserverPtr > |
A container to store observers. More... | |
using | observer_iterator = typename ObserverContainer::const_iterator |
![]() | |
Type ()=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... | |
A representation of a function type.
Use create() to create instances. Instances of this class have reference object semantics. This class is not meant to be subclassed.
using retdec::llvmir2hll::FunctionType::param_iterator = Params::const_iterator |
Parameter iterator.
|
private |
Container to store types of parameters.
|
private |
Constructs a new function type.
See create() 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 |
Creates a new function type.
std::size_t retdec::llvmir2hll::FunctionType::getNumOfParams | ( | ) | const |
Returns the number of parameters.
The fact whether the function takes a variable number of arguments does not have any effect.
Returns the n-th parameter.
The parameters are numbered starting with 1
.
0 < n <= NUM_OF_PARAMS
, where NUM_OF_PARAMS
is the number of parameters that the function has bool retdec::llvmir2hll::FunctionType::hasParam | ( | std::size_t | n | ) | const |
Returns true
if there is an n-th parameter, false
otherwise.
The parameters are numbered starting with 1
.
bool retdec::llvmir2hll::FunctionType::hasParams | ( | ) | const |
Returns true
if the function has some parameters, false
otherwise.
The fact whether the function takes a variable number of arguments does not have any effect.
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::FunctionType::isVarArg | ( | ) | const |
Returns true
if the function takes a variable number of arguments, false
otherwise.
FunctionType::param_iterator retdec::llvmir2hll::FunctionType::param_begin | ( | ) | const |
Returns a constant iterator to the parameter.
FunctionType::param_iterator retdec::llvmir2hll::FunctionType::param_end | ( | ) | const |
Returns a constant iterator past the last parameter.
void retdec::llvmir2hll::FunctionType::setVarArg | ( | bool | isVarArg = true | ) |
Sets the function either as taking a variable number of arguments or not.
|
private |
Parameters.
|
private |
Takes the function a variable number of arguments?