LLVM 20.0.0git
Classes | Public Member Functions | Friends | List of all members
llvm::PointerEmbeddedInt< IntT, Bits > Class Template Reference

Utility to embed an integer into a pointer-like type. More...

#include "llvm/ADT/PointerEmbeddedInt.h"

Public Member Functions

 PointerEmbeddedInt ()=default
 
 PointerEmbeddedInt (IntT I)
 
PointerEmbeddedIntoperator= (IntT I)
 
 operator IntT () const
 

Friends

struct PointerLikeTypeTraits< PointerEmbeddedInt >
 

Detailed Description

template<typename IntT, int Bits = sizeof(IntT) * CHAR_BIT>
class llvm::PointerEmbeddedInt< IntT, Bits >

Utility to embed an integer into a pointer-like type.

This is specifically intended to allow embedding integers where fewer bits are required than exist in a pointer, and the integer can participate in abstractions along side other pointer-like types. For example it can be placed into a PointerSumType or PointerUnion.

Note that much like pointers, an integer value of zero has special utility due to boolean conversions. For example, a non-null value can be tested for in the above abstractions without testing the particular active member. Also, the default constructed value zero initializes the integer.

Definition at line 33 of file PointerEmbeddedInt.h.

Constructor & Destructor Documentation

◆ PointerEmbeddedInt() [1/2]

template<typename IntT , int Bits = sizeof(IntT) * CHAR_BIT>
llvm::PointerEmbeddedInt< IntT, Bits >::PointerEmbeddedInt ( )
default

◆ PointerEmbeddedInt() [2/2]

template<typename IntT , int Bits = sizeof(IntT) * CHAR_BIT>
llvm::PointerEmbeddedInt< IntT, Bits >::PointerEmbeddedInt ( IntT  I)
inline

Definition at line 61 of file PointerEmbeddedInt.h.

References I.

Member Function Documentation

◆ operator IntT()

template<typename IntT , int Bits = sizeof(IntT) * CHAR_BIT>
llvm::PointerEmbeddedInt< IntT, Bits >::operator IntT ( ) const
inline

Definition at line 72 of file PointerEmbeddedInt.h.

◆ operator=()

template<typename IntT , int Bits = sizeof(IntT) * CHAR_BIT>
PointerEmbeddedInt & llvm::PointerEmbeddedInt< IntT, Bits >::operator= ( IntT  I)
inline

Definition at line 63 of file PointerEmbeddedInt.h.

References assert(), and I.

Friends And Related Function Documentation

◆ PointerLikeTypeTraits< PointerEmbeddedInt >

template<typename IntT , int Bits = sizeof(IntT) * CHAR_BIT>
friend struct PointerLikeTypeTraits< PointerEmbeddedInt >
friend

Definition at line 38 of file PointerEmbeddedInt.h.


The documentation for this class was generated from the following file: