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

Method create

src/ctypes/pointer_type.cpp:36–53  ·  view source on GitHub ↗

* @brief Creates pointer type. * * @param context Storage for already created functions, types. * @param pointedType Type that this pointer points to. * @param bitWidth Number of bits used by this type. * * @par Preconditions * - @a context is not null * - @a pointedType is not null * * Does not create new pointer type, if one * has already been created and stored in @c context. */

Source from the content-addressed store, hash-verified

34* has already been created and stored in @c context.
35*/
36std::shared_ptr<PointerType> PointerType::create(
37 const std::shared_ptr<Context> &context,
38 const std::shared_ptr<Type> &pointedType,
39 unsigned bitWidth)
40{
41 assert(context && "violated precondition - context cannot be null");
42 assert(pointedType && "violated precondition - pointedType cannot be null");
43
44 auto type = context->getPointerType(pointedType);
45 if (type)
46 {
47 return type;
48 }
49
50 std::shared_ptr<PointerType> newType(new PointerType(pointedType, bitWidth));
51 context->addPointerType(newType);
52 return newType;
53}
54
55/**
56* @brief Returns pointed type.

Callers

nothing calls this directly

Calls 2

getPointerTypeMethod · 0.45
addPointerTypeMethod · 0.45

Tested by

no test coverage detected