MCPcopy Create free account
hub / github.com/aguinet/dragonffi / cast_impl

Method cast_impl

bindings/python/cobj.cpp:660–673  ·  view source on GitHub ↗

Cast

Source from the content-addressed store, hash-verified

658
659// Cast
660std::unique_ptr<CObj> CPointerObj::cast_impl(Type const* To) const
661{
662 CObj* Ret = nullptr;
663 if (auto const* BTy = dyn_cast<BasicType>(To)) {
664 if (BTy->getSize() == sizeof(uintptr_t)) {
665 Ret = new CBasicObj<uintptr_t>{*BTy, Data<uintptr_t>::emplace_owned(reinterpret_cast<uintptr_t>(getPtr()))};\
666 }
667 }
668 else
669 if (auto const* PTy = dyn_cast<PointerType>(To)) {
670 Ret = new CPointerObj{*PTy, Data<void*>::emplace_owned(getPtr())};
671 }
672 return std::unique_ptr<CObj>{Ret};
673}
674
675std::unique_ptr<CObj> CArrayObj::cast_impl(Type const* To) const
676{

Callers

nothing calls this directly

Calls 3

getTypeFunction · 0.70
getSizeMethod · 0.45
getAlignMethod · 0.45

Tested by

no test coverage detected