LLVM
8.0.1
|
Tagged union holding either a T or a Error. More...
#include "llvm/Support/CachePruning.h"
Public Types | |
using | storage_type = typename std::conditional< isRef, wrap, T >::type |
using | value_type = T |
Public Member Functions | |
Expected (Error Err) | |
Create an Expected<T> error value from the given Error. More... | |
Expected (ErrorSuccess)=delete | |
Forbid to convert from Error::success() implicitly, this avoids having Expected<T> foo() { return Error::success(); } which compiles otherwise but triggers the assertion above. More... | |
template<typename OtherT > | |
Expected (OtherT &&Val, typename std::enable_if< std::is_convertible< OtherT, T >::value >::type *=nullptr) | |
Create an Expected<T> success value from the given OtherT value, which must be convertible to T. More... | |
Expected (Expected &&Other) | |
Move construct an Expected<T> value. More... | |
template<class OtherT > | |
Expected (Expected< OtherT > &&Other, typename std::enable_if< std::is_convertible< OtherT, T >::value >::type *=nullptr) | |
Move construct an Expected<T> value from an Expected<OtherT>, where OtherT must be convertible to T. More... | |
template<class OtherT > | |
Expected (Expected< OtherT > &&Other, typename std::enable_if<!std::is_convertible< OtherT, T >::value >::type *=nullptr) | |
Move construct an Expected<T> value from an Expected<OtherT>, where OtherT isn't convertible to T. More... | |
Expected & | operator= (Expected &&Other) |
Move-assign from another Expected<T>. More... | |
~Expected () | |
Destroy an Expected<T>. More... | |
operator bool () | |
Return false if there is an error. More... | |
reference | get () |
Returns a reference to the stored T value. More... | |
const_reference | get () const |
Returns a const reference to the stored T value. More... | |
template<typename ErrT > | |
bool | errorIsA () const |
Check that this Expected<T> is an error of type ErrT. More... | |
Error | takeError () |
Take ownership of the stored error. More... | |
pointer | operator-> () |
Returns a pointer to the stored T value. More... | |
const_pointer | operator-> () const |
Returns a const pointer to the stored T value. More... | |
reference | operator* () |
Returns a reference to the stored T value. More... | |
const_reference | operator* () const |
Returns a const reference to the stored T value. More... | |
Friends | |
template<class T1 > | |
class | ExpectedAsOutParameter |
template<class OtherT > | |
class | Expected |
Tagged union holding either a T or a Error.
This class parallels ErrorOr, but replaces error_code with Error. Since Error cannot be copied, this class replaces getError() with takeError(). It also adds an bool errorIsA<ErrT>() method for testing the error class type.
Definition at line 23 of file CachePruning.h.
using llvm::Expected< T >::storage_type = typename std::conditional<isRef, wrap, T>::type |
using llvm::Expected< T >::value_type = T |
|
inline |
|
delete |
Forbid to convert from Error::success() implicitly, this avoids having Expected<T> foo() { return Error::success(); } which compiles otherwise but triggers the assertion above.
|
inline |
|
inline |
|
inline |
|
inline |
Returns a reference to the stored T value.
Definition at line 533 of file Error.h.
Referenced by llvm::object::createBinary(), llvm::object::IRObjectFile::findBitcodeInMemBuffer(), llvm::MCJIT::findSymbol(), llvm::symbolize::LLVMSymbolizer::flush(), llvm::MCJIT::generateCodeForModule(), llvm::object::Archive::Child::getAsBinary(), llvm::object::Archive::Child::getBuffer(), getDbiStreamPtr(), llvm::object::Archive::Child::getFullName(), llvm::IndexedInstrProfReader::getFunctionCounts(), llvm::object::Archive::Child::getMemoryBufferRef(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::Archive::Child::getName(), llvm::object::Archive::Child::getNext(), llvm::NewArchiveMember::getOldMember(), llvm::object::Archive::Child::getRawSize(), llvm::object::Archive::Child::getSize(), LLVMCreateObjectFile(), parseHexOcta(), printDwarfFileDirective(), llvm::orc::OrcMCJITReplacement::setProcessAllSections(), llvm::splitCodeGen(), llvm::object::SymbolicFile::SymbolicFile(), and upgrade().
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
Returns a const reference to the stored T value.
Definition at line 579 of file Error.h.
References assert(), llvm::dbgs(), LLVM_ATTRIBUTE_NOINLINE, LLVM_ATTRIBUTE_NORETURN, LLVM_UNLIKELY, llvm::ErrorInfoBase::log(), Other, and T1.
|
inline |
|
inline |
|
inline |
Move-assign from another Expected<T>.
Definition at line 510 of file Error.h.
References Other.
Referenced by llvm::MSVCPExpected< T >::operator=().
|
inline |
Take ownership of the stored error.
After calling this the Expected<T> is in an indeterminate state that can only be safely destructed. No further calls (beside the destructor) should be made on the Expected<T> vaule.
Definition at line 553 of file Error.h.
References llvm::Error, and llvm::Error::success().
Referenced by llvm::pdb::PDBFileBuilder::addInjectedSource(), llvm::pdb::PDBFileBuilder::addNamedStream(), llvm::object::ELFFile< ELFT >::android_relas(), llvm::lto::backend(), llvm::pdb::PDBFileBuilder::commit(), llvm::msf::MSFBuilder::commit(), computeMemberData(), llvm::orc::rpc::detail::ResultTraits< RetT >::consumeAbandoned(), llvm::object::SectionRef::containsSymbol(), llvm::GlobPattern::create(), llvm::symbolize::SymbolizableObjectFile::create(), llvm::object::IRObjectFile::create(), llvm::lto::InputFile::create(), llvm::object::createBinary(), llvm::mca::InstrBuilder::createInstruction(), createOnDiskBuffer(), llvm::DWARFContext::defaultErrorHandler(), llvm::dlltoolDriverMain(), doImportingForModule(), llvm::coverage::CounterMappingContext::dump(), llvm::object::ELFFile< ELFT >::dynamicEntries(), llvm::object::RelocVisitor::error(), llvm::coverage::CounterMappingContext::evaluate(), llvm::expectedToErrorOrAndEmitErrors(), llvm::pdb::GSIStreamBuilder::finalizeMsfLayout(), llvm::RuntimeDyldMachOX86_64::finalizeSection(), llvm::RuntimeDyldMachOI386::finalizeSection(), llvm::RuntimeDyldMachOAArch64::finalizeSection(), llvm::object::IRObjectFile::findBitcodeInMemBuffer(), llvm::pdb::TpiStream::findFullDeclForForwardRef(), llvm::MCJIT::findSymbol(), llvm::pdb::SymbolCache::findSymbolByTypeIndex(), llvm::symbolize::LLVMSymbolizer::flush(), forceRenaming(), llvm::DWARFDebugAranges::generate(), llvm::MCJIT::generateCodeForModule(), llvm::object::Archive::Child::getAsBinary(), llvm::object::COFFObjectFile::getAuxSymbol(), llvm::getBitcodeFileContents(), llvm::getBitcodeLTOInfo(), llvm::getBitcodeProducerString(), llvm::getBitcodeTargetTriple(), llvm::object::Archive::Child::getBuffer(), getDbiStreamPtr(), llvm::object::Archive::Child::getFullName(), llvm::IndexedInstrProfReader::getFunctionCounts(), llvm::getLazyBitcodeModule(), llvm::DWARFContext::getLineTableForUnit(), llvm::BitcodeModule::getLTOInfo(), llvm::object::Archive::Child::getMemoryBufferRef(), llvm::getModuleSummaryIndex(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::Archive::Child::getName(), llvm::object::Archive::Child::getNext(), llvm::getOffset(), llvm::NewArchiveMember::getOldMember(), llvm::LTOModule::getProducerString(), llvm::object::Archive::Child::getRawSize(), getSingleModule(), llvm::object::Archive::Child::getSize(), llvm::pdb::PDBFile::getStringTable(), getSymbolInfo(), llvm::object::MachOObjectFile::getSymbolType(), handleNonPrevailingComdat(), llvm::pdb::PDBFile::hasPDBStringTable(), llvm::isBitcodeContainingObjCCategory(), llvm::LTOModule::isBitcodeFile(), llvm::LTOModule::isBitcodeForTarget(), llvm::LTOModule::isThinLTO(), llvm::isThumbFunc(), LLVMCreateObjectFile(), LLVMGetSymbolAddress(), LLVMGetSymbolName(), LLVMMoveToContainingSection(), llvm::lto::localCache(), llvm::parseBitcodeFile(), parseBitcodeFileImpl(), parseHexOcta(), printDwarfFileDirective(), llvm::object::ObjectFile::printSymbolName(), llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::object::readIRSymtab(), llvm::readModuleSummaryIndex(), llvm::orc::RemoteObjectLayer< RPCEndpoint >::remoteToJITSymbol(), llvm::orc::rpc::detail::RespondHelper< true >::sendResult(), llvm::orc::OrcMCJITReplacement::setProcessAllSections(), sumEdgeCount(), llvm::object::SymbolicFile::SymbolicFile(), llvm::detail::TakeExpected(), llvm::lto::thinBackend(), upgrade(), and llvm::writeArchive().
AlignedCharArrayUnion<error_type> llvm::Expected< T >::ErrorStorage |
AlignedCharArrayUnion<storage_type> llvm::Expected< T >::TStorage |