Provide suitable custom traits struct for function pointers.

Synopsis

Declared in <llvm/Support/PointerLikeTypeTraits.h>

template<
    int Alignment,
    typename FunctionPointerT>
struct FunctionPointerLikeTypeTraits;

Description

Function pointers can't be directly given these traits as functions can't have their alignment computed with alignof and we need different casting.

To rely on higher alignment for a specialized use, you can provide a customized form of this template explicitly with higher alignment, and potentially use alignment attributes on functions to satisfy that.

Static Member Functions

Name

Description

getAsVoidPointer

Reinterpret function pointer P as an opaque void pointer.

getFromVoidPointer

Recover a function pointer from a void pointer.

Static Data Members

Name

Description

NumLowBitsAvailable

Low bits free given the assumed function‐pointer alignment.

Derived Classes

Name

Description

PointerLikeTypeTraits<ReturnT(*)(ParamTs...)>

Provide a default specialization for function pointers that assumes 4‐byte alignment.

Created with MrDocs