retdec
|
A representation of a C function. More...
#include <function.h>
Public Types | |
using | Parameters = std::vector< Parameter > |
using | VarArgness = FunctionType::VarArgness |
using | parameter_iterator = Parameters::iterator |
using | const_parameter_iterator = Parameters::const_iterator |
Public Member Functions | |
const std::string & | getName () const |
std::shared_ptr< FunctionType > | getType () const |
Returns function's function type - return type and parameters' types. More... | |
std::shared_ptr< Type > | getReturnType () const |
Returns function's return type. More... | |
Function 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 Parameter & | getParameter (Parameters::size_type n) const |
Returns the n-th parameter. More... | |
const std::string & | getParameterName (Parameters::size_type n) const |
Returns the n-th parameter's name. More... | |
std::shared_ptr< Type > | getParameterType (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 call convention. | |
void | setCallConvention (const CallConvention &callConvention) |
Sets function's call convention. More... | |
const CallConvention & | getCallConvention () const |
Returns function's call convention. More... | |
Function declaration. | |
void | setDeclaration (const FunctionDeclaration &declaration) |
Sets function declaration. More... | |
FunctionDeclaration | getDeclaration () const |
Returns function declaration. More... | |
Function header file. | |
void | setHeaderFile (const HeaderFile &headerFile) |
Sets header file of function. More... | |
HeaderFile | getHeaderFile () const |
Returns header file of function. More... | |
Static Public Member Functions | |
static std::shared_ptr< Function > | create (const std::shared_ptr< Context > &context, const std::string &name, const std::shared_ptr< Type > &returnType, const Parameters ¶meters, const CallConvention &callConvention=CallConvention(), VarArgness varArgness=VarArgness::IsNotVarArg) |
Creates function. More... | |
Private Member Functions | |
Function (const std::string &name, const std::shared_ptr< FunctionType > &functionType, const Parameters ¶meters) | |
Constructs a new function. More... | |
Static Private Member Functions | |
static std::shared_ptr< FunctionType > | createFunctionType (const std::shared_ptr< Context > &context, const std::shared_ptr< Type > &returnType, const Parameters ¶meters, const CallConvention &callConvention, VarArgness varArgness) |
Creates function type. More... | |
Private Attributes | |
std::string | name |
std::shared_ptr< FunctionType > | functionType |
Parameters | parameters |
FunctionDeclaration | declaration |
HeaderFile | headerFile |
A representation of a C function.
using retdec::ctypes::Function::const_parameter_iterator = Parameters::const_iterator |
using retdec::ctypes::Function::parameter_iterator = Parameters::iterator |
using retdec::ctypes::Function::Parameters = std::vector<Parameter> |
|
private |
Constructs a new function.
|
static |
Creates function.
context | Storage for already created functions, types. |
name | Name of new function. |
returnType | Function return type. |
parameters | Function parameters. |
callConvention | Function call convention. |
varArgness | Info that function takes variable number of arguments or not. |
Does not create new function, if one has already been created and stored in context
.
|
staticprivate |
Creates function type.
context | Storage for already created functions, types. |
returnType | Function return type. |
parameters | Function parameters. |
callConvention | Function call convention. |
varArgness | Info that function takes variable number of arguments or not. |
const CallConvention & retdec::ctypes::Function::getCallConvention | ( | ) | const |
Returns function's call convention.
FunctionDeclaration retdec::ctypes::Function::getDeclaration | ( | ) | const |
Returns function declaration.
HeaderFile retdec::ctypes::Function::getHeaderFile | ( | ) | const |
Returns header file of function.
const std::string & retdec::ctypes::Function::getName | ( | ) | const |
const Parameter & retdec::ctypes::Function::getParameter | ( | Parameters::size_type | n | ) | const |
Returns the n-th parameter.
0 < n <= ParameterCount
The parameters are numbered starting with 1
.
Function::Parameters::size_type retdec::ctypes::Function::getParameterCount | ( | ) | const |
Returns the number of parameters.
Does not matter if function takes variable number of parameters or not.
const std::string & retdec::ctypes::Function::getParameterName | ( | Parameters::size_type | n | ) | const |
Returns the n-th parameter's name.
0 < n <= ParameterCount
The parameters are numbered starting with 1
.
std::shared_ptr< Type > retdec::ctypes::Function::getParameterType | ( | Parameters::size_type | n | ) | const |
Returns the n-th parameter's type.
0 < n <= ParameterCount
The parameters are numbered starting with 1
.
std::shared_ptr< Type > retdec::ctypes::Function::getReturnType | ( | ) | const |
Returns function's return type.
std::shared_ptr< FunctionType > retdec::ctypes::Function::getType | ( | ) | const |
Returns function's function type - return type and parameters' types.
bool retdec::ctypes::Function::isVarArg | ( | ) | const |
Returns true
if function takes variable number of arguments, false
otherwise.
Function::parameter_iterator retdec::ctypes::Function::parameter_begin | ( | ) |
Returns an iterator to the parameter.
Function::const_parameter_iterator retdec::ctypes::Function::parameter_begin | ( | ) | const |
Returns a constant iterator to the parameter.
Function::parameter_iterator retdec::ctypes::Function::parameter_end | ( | ) |
Returns an iterator past the last parameter.
Function::const_parameter_iterator retdec::ctypes::Function::parameter_end | ( | ) | const |
Returns a constant iterator past the last parameter.
void retdec::ctypes::Function::setCallConvention | ( | const CallConvention & | callConvention | ) |
Sets function's call convention.
void retdec::ctypes::Function::setDeclaration | ( | const FunctionDeclaration & | declaration | ) |
Sets function declaration.
void retdec::ctypes::Function::setHeaderFile | ( | const HeaderFile & | headerFile | ) |
Sets header file of function.
|
private |
|
private |
|
private |
|
private |
|
private |