MCPcopy Create free account
hub / github.com/avast/retdec / create

Method create

src/ctypes/function_type.cpp:44–64  ·  view source on GitHub ↗

* @brief Creates function type. * * @param context Storage for already created functions, types. * @param returnType Function type return type. * @param parameters Function type parameters types. * @param callConvention Function type call convention. * @param varArgness Info that function takes variable number of arguments or not. * * @par Preconditions * - @a context is not null * - @a returnTy

Source from the content-addressed store, hash-verified

42* has already been created and stored in @c context.
43*/
44std::shared_ptr<FunctionType> FunctionType::create(
45 const std::shared_ptr<Context> &context,
46 const std::shared_ptr<Type> &returnType,
47 const Parameters &parameters,
48 const CallConvention &callConvention,
49 VarArgness varArgness)
50{
51 assert(context && "violated precondition - context cannot be null");
52 assert(returnType && "violated precondition - returnType cannot be null");
53
54 auto type = context->getFunctionType(returnType, parameters, callConvention, varArgness);
55 if (type)
56 {
57 return type;
58 }
59
60 std::shared_ptr<FunctionType> newType(
61 new FunctionType(returnType, parameters, callConvention, varArgness));
62 context->addFunctionType(newType);
63 return newType;
64}
65
66/**
67* @brief Returns function's return type.

Callers

nothing calls this directly

Calls 2

getFunctionTypeMethod · 0.80
addFunctionTypeMethod · 0.80

Tested by

no test coverage detected