retdec
|
A representation of a function type. More...
#include <function_type.h>
Public Types | |
enum class | VarArgness { IsVarArg , IsNotVarArg } |
using | Parameters = std::vector< std::shared_ptr< Type > > |
using | parameter_iterator = Parameters::iterator |
using | const_parameter_iterator = Parameters::const_iterator |
Public Member Functions | |
std::shared_ptr< Type > | getReturnType () const |
Returns function's return type. More... | |
virtual bool | isFunction () const override |
Function type parameters. | |
parameter_iterator | parameter_begin () |
Returns an iterator to the parameter. More... | |
const_parameter_iterator | parameter_begin () const |
Returns a constant iterator to the parameter. More... | |
parameter_iterator | parameter_end () |
Returns an iterator past the last parameter. More... | |
const_parameter_iterator | parameter_end () const |
Returns a constant iterator past the last parameter. More... | |
Parameters::size_type | getParameterCount () const |
Returns the number of parameters. More... | |
const Parameters & | getParameters () const |
Returns function type parameters. More... | |
std::shared_ptr< Type > | getParameter (Parameters::size_type n) const |
Returns the n-th parameter's type. More... | |
bool | isVarArg () const |
Returns true if function takes variable number of arguments, false otherwise. More... | |
Function type call convention. | |
void | setCallConvention (const CallConvention &callConvention) |
Sets function type's call convention. More... | |
const CallConvention & | getCallConvention () const |
Returns function type's call convention. More... | |
Visitor interface. | |
virtual void | accept (Visitor *v) override |
Visitor pattern implementation. More... | |
![]() | |
virtual | ~Type ()=default |
const std::string & | getName () const |
unsigned | getBitWidth () const |
virtual bool | isArray () const |
virtual bool | isEnum () const |
virtual bool | isFloatingPoint () const |
virtual bool | isIntegral () const |
virtual bool | isNamed () const |
virtual bool | isPointer () const |
virtual bool | isReference () const |
virtual bool | isStruct () const |
virtual bool | isTypedef () const |
virtual bool | isUnion () const |
virtual bool | isUnknown () const |
virtual bool | isVoid () const |
Static Public Member Functions | |
static std::shared_ptr< FunctionType > | create (const std::shared_ptr< Context > &context, const std::shared_ptr< Type > &returnType, const Parameters ¶meters, const CallConvention &callConvention=CallConvention(), VarArgness varArgness=VarArgness::IsNotVarArg) |
Creates function type. More... | |
Private Member Functions | |
FunctionType (const std::shared_ptr< Type > &returnType, const Parameters ¶meters, const CallConvention &callConvention, VarArgness varArgness) | |
Constructs a new function type. More... | |
Private Attributes | |
std::shared_ptr< Type > | returnType |
Parameters | parameters |
CallConvention | callConvention |
VarArgness | varArgness |
Additional Inherited Members | |
![]() | |
Type ()=default | |
Type (const std::string &name, unsigned bitWidth) | |
Constructs a new type. More... | |
![]() | |
Visitable ()=default | |
~Visitable ()=default | |
![]() | |
std::string | name |
unsigned | bitWidth |
A representation of a function type.
using retdec::ctypes::FunctionType::const_parameter_iterator = Parameters::const_iterator |
using retdec::ctypes::FunctionType::parameter_iterator = Parameters::iterator |
using retdec::ctypes::FunctionType::Parameters = std::vector<std::shared_ptr<Type> > |
|
strong |
|
private |
Constructs a new function type.
|
overridevirtual |
Visitor pattern implementation.
Subclasses should implement this method as:
where T
is the name of the subclass.
Implements retdec::ctypes::Visitable.
|
static |
Creates function type.
context | Storage for already created functions, types. |
returnType | Function type return type. |
parameters | Function type parameters types. |
callConvention | Function type call convention. |
varArgness | Info that function takes variable number of arguments or not. |
Does not create new function type, if one has already been created and stored in context
.
const CallConvention & retdec::ctypes::FunctionType::getCallConvention | ( | ) | const |
Returns function type's call convention.
std::shared_ptr< Type > retdec::ctypes::FunctionType::getParameter | ( | Parameters::size_type | n | ) | const |
Returns the n-th parameter's type.
0 < n <= ParameterCount
The parameters are numbered starting with 1
.
FunctionType::Parameters::size_type retdec::ctypes::FunctionType::getParameterCount | ( | ) | const |
Returns the number of parameters.
Does not matter if function takes variable number of parameters or not.
const FunctionType::Parameters & retdec::ctypes::FunctionType::getParameters | ( | ) | const |
Returns function type parameters.
std::shared_ptr< Type > retdec::ctypes::FunctionType::getReturnType | ( | ) | const |
Returns function's return type.
|
overridevirtual |
Returns true
when Type is function type, false
otherwise.
Reimplemented from retdec::ctypes::Type.
bool retdec::ctypes::FunctionType::isVarArg | ( | ) | const |
Returns true
if function takes variable number of arguments, false
otherwise.
FunctionType::parameter_iterator retdec::ctypes::FunctionType::parameter_begin | ( | ) |
Returns an iterator to the parameter.
FunctionType::const_parameter_iterator retdec::ctypes::FunctionType::parameter_begin | ( | ) | const |
Returns a constant iterator to the parameter.
FunctionType::parameter_iterator retdec::ctypes::FunctionType::parameter_end | ( | ) |
Returns an iterator past the last parameter.
FunctionType::const_parameter_iterator retdec::ctypes::FunctionType::parameter_end | ( | ) | const |
Returns a constant iterator past the last parameter.
void retdec::ctypes::FunctionType::setCallConvention | ( | const CallConvention & | callConvention | ) |
Sets function type's call convention.
|
private |
|
private |
|
private |
|
private |