Implements reference casts by forwarding through a pointer CastInfo.

Synopsis

Declared in <llvm/Support/Casting.h>

template<
    typename To,
    typename From,
    typename ForwardTo>
struct ForwardToPointerCast;

Description

Provides a cast trait that uses a defined pointer to pointer cast as a base for reference‐to‐reference casts. Note that it does not provide castFailed and doCastIfPossible because a pointer‐to‐pointer cast would likely just return nullptr which could cause nullptr dereference. You can use it like this:

template <> struct CastInfo<foo, bar *> { ... verbose implementation... };

template <> struct CastInfo<foo, bar> : public ForwardToPointerCast<foo, bar, CastInfo<foo, bar *>> {};

Static Member Functions

Name

Description

doCast

Cast by taking the address of f and dereferencing the pointer cast.

isPossible

Return true if casting the address of f is possible.

Created with MrDocs