|
LLVM
4.0.0
|
Tagged union holding either a T or a Error. More...
#include <Error.h>
Public Types | |
| typedef std::conditional < isRef, wrap, T >::type | storage_type |
| typedef T | value_type |
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 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 631 of file Support/Error.h.
| typedef std::conditional<isRef, wrap, T>::type llvm::Expected< T >::storage_type |
Definition at line 639 of file Support/Error.h.
| typedef T llvm::Expected< T >::value_type |
Definition at line 640 of file Support/Error.h.
|
inline |
Create an Expected<T> error value from the given Error.
Definition at line 650 of file Support/Error.h.
References assert().
|
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 |
Create an Expected<T> success value from the given OtherT value, which must be convertible to T.
Definition at line 669 of file Support/Error.h.
|
inline |
Move construct an Expected<T> value.
Definition at line 682 of file Support/Error.h.
References Other.
|
inline |
Move construct an Expected<T> value from an Expected<OtherT>, where OtherT must be convertible to T.
Definition at line 687 of file Support/Error.h.
References Other.
|
inlineexplicit |
Move construct an Expected<T> value from an Expected<OtherT>, where OtherT isn't convertible to T.
Definition at line 696 of file Support/Error.h.
References Other.
|
inline |
Destroy an Expected<T>.
Definition at line 710 of file Support/Error.h.
Check that this Expected<T> is an error of type ErrT.
Definition at line 739 of file Support/Error.h.
|
inline |
Returns a reference to the stored T value.
Definition at line 727 of file Support/Error.h.
Referenced by llvm::object::Archive::Archive(), llvm::object::ArchiveMemberHeader::ArchiveMemberHeader(), llvm::object::Archive::Child::Child(), llvm::lto::InputFile::create(), llvm::object::createBinary(), llvm::object::SymbolicFile::createSymbolicFile(), llvm::object::IRObjectFile::findBitcodeInMemBuffer(), llvm::object::ModuleSummaryIndexObjectFile::findBitcodeInMemBuffer(), llvm::MCJIT::findSymbol(), llvm::MCJIT::generateCodeForModule(), llvm::object::Archive::Child::getAsBinary(), llvm::object::Archive::Child::getBuffer(), llvm::object::Archive::Child::getFullName(), llvm::IndexedInstrProfReader::getFunctionCounts(), getLazyIRModule(), 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::getSize(), LLVMCreateObjectFile(), LLVMGetBitcodeModuleInContext(), LLVMParseBitcodeInContext(), llvm::parseIR(), llvm::InstrProfLookupTrait::readValueProfilingData(), llvm::splitCodeGen(), and writeSymbolTable().
|
inline |
Returns a const reference to the stored T value.
Definition at line 733 of file Support/Error.h.
|
inlineexplicit |
Return false if there is an error.
Definition at line 719 of file Support/Error.h.
|
inline |
Returns a reference to the stored T value.
Definition at line 767 of file Support/Error.h.
|
inline |
Returns a const reference to the stored T value.
Definition at line 773 of file Support/Error.h.
|
inline |
Returns a pointer to the stored T value.
Definition at line 755 of file Support/Error.h.
|
inline |
Returns a const pointer to the stored T value.
Definition at line 761 of file Support/Error.h.
|
inline |
Move-assign from another Expected<T>.
Definition at line 704 of file Support/Error.h.
References Other.
|
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 747 of file Support/Error.h.
References llvm::lltok::Error, and llvm::Error::success().
Referenced by llvm::object::Archive::Archive(), llvm::object::ArchiveMemberHeader::ArchiveMemberHeader(), llvm::lto::backend(), llvm::object::Archive::Child::Child(), llvm::orc::rpc::detail::ResultTraits< RetT >::consumeAbandoned(), llvm::object::SectionRef::containsSymbol(), llvm::GlobPattern::create(), llvm::object::IRObjectFile::create(), llvm::lto::InputFile::create(), llvm::object::createBinary(), doImportingForModule(), llvm::coverage::CounterMappingContext::dump(), llvm::DWARFContextInMemory::DWARFContextInMemory(), llvm::expectedToErrorOrAndEmitErrors(), llvm::object::IRObjectFile::findBitcodeInMemBuffer(), llvm::object::ModuleSummaryIndexObjectFile::findBitcodeInMemBuffer(), llvm::MCJIT::findSymbol(), llvm::MCJIT::generateCodeForModule(), llvm::object::Archive::Child::getAsBinary(), llvm::getBitcodeModuleList(), llvm::getBitcodeProducerString(), llvm::getBitcodeTargetTriple(), llvm::object::Archive::Child::getBuffer(), llvm::object::Archive::Child::getFullName(), llvm::IndexedInstrProfReader::getFunctionCounts(), llvm::getLazyBitcodeModule(), getLazyIRModule(), llvm::object::Archive::Child::getMemoryBufferRef(), llvm::getModuleSummaryIndex(), llvm::getModuleSummaryIndexForFile(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::Archive::Child::getName(), llvm::object::Archive::Child::getNext(), llvm::getOffset(), llvm::NewArchiveMember::getOldMember(), getSingleModule(), llvm::object::Archive::Child::getSize(), llvm::object::MachOObjectFile::getSymbolType(), llvm::hasGlobalValueSummary(), llvm::isBitcodeContainingObjCCategory(), llvm::LTOModule::isThinLTO(), llvm::isThumbFunc(), llvm::libDriverMain(), llvm::ThinLTOCodeGenerator::linkCombinedIndex(), LLVMCreateObjectFile(), LLVMGetBitcodeModuleInContext(), LLVMGetSymbolAddress(), LLVMGetSymbolName(), LLVMMoveToContainingSection(), LLVMParseBitcodeInContext(), llvm::orc::SimpleCompiler::operator()(), llvm::parseBitcodeFile(), llvm::parseIR(), llvm::object::ObjectFile::printSymbolName(), llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::InstrProfLookupTrait::readValueProfilingData(), llvm::orc::rpc::detail::respond(), scan(), llvm::lto::thinBackend(), and writeSymbolTable().
Definition at line 632 of file Support/Error.h.
| AlignedCharArrayUnion<error_type> llvm::Expected< T >::ErrorStorage |
Definition at line 853 of file Support/Error.h.
| AlignedCharArrayUnion<storage_type> llvm::Expected< T >::TStorage |
Definition at line 852 of file Support/Error.h.
1.8.6