LLVM  16.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 (std::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 TgetPointer () const
 
TgetPointer ()
 
constexpr const Tvalue () const &
 
constexpr const TgetValue () const &
 
Tvalue () &
 
 LLVM_DEPRECATED ("Use value instead.", "value") T &getValue() &
 
constexpr operator bool () const
 
constexpr bool has_value () const
 
constexpr bool hasValue () const
 
constexpr const Toperator-> () const
 
Toperator-> ()
 
constexpr const Toperator* () const &
 
Toperator* () &
 
template<typename U >
constexpr T value_or (U &&alt) const &
 
template<typename U >
constexpr T getValueOr (U &&alt) const &
 
template<class Function >
auto transform (const Function &F) const &-> Optional< decltype(F(value()))>
 Apply a function to the value if present; otherwise return None. More...
 
template<class Function >
auto map (const Function &F) const &-> Optional< decltype(F(value()))>
 
T && value () &&
 
 LLVM_DEPRECATED ("Use value instead.", "value") T &&getValue() &&
 
T && operator* () &&
 
template<typename U >
T value_or (U &&alt) &&
 
template<typename U >
T getValueOr (U &&alt) &&
 
template<class Function >
auto transform (const Function &F) &&-> Optional< decltype(F(std::move(*this).value()))>
 Apply a function to the value if present; otherwise return None. More...
 
template<class Function >
auto map (const Function &F) &&-> Optional< decltype(F(std::move(*this).value()))>
 

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 273 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 276 of file Optional.h.

◆ Optional() [3/7]

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

Definition at line 278 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 281 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 ( std::in_place_t  ,
ArgTypes &&...  Args 
)
inlineconstexpr

Definition at line 285 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 299 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 312 of file Optional.h.

◆ getPointer() [2/2]

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

◆ getValue()

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

Definition at line 315 of file Optional.h.

Referenced by llvm::AAPotentialValues::getSingleValue().

◆ getValueOr() [1/2]

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

Definition at line 369 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 339 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

Definition at line 326 of file Optional.h.

◆ LLVM_DEPRECATED() [1/2]

template<typename T >
llvm::Optional< T >::LLVM_DEPRECATED ( "Use value instead."  ,
"value"   
) &&
inline

Definition at line 359 of file Optional.h.

◆ LLVM_DEPRECATED() [2/2]

template<typename T >
llvm::Optional< T >::LLVM_DEPRECATED ( "Use value instead."  ,
"value"   
) &
inline

Definition at line 319 of file Optional.h.

◆ 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

Definition at line 383 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

Definition at line 352 of file Optional.h.

◆ operator bool()

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

Definition at line 323 of file Optional.h.

◆ operator*() [1/3]

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

Definition at line 332 of file Optional.h.

◆ operator*() [2/3]

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

Definition at line 362 of file Optional.h.

◆ operator*() [3/3]

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

Definition at line 331 of file Optional.h.

◆ operator->() [1/2]

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

Definition at line 330 of file Optional.h.

◆ operator->() [2/2]

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

Definition at line 329 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 303 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 288 of file Optional.h.

◆ reset()

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

◆ transform() [1/2]

template<typename T >
template<class Function >
auto llvm::Optional< T >::transform ( 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 375 of file Optional.h.

◆ transform() [2/2]

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

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

Definition at line 345 of file Optional.h.

◆ value() [1/3]

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

Definition at line 318 of file Optional.h.

◆ value() [2/3]

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

Definition at line 358 of file Optional.h.

◆ value() [3/3]

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

Definition at line 313 of file Optional.h.

Referenced by alignOutputBlockWithAggFunc(), CloneLoopBlocks(), collectRegionsConstants(), llvm::DebugStr(), llvm::InstructionSelector::executeMatchTable(), llvm::LoopVectorizationPlanner::executePlan(), findExtractedInputToOverallInputMapping(), llvm::sys::Process::FindInEnvPath(), llvm::IRPosition::getAssociatedArgument(), llvm::Attributor::getAssumedSimplifiedValues(), llvm::SelectionDAG::getConstantPool(), llvm::RegsForValue::getCopyFromRegs(), getCopyToPartsVector(), llvm::RegsForValue::getCopyToRegs(), llvm::MCSymbolWasm::getExportName(), llvm::MCSymbolWasm::getGlobalType(), getGVNForPHINode(), llvm::MCSymbolWasm::getImportModule(), llvm::AMDGPULegalizerInfo::getLDSKernelId(), llvm::HexagonTTIImpl::getMemoryOpCost(), llvm::PPCTTIImpl::getMemoryOpCost(), getOrCreateCachedOptional(), llvm::VPIntrinsic::getPointerAlignment(), llvm::IRSimilarity::IRInstructionData::getPredicate(), llvm::NVPTXTargetLowering::getPrototype(), llvm::MCSchedModel::getReciprocalThroughput(), llvm::AAPotentialValues::getSingleValue(), llvm::MCSymbolWasm::getTableType(), llvm::Optional< uint64_t >::getValueOr(), 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::NVPTXTargetLowering::LowerCall(), llvm::SITargetLowering::lowerDYNAMIC_STACKALLOCImpl(), llvm::Optional< uint64_t >::map(), llvm::Optional< uint64_t >::operator*(), llvm::raw_ostream::operator<<(), llvm::yaml::ScalarTraits< MaybeAlign >::output(), llvm::ifs::overrideIFSTarget(), llvm::MachineBasicBlock::print(), llvm::LoopUnrollPass::printPipeline(), llvm::LoopVectorizePass::processLoop(), replaceCalledFunction(), llvm::object::ELFObjectFileBase::setARMSubArch(), llvm::LLVMContextImpl::setOpaquePointers(), llvm::InstCombinerImpl::SimplifyDemandedUseBits(), llvm::InstCombinerImpl::SimplifyDemandedVectorElts(), llvm::Optional< uint64_t >::transform(), tryToUnrollAndJamLoop(), tryToUnrollLoop(), llvm::Optional< uint64_t >::value_or(), and llvm::InstCombinerImpl::visitCallInst().

◆ value_or() [1/2]

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

Definition at line 364 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: