LLVM  15.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::Optional< T > Class Template Reference

#include "llvm/ADT/APInt.h"

Public Types

using value_type = T
 

Public Member Functions

constexpr Optional ()=default
 
constexpr Optional (NoneType)
 
constexpr Optional (const T &y)
 
constexpr Optional (const Optional &O)=default
 
constexpr Optional (T &&y)
 
constexpr Optional (Optional &&O)=default
 
template<typename... ArgTypes>
constexpr Optional (in_place_t, ArgTypes &&...Args)
 
Optionaloperator= (T &&y)
 
Optionaloperator= (Optional &&O)=default
 
template<typename... ArgTypes>
void emplace (ArgTypes &&... Args)
 Create a new object by constructing it in place with the given arguments. More...
 
Optionaloperator= (const T &y)
 
Optionaloperator= (const Optional &O)=default
 
void reset ()
 
constexpr const T * getPointer () const
 
T * getPointer ()
 
constexpr const T & value () const &
 
constexpr const T & getValue () const &
 
T & value () &
 
T & getValue () &
 
constexpr operator bool () const
 
constexpr bool has_value () const
 
constexpr bool hasValue () const
 
constexpr const T * operator-> () const
 
T * operator-> ()
 
constexpr const T & operator* () const &
 
T & operator* () &
 
template<typename U >
constexpr T value_or (U &&alt) const &
 
template<typename U >
constexpr T getValueOr (U &&alt) const &
 
template<class Function >
auto map (const Function &F) const &-> Optional< decltype(F(value()))>
 Apply a function to the value if present; otherwise return None. More...
 
T && value () &&
 
T && getValue () &&
 
T && operator* () &&
 
template<typename U >
value_or (U &&alt) &&
 
template<typename U >
getValueOr (U &&alt) &&
 
template<class Function >
auto map (const Function &F) &&-> Optional< decltype(F(std::move(*this).value()))>
 Apply a function to the value if present; otherwise return None. More...
 

Static Public Member Functions

static constexpr Optional create (const T *y)
 

Detailed Description

template<typename T>
class llvm::Optional< T >

Definition at line 33 of file APInt.h.

Member Typedef Documentation

◆ value_type

template<typename T >
using llvm::Optional< T >::value_type = T

Definition at line 265 of file Optional.h.

Constructor & Destructor Documentation

◆ Optional() [1/7]

template<typename T >
constexpr llvm::Optional< T >::Optional ( )
constexprdefault

◆ Optional() [2/7]

template<typename T >
constexpr llvm::Optional< T >::Optional ( NoneType  )
inlineconstexpr

Definition at line 268 of file Optional.h.

◆ Optional() [3/7]

template<typename T >
constexpr llvm::Optional< T >::Optional ( const T &  y)
inlineconstexpr

Definition at line 270 of file Optional.h.

◆ Optional() [4/7]

template<typename T >
constexpr llvm::Optional< T >::Optional ( const Optional< T > &  O)
constexprdefault

◆ Optional() [5/7]

template<typename T >
constexpr llvm::Optional< T >::Optional ( T &&  y)
inlineconstexpr

Definition at line 273 of file Optional.h.

◆ Optional() [6/7]

template<typename T >
constexpr llvm::Optional< T >::Optional ( Optional< T > &&  O)
constexprdefault

◆ Optional() [7/7]

template<typename T >
template<typename... ArgTypes>
constexpr llvm::Optional< T >::Optional ( in_place_t  ,
ArgTypes &&...  Args 
)
inlineconstexpr

Definition at line 277 of file Optional.h.

Member Function Documentation

◆ create()

template<typename T >
static constexpr Optional llvm::Optional< T >::create ( const T *  y)
inlinestaticconstexpr

Definition at line 291 of file Optional.h.

◆ emplace()

template<typename T >
template<typename... ArgTypes>
void llvm::Optional< T >::emplace ( ArgTypes &&...  Args)
inline

◆ getPointer() [1/2]

template<typename T >
T* llvm::Optional< T >::getPointer ( )
inline

Definition at line 304 of file Optional.h.

◆ getPointer() [2/2]

template<typename T >
constexpr const T* llvm::Optional< T >::getPointer ( ) const
inlineconstexpr

◆ getValue() [1/3]

template<typename T >
T& llvm::Optional< T >::getValue ( ) &
inline

Definition at line 308 of file Optional.h.

◆ getValue() [2/3]

template<typename T >
T&& llvm::Optional< T >::getValue ( ) &&
inline

Definition at line 334 of file Optional.h.

◆ getValue() [3/3]

template<typename T >
constexpr const T& llvm::Optional< T >::getValue ( ) const &
inlineconstexpr

Definition at line 306 of file Optional.h.

Referenced by alignOutputBlockWithAggFunc(), CloneLoopBlocks(), collectRegionsConstants(), llvm::InstructionSelector::executeMatchTable(), llvm::LoopVectorizationPlanner::executePlan(), findExtractedInputToOverallInputMapping(), llvm::sys::Process::FindInEnvPath(), genericValueTraversal(), llvm::IRPosition::getAssociatedArgument(), llvm::Attributor::getAssumedConstant(), llvm::RegsForValue::getCopyFromRegs(), getCopyToPartsVector(), llvm::RegsForValue::getCopyToRegs(), llvm::MCSymbolWasm::getExportName(), llvm::MCSymbolWasm::getGlobalType(), getGVNForPHINode(), llvm::MCSymbolWasm::getImportModule(), getOrCreateCachedOptional(), llvm::VPIntrinsic::getPointerAlignment(), llvm::IRSimilarity::IRInstructionData::getPredicate(), llvm::MCSchedModel::getReciprocalThroughput(), llvm::MCSymbolWasm::getTableType(), handleArgs(), llvm::ProfileSummaryInfo::hasHugeWorkingSetSize(), llvm::ProfileSummaryInfo::hasLargeWorkingSetSize(), llvm::hasUnrollAndJamTransformation(), llvm::hasUnrollTransformation(), IntersectSignedRange(), IntersectUnsignedRange(), llvm::ProfileSummaryInfo::isColdCount(), llvm::ConstrainedFPIntrinsic::isDefaultFPEnvironment(), llvm::ProfileSummaryInfo::isHotCount(), llvm::FileError::log(), llvm::M68kMCInstLower::Lower(), llvm::raw_ostream::operator<<(), llvm::ifs::overrideIFSTarget(), llvm::MachineBasicBlock::print(), llvm::LoopUnrollPass::printPipeline(), llvm::LoopVectorizePass::processLoop(), llvm::RegsForValue::RegsForValue(), replaceCalledFunction(), llvm::object::ELFObjectFileBase::setARMSubArch(), llvm::LLVMContextImpl::setOpaquePointers(), llvm::InstCombinerImpl::SimplifyDemandedUseBits(), llvm::InstCombinerImpl::SimplifyDemandedVectorElts(), tryToUnrollAndJamLoop(), tryToUnrollLoop(), and llvm::InstCombinerImpl::visitCallInst().

◆ getValueOr() [1/2]

template<typename T >
template<typename U >
T llvm::Optional< T >::getValueOr ( U &&  alt) &&
inline

Definition at line 340 of file Optional.h.

◆ getValueOr() [2/2]

template<typename T >
template<typename U >
constexpr T llvm::Optional< T >::getValueOr ( U &&  alt) const &
inlineconstexpr

Definition at line 321 of file Optional.h.

◆ has_value()

template<typename T >
constexpr bool llvm::Optional< T >::has_value ( ) const
inlineconstexpr

◆ hasValue()

template<typename T >
constexpr bool llvm::Optional< T >::hasValue ( ) const
inlineconstexpr

◆ map() [1/2]

template<typename T >
template<class Function >
auto llvm::Optional< T >::map ( const Function F) && -> Optional<decltype(F(std::move(*this).value()))>
inline

Apply a function to the value if present; otherwise return None.

Definition at line 346 of file Optional.h.

◆ map() [2/2]

template<typename T >
template<class Function >
auto llvm::Optional< T >::map ( const Function F) const & -> Optional<decltype(F(value()))>
inline

Apply a function to the value if present; otherwise return None.

Definition at line 327 of file Optional.h.

◆ operator bool()

template<typename T >
constexpr llvm::Optional< T >::operator bool ( ) const
inlineexplicitconstexpr

Definition at line 310 of file Optional.h.

◆ operator*() [1/3]

template<typename T >
T& llvm::Optional< T >::operator* ( ) &
inline

Definition at line 316 of file Optional.h.

◆ operator*() [2/3]

template<typename T >
T&& llvm::Optional< T >::operator* ( ) &&
inline

Definition at line 335 of file Optional.h.

◆ operator*() [3/3]

template<typename T >
constexpr const T& llvm::Optional< T >::operator* ( ) const &
inlineconstexpr

Definition at line 315 of file Optional.h.

◆ operator->() [1/2]

template<typename T >
T* llvm::Optional< T >::operator-> ( )
inline

Definition at line 314 of file Optional.h.

◆ operator->() [2/2]

template<typename T >
constexpr const T* llvm::Optional< T >::operator-> ( ) const
inlineconstexpr

Definition at line 313 of file Optional.h.

◆ operator=() [1/4]

template<typename T >
Optional& llvm::Optional< T >::operator= ( const Optional< T > &  O)
default

◆ operator=() [2/4]

template<typename T >
Optional& llvm::Optional< T >::operator= ( const T &  y)
inline

Definition at line 295 of file Optional.h.

◆ operator=() [3/4]

template<typename T >
Optional& llvm::Optional< T >::operator= ( Optional< T > &&  O)
default

◆ operator=() [4/4]

template<typename T >
Optional& llvm::Optional< T >::operator= ( T &&  y)
inline

Definition at line 280 of file Optional.h.

◆ reset()

template<typename T >
void llvm::Optional< T >::reset ( )
inline

◆ value() [1/3]

template<typename T >
T& llvm::Optional< T >::value ( ) &
inline

Definition at line 307 of file Optional.h.

◆ value() [2/3]

template<typename T >
T&& llvm::Optional< T >::value ( ) &&
inline

Definition at line 333 of file Optional.h.

◆ value() [3/3]

template<typename T >
constexpr const T& llvm::Optional< T >::value ( ) const &
inlineconstexpr

◆ value_or() [1/2]

template<typename T >
template<typename U >
T llvm::Optional< T >::value_or ( U &&  alt) &&
inline

Definition at line 337 of file Optional.h.

◆ value_or() [2/2]

template<typename T >
template<typename U >
constexpr T llvm::Optional< T >::value_or ( U &&  alt) const &
inlineconstexpr

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