LLVM  13.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
 
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 243 of file Optional.h.

Constructor & Destructor Documentation

◆ Optional() [1/6]

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

Definition at line 245 of file Optional.h.

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

◆ Optional() [2/6]

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

Definition at line 246 of file Optional.h.

◆ Optional() [3/6]

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

Definition at line 248 of file Optional.h.

◆ Optional() [4/6]

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

◆ Optional() [5/6]

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

Definition at line 251 of file Optional.h.

◆ Optional() [6/6]

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

Member Function Documentation

◆ create()

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

Definition at line 266 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 279 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 280 of file Optional.h.

Referenced by alignOutputBlockWithAggFunc(), assignSections(), llvm::VPlanSlp::buildGraph(), CC_RISCV(), CloneLoopBlocks(), collectRegionsConstants(), llvm::InnerLoopVectorizer::completeLoopSkeleton(), llvm::PPCELFStreamer::emitInstruction(), llvm::InstructionSelector::executeMatchTable(), findCostForOutputBlocks(), findExtractedInputToOverallInputMapping(), llvm::sys::Process::FindInEnvPath(), llvm::IRSimilarity::IRSimilarityIdentifier::findSimilarity(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::IRPosition::getAssociatedArgument(), llvm::Attributor::getAssumedConstant(), llvm::ProfileSummaryInfo::getColdCountThreshold(), getCopyFromPartsVector(), llvm::RegsForValue::getCopyFromRegs(), getCopyToPartsVector(), llvm::RegsForValue::getCopyToRegs(), GetDeoptBundleOperands(), llvm::MCSymbolWasm::getEventType(), llvm::MCSymbolWasm::getExportName(), llvm::AArch64TTIImpl::getGatherScatterOpCost(), llvm::MCSymbolWasm::getGlobalType(), llvm::ProfileSummaryInfo::getHotCountThreshold(), llvm::MCSymbolWasm::getImportModule(), getISDForVPIntrinsic(), llvm::ProfileSummaryInfo::getOrCompColdCountThreshold(), llvm::ProfileSummaryInfo::getOrCompHotCountThreshold(), getOrCreateCachedOptional(), llvm::IRSimilarity::IRInstructionData::getPredicate(), llvm::MCSchedModel::getReciprocalThroughput(), llvm::MCSymbolWasm::getTableType(), llvm::Optional< uint64_t >::getValueOr(), llvm::ProfileSummaryInfo::hasHugeWorkingSetSize(), llvm::ProfileSummaryInfo::hasLargeWorkingSetSize(), llvm::hasUnrollAndJamTransformation(), llvm::hasUnrollTransformation(), IntersectSignedRange(), IntersectUnsignedRange(), llvm::ProfileSummaryInfo::isColdCount(), llvm::ProfileSummaryInfo::isHotCount(), llvm::FileError::log(), llvm::M68kMCInstLower::Lower(), llvm::VETargetLowering::lowerToVVP(), 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::LoopVectorizationPlanner::plan(), llvm::MachineBasicBlock::print(), llvm::LoopVectorizePass::processLoop(), llvm::RegsForValue::RegsForValue(), llvm::slpvectorizer::BoUpSLP::VLOperands::reorder(), replaceCalledFunction(), llvm::object::ELFObjectFileBase::setARMSubArch(), llvm::InstCombinerImpl::SimplifyDemandedUseBits(), llvm::InstCombinerImpl::SimplifyDemandedVectorElts(), tryToUnrollAndJamLoop(), tryToUnrollLoop(), verifyFuncBFI(), and llvm::InstCombinerImpl::visitCallInst().

◆ getValue() [2/2]

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

Definition at line 283 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 286 of file Optional.h.

Referenced by alignOutputBlockWithAggFunc(), llvm::DIExpression::appendToStack(), llvm::CombinerHelper::applyCombineConstantFoldFpUnary(), assignSections(), llvm::codeview::ContinuationRecordBuilder::begin(), CC_RISCV(), CloneLoopBlocks(), collectRegionsConstants(), 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(), llvm::IRPosition::getAssociatedArgument(), llvm::Attribute::getAsString(), llvm::Attributor::getAssumedConstant(), 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::getEventType(), llvm::MCSymbolWasm::getGlobalType(), llvm::MCSymbolWasm::getImportModule(), getISDForVPIntrinsic(), llvm::BinaryStreamRefBase< WritableBinaryStreamRef, WritableBinaryStream >::getLength(), getOrCreateCachedOptional(), llvm::IRSimilarity::IRInstructionData::getPredicate(), llvm::MCSchedModel::getReciprocalThroughput(), getSearchPaths(), llvm::Optional< uint64_t >::getValueOr(), llvm::MCContext::getXCOFFSection(), llvm::MCSymbolWasm::hasExportName(), llvm::MCSymbolWasm::hasImportModule(), llvm::MCSymbolWasm::hasTableType(), llvm::hasUnrollAndJamTransformation(), llvm::hasUnrollTransformation(), llvm::AArch64FunctionInfo::initializeBaseYamlFields(), IntersectSignedRange(), IntersectUnsignedRange(), llvm::IRSimilarity::IRInstructionData::IRInstructionData(), llvm::RegsForValue::isABIMangled(), isColdBlock(), llvm::MCSectionXCOFF::isCsect(), llvm::LLVMContext::isDiagnosticsHotnessThresholdSetFromPSI(), llvm::RISCVTargetLowering::joinRegisterPartsIntoValue(), llvm::FileError::log(), llvm::M68kMCInstLower::Lower(), lowerConstantIntrinsics(), 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::LoopRotatePass::run(), llvm::LoopInstSimplifyPass::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::MCDwarfLineTableHeader::tryGetFile(), tryToUnrollAndJamLoop(), tryToUnrollLoop(), 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(), writeCOFF(), 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 301 of file Optional.h.

◆ operator bool()

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

Definition at line 285 of file Optional.h.

◆ operator*() [1/2]

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

Definition at line 289 of file Optional.h.

◆ operator*() [2/2]

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

Definition at line 292 of file Optional.h.

◆ operator->() [1/2]

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

Definition at line 288 of file Optional.h.

◆ operator->() [2/2]

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

Definition at line 287 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 270 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 255 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: