LLVM  14.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 ()
 
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 & getValue () const LLVM_LVALUE_FUNCTION
 
T & getValue () LLVM_LVALUE_FUNCTION
 
constexpr operator bool () const
 
constexpr bool hasValue () const
 
constexpr const T * operator-> () const
 
T * operator-> ()
 
constexpr const T & operator* () const LLVM_LVALUE_FUNCTION
 
T & operator* () LLVM_LVALUE_FUNCTION
 
template<typename U >
constexpr T getValueOr (U &&value) const LLVM_LVALUE_FUNCTION
 
template<class Function >
auto map (const Function &F) const LLVM_LVALUE_FUNCTION -> Optional< decltype(F(getValue()))>
 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 242 of file Optional.h.

Constructor & Destructor Documentation

◆ Optional() [1/7]

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

Definition at line 244 of file Optional.h.

Referenced by llvm::Optional< uint64_t >::create().

◆ Optional() [2/7]

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

Definition at line 245 of file Optional.h.

◆ Optional() [3/7]

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

Definition at line 247 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 250 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 254 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 268 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 281 of file Optional.h.

◆ getPointer() [2/2]

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

◆ getValue() [1/2]

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

Definition at line 282 of file Optional.h.

Referenced by alignOutputBlockWithAggFunc(), allocateRVVReg(), assignSections(), llvm::VPlanSlp::buildGraph(), CloneLoopBlocks(), collectRegionsConstants(), llvm::InnerLoopVectorizer::completeLoopSkeleton(), dumpAttribute(), llvm::PPCELFStreamer::emitInstruction(), llvm::InstructionSelector::executeMatchTable(), findCostForOutputBlocks(), findExtractedInputToOverallInputMapping(), llvm::sys::Process::FindInEnvPath(), llvm::IRSimilarity::IRSimilarityIdentifier::findSimilarity(), llvm::SelectionDAG::FoldConstantArithmetic(), genericValueTraversal(), AAHeapToStackFunction::getAPInt(), llvm::IRPosition::getAssociatedArgument(), llvm::Attributor::getAssumedConstant(), llvm::ProfileSummaryInfo::getColdCountThreshold(), getCopyFromPartsVector(), llvm::RegsForValue::getCopyFromRegs(), getCopyToPartsVector(), llvm::RegsForValue::getCopyToRegs(), GetDeoptBundleOperands(), llvm::MCSymbolWasm::getExportName(), llvm::MCSymbolWasm::getGlobalType(), llvm::ProfileSummaryInfo::getHotCountThreshold(), llvm::MCSymbolWasm::getImportModule(), getISDForVPIntrinsic(), llvm::SystemZTargetLowering::getNumRegisters(), llvm::ProfileSummaryInfo::getOrCompColdCountThreshold(), llvm::ProfileSummaryInfo::getOrCompHotCountThreshold(), getOrCreateCachedOptional(), llvm::VPIntrinsic::getPointerAlignment(), llvm::IRSimilarity::IRInstructionData::getPredicate(), llvm::MCSchedModel::getReciprocalThroughput(), AAHeapToStackFunction::getSize(), llvm::MCSymbolWasm::getTableType(), llvm::Optional< uint64_t >::getValueOr(), 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::VETargetLowering::lowerToVVP(), AAReturnedValuesImpl::manifest(), AAHeapToStackFunction::manifest(), llvm::Optional< uint64_t >::map(), llvm::detail::ValueIsMatcher< InnerMatcher >::Impl< T >::MatchAndExplain(), llvm::Optional< uint64_t >::operator*(), llvm::operator*(), llvm::operator/(), llvm::raw_ostream::operator<<(), llvm::ifs::overrideIFSTarget(), llvm::MachineBasicBlock::print(), llvm::LoopUnrollPass::printPipeline(), llvm::LoopVectorizePass::processLoop(), llvm::RegsForValue::RegsForValue(), llvm::slpvectorizer::BoUpSLP::VLOperands::reorder(), replaceCalledFunction(), llvm::object::ELFObjectFileBase::setARMSubArch(), llvm::InstCombinerImpl::SimplifyDemandedUseBits(), llvm::InstCombinerImpl::SimplifyDemandedVectorElts(), tryToUnrollAndJamLoop(), tryToUnrollLoop(), AAReturnedValuesImpl::updateImpl(), AAUndefinedBehaviorImpl::updateImpl(), AAValueSimplifyArgument::updateImpl(), llvm::ifs::validateIFSTarget(), llvm::InstCombinerImpl::visitCallInst(), and llvm::wouldInstructionBeTriviallyDead().

◆ getValue() [2/2]

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

Definition at line 285 of file Optional.h.

◆ getValueOr()

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

◆ hasValue()

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

Definition at line 288 of file Optional.h.

Referenced by alignOutputBlockWithAggFunc(), allocateRVVReg(), llvm::DIExpression::appendToStack(), llvm::CombinerHelper::applyCombineConstantFoldFpUnary(), assignSections(), llvm::codeview::ContinuationRecordBuilder::begin(), CloneLoopBlocks(), collectRegionsConstants(), AAPrivatizablePtrImpl::combineTypes(), llvm::pdb::PDBFileBuilder::commit(), llvm::InnerLoopVectorizer::completeLoopSkeleton(), llvm::BaseIndexOffset::computeAliasing(), computeKnownBitsFromShiftOperator(), llvm::PPCELFStreamer::emitInstruction(), llvm::MCObjectStreamer::emitRelocDirective(), llvm::InstructionSelector::executeMatchTable(), findCostForOutputBlocks(), findExtractedInputToOverallInputMapping(), llvm::sys::Process::FindInEnvPath(), findPreviousSpillSlot(), llvm::PeelingModuloScheduleExpander::fixupBranches(), llvm::codeview::TypeCollection::ForEachRecord(), llvm::format_provider< T, std::enable_if_t< detail::use_double_formatter< T >::value > >::format(), llvm::gatherPeelingPreferences(), llvm::gatherUnrollingPreferences(), genericValueTraversal(), llvm::dwarf::UnwindLocation::getAddressSpace(), AAHeapToStackFunction::getAPInt(), llvm::IRPosition::getAssociatedArgument(), llvm::Attribute::getAsString(), llvm::Attributor::getAssumedConstant(), llvm::Attributor::getAssumedSimplified(), llvm::objcarc::getAttachedARCFunctionKind(), getCopyFromPartsVector(), getCopyToPartsVector(), GetDeoptBundleOperands(), llvm::ELFYAML::HashSection::getEntries(), llvm::ELFYAML::GnuHashSection::getEntries(), llvm::ELFYAML::AddrsigSection::getEntries(), llvm::ELFYAML::DependentLibrariesSection::getEntries(), llvm::ELFYAML::SymverSection::getEntries(), llvm::ELFYAML::RelrSection::getEntries(), llvm::ELFYAML::SymtabShndxSection::getEntries(), llvm::MCSymbolWasm::getGlobalType(), llvm::MCSymbolWasm::getImportModule(), getISDForVPIntrinsic(), llvm::BinaryStreamRefBase< WritableBinaryStreamRef, WritableBinaryStream >::getLength(), llvm::SystemZTargetLowering::getNumRegisters(), getOrCreateCachedOptional(), llvm::VPIntrinsic::getPointerAlignment(), llvm::IRSimilarity::IRInstructionData::getPredicate(), llvm::MCSchedModel::getReciprocalThroughput(), getSearchPaths(), AAHeapToStackFunction::getSize(), llvm::Optional< uint64_t >::getValueOr(), llvm::MCContext::getXCOFFSection(), llvm::MCSymbolWasm::hasExportName(), llvm::MCSymbolWasm::hasImportModule(), llvm::MCSymbolWasm::hasTableType(), llvm::hasUnrollAndJamTransformation(), llvm::hasUnrollTransformation(), llvm::AArch64FunctionInfo::initializeBaseYamlFields(), llvm::IRSimilarity::IRInstructionData::initializeInstruction(), IntersectSignedRange(), IntersectUnsignedRange(), llvm::RegsForValue::isABIMangled(), isColdBlock(), llvm::MCSectionXCOFF::isCsect(), llvm::LLVMContext::isDiagnosticsHotnessThresholdSetFromPSI(), llvm::RISCVTargetLowering::joinRegisterPartsIntoValue(), llvm::FileError::log(), llvm::M68kMCInstLower::Lower(), lowerConstantIntrinsics(), AAReturnedValuesImpl::manifest(), AAHeapToStackFunction::manifest(), llvm::CombinerHelper::matchCombineConstantFoldFpUnary(), llvm::CombinerHelper::matchLoadOrCombine(), llvm::codeview::CodeViewRecordIO::maxFieldLength(), llvm::Optional< uint64_t >::operator bool(), llvm::raw_ostream::operator<<(), packAllocSizeArgs(), llvm::LoopVectorizePass::processLoop(), replaceCalledFunction(), llvm::IRSimilarity::IRSimilarityIdentifier::resetSimilarityCandidates(), llvm::LoopInstSimplifyPass::run(), llvm::LoopRotatePass::run(), llvm::LoopSimplifyCFGPass::run(), llvm::SimpleLoopUnswitchPass::run(), runImpl(), runPartiallyInlineLibCalls(), llvm::object::ELFObjectFileBase::setARMSubArch(), llvm::IRBuilderBase::setDefaultConstrainedExcept(), llvm::IRBuilderBase::setDefaultConstrainedRounding(), llvm::MCDwarfLineTableHeader::setRootFile(), llvm::MCDwarfLineTable::setRootFile(), llvm::InstCombinerImpl::SimplifyDemandedUseBits(), llvm::InstCombinerImpl::SimplifyDemandedVectorElts(), SolveQuadraticAddRecRange(), llvm::RISCVTargetLowering::splitValueIntoRegisterParts(), llvm::Attributor::translateArgumentToCallSiteContent(), llvm::MCDwarfLineTableHeader::tryGetFile(), tryToUnrollAndJamLoop(), tryToUnrollLoop(), AAReturnedValuesImpl::updateImpl(), AAUndefinedBehaviorImpl::updateImpl(), AAValueSimplifyArgument::updateImpl(), llvm::InstCombinerImpl::visitCallInst(), llvm::codeview::TypeRecordMapping::visitMemberBegin(), llvm::codeview::TypeRecordMapping::visitMemberEnd(), llvm::codeview::SymbolSerializer::visitSymbolBegin(), llvm::codeview::SymbolSerializer::visitSymbolEnd(), llvm::codeview::TypeRecordMapping::visitTypeBegin(), llvm::codeview::TypeRecordMapping::visitTypeEnd(), and llvm::codeview::ContinuationRecordBuilder::writeMemberType().

◆ map()

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

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

Definition at line 303 of file Optional.h.

◆ operator bool()

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

Definition at line 287 of file Optional.h.

◆ operator*() [1/2]

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

Definition at line 291 of file Optional.h.

◆ operator*() [2/2]

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

Definition at line 294 of file Optional.h.

◆ operator->() [1/2]

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

Definition at line 290 of file Optional.h.

◆ operator->() [2/2]

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

Definition at line 289 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 272 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 257 of file Optional.h.

◆ reset()

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

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