7 #ifndef RETDEC_CTYPES_CONTEXT_H
8 #define RETDEC_CTYPES_CONTEXT_H
13 #include <unordered_map>
38 void addFunction(
const std::shared_ptr<Function> &
function);
47 std::shared_ptr<FunctionType>
getFunctionType(
const std::shared_ptr<Type> &returnType,
51 void addFunctionType(
const std::shared_ptr<FunctionType> &functionType);
57 std::shared_ptr<Type>
getNamedType(
const std::string &name)
const;
63 bool hasPointerType(
const std::shared_ptr<Type> &pointedType)
const;
65 const std::shared_ptr<Type> &pointedType)
const;
66 void addPointerType(
const std::shared_ptr<PointerType> &pointerType);
73 const std::shared_ptr<Type> &referencedType)
const;
79 bool hasArrayType(
const std::shared_ptr<Type> &elementType,
81 std::shared_ptr<ArrayType>
getArrayType(
const std::shared_ptr<Type> &elementType,
83 void addArrayType(
const std::shared_ptr<ArrayType> &arrayType);
89 std::shared_ptr<Annotation>
getAnnotation(
const std::string &name)
const;
94 using Functions = std::unordered_map<std::string, std::shared_ptr<Function>>;
100 std::shared_ptr<FunctionType>
105 using NamedTypes = std::unordered_map<std::string, std::shared_ptr<Type>>;
110 std::shared_ptr<PointerType>>;
115 std::shared_ptr<ReferenceType>>;
121 std::shared_ptr<ArrayType>
126 using Annotations = std::unordered_map<std::string, std::shared_ptr<Annotation>>;
std::vector< DimensionType > Dimensions
Definition: array_type.h:27
A representation of a C call convention.
Definition: call_convention.h:19
Container for all C functions and types.
Definition: context.h:32
void addFunction(const std::shared_ptr< Function > &function)
Inserts new function to context.
Definition: context.cpp:48
void addFunctionType(const std::shared_ptr< FunctionType > &functionType)
Inserts new function type to context.
Definition: context.cpp:105
void addReferenceType(const std::shared_ptr< ReferenceType > &referenceType)
Inserts new referenceType with specific name to context.
Definition: context.cpp:232
std::shared_ptr< Annotation > getAnnotation(const std::string &name) const
Returns annotation from context.
Definition: context.cpp:301
std::unordered_map< std::shared_ptr< Type >, std::shared_ptr< ReferenceType > > ReferenceTypes
Definition: context.h:115
std::unordered_map< std::string, std::shared_ptr< Type > > NamedTypes
Definition: context.h:105
std::shared_ptr< Type > getNamedType(const std::string &name) const
Returns type with specific name from context.
Definition: context.cpp:133
void addArrayType(const std::shared_ptr< ArrayType > &arrayType)
Adds array type to context.
Definition: context.cpp:277
std::unordered_map< std::string, std::shared_ptr< Function > > Functions
Definition: context.h:94
std::shared_ptr< ReferenceType > getReferenceType(const std::shared_ptr< Type > &referencedType) const
Returns referenceType from context.
Definition: context.cpp:218
ReferenceTypes referenceTypes
Stored reference types, key is type that they reference.
Definition: context.h:117
bool hasPointerType(const std::shared_ptr< Type > &pointedType) const
Checks if context contains pointer type.
Definition: context.cpp:159
std::map< std::tuple< std::shared_ptr< Type >, FunctionType::Parameters, std::string, bool >, std::shared_ptr< FunctionType > > FunctionTypes
Definition: context.h:101
PointerTypes pointerTypes
Stored pointer types, key is type that they point to.
Definition: context.h:112
std::shared_ptr< Function > getFunctionWithName(const std::string &name) const
Returns function from context.
Definition: context.cpp:35
FunctionTypes functionTypes
Stored function types, key is return type and parameters' types.
Definition: context.h:103
std::shared_ptr< FunctionType > getFunctionType(const std::shared_ptr< Type > &returnType, const FunctionType::Parameters ¶meters, const CallConvention &callConvention, FunctionType::VarArgness varArgness) const
Returns function type from context.
Definition: context.cpp:85
std::map< std::pair< std::shared_ptr< Type >, ArrayType::Dimensions >, std::shared_ptr< ArrayType > > ArrayTypes
Definition: context.h:122
std::shared_ptr< ArrayType > getArrayType(const std::shared_ptr< Type > &elementType, const ArrayType::Dimensions &dimensions) const
Returns array type from context.
Definition: context.cpp:263
std::unordered_map< std::shared_ptr< Type >, std::shared_ptr< PointerType > > PointerTypes
Definition: context.h:110
ArrayTypes arrayTypes
Stored array types, key is element type and dimensions.
Definition: context.h:124
bool hasFunctionWithName(const std::string &name) const
Checks if context contains function.
Definition: context.cpp:25
std::shared_ptr< PointerType > getPointerType(const std::shared_ptr< Type > &pointedType) const
Returns pointerType from context.
Definition: context.cpp:174
void addAnnotation(const std::shared_ptr< Annotation > &annot)
Adds annotation to context.
Definition: context.cpp:309
void addNamedType(const std::shared_ptr< Type > &type)
Inserts new type with specific name to context.
Definition: context.cpp:144
bool hasReferenceType(const std::shared_ptr< Type > &referencedType) const
Checks if context contains reference type.
Definition: context.cpp:203
Annotations annotations
Stored annotations.
Definition: context.h:128
Functions functions
Stored functions.
Definition: context.h:96
bool hasAnnotation(const std::string &name) const
Checks if context contains annotation.
Definition: context.cpp:291
void addPointerType(const std::shared_ptr< PointerType > &pointerType)
Inserts new pointerType with specific name to context.
Definition: context.cpp:188
bool hasArrayType(const std::shared_ptr< Type > &elementType, const ArrayType::Dimensions &dimensions) const
Checks if context contains array type.
Definition: context.cpp:247
NamedTypes namedTypes
Stored types that can be identified by name.
Definition: context.h:107
bool hasNamedType(const std::string &name) const
Checks if context contains type with specific name.
Definition: context.cpp:123
bool hasFunctionType(const std::shared_ptr< Type > &returnType, const FunctionType::Parameters ¶meters, const CallConvention &callConvention, FunctionType::VarArgness varArgness) const
Checks if context contains function type.
Definition: context.cpp:63
std::unordered_map< std::string, std::shared_ptr< Annotation > > Annotations
Definition: context.h:126
VarArgness
Definition: function_type.h:33
std::vector< std::shared_ptr< Type > > Parameters
Definition: function_type.h:28
A representation of array types.
A representation of a function type.
Definition: archive_wrapper.h:19