1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
llvm-mirror/lib/Support
Pavel Labath d0775d3cfb Add error handling to the DataExtractor class
Summary:
This is motivated by D63591, where we realized that there isn't a really
good way of telling whether a DataExtractor is reading actual data, or
is it just returning default values because it reached the end of the
buffer.

This patch resolves that by providing a new "Cursor" class. A Cursor
object encapsulates two things:
- the current position/offset in the DataExtractor
- an error object

Storing the error object inside the Cursor enables one to use the same
pattern as the std::{io}stream API, where one can blindly perform a
sequence of reads and only check for errors once at the end of the
operation. Similarly to the stream API, as soon as we encounter one
error, all of the subsequent operations are skipped (return default
values) too, even if the would suceed with clear error state. Unlike the
std::stream API (but in line with other llvm APIs), we force the error
state to be checked through usage of llvm::Error.

Reviewers: probinson, dblaikie, JDevlieghere, aprantl, echristo

Subscribers: kristina, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63713

llvm-svn: 370042
2019-08-27 11:24:08 +00:00
..
Unix [Support] Improve readNativeFile(Slice) interface 2019-08-22 08:13:30 +00:00
Windows [Support] Improve readNativeFile(Slice) interface 2019-08-22 08:13:30 +00:00
AArch64TargetParser.cpp [AArch64][SVE2] Rename bitperm feature to sve2-bitperm 2019-07-26 15:57:50 +00:00
Allocator.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
AMDGPUMetadata.cpp [AMDGPU] Added a new metadata for multi grid sync implicit argument 2019-07-05 16:05:17 +00:00
APFloat.cpp [clang] Add storage for APValue in ConstantExpr 2019-06-15 10:24:47 +00:00
APInt.cpp [C++2a] Add __builtin_bit_cast, used to implement std::bit_cast 2019-07-02 18:28:13 +00:00
APSInt.cpp Fix parameter name comments using clang-tidy. NFC. 2019-07-16 04:46:31 +00:00
ARMAttributeParser.cpp Fix failing test on ARM buildbot 2019-06-14 13:45:21 +00:00
ARMBuildAttrs.cpp [ARM] add target arch definitions for 8.1-M and MVE 2019-05-30 12:57:04 +00:00
ARMTargetParser.cpp [TargetParser][ARM] Account dependencies when processing target features 2019-07-14 20:31:15 +00:00
ARMWinEH.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Atomic.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BinaryStreamError.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BinaryStreamReader.cpp [Support] Add LEB128 support to BinaryStreamReader/Writer. 2019-04-17 15:38:27 +00:00
BinaryStreamRef.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BinaryStreamWriter.cpp [Support] Add LEB128 support to BinaryStreamReader/Writer. 2019-04-17 15:38:27 +00:00
BlockFrequency.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BranchProbability.cpp [BranchProbability] Delete a redundant overflow check 2019-06-15 10:09:59 +00:00
BuryPointer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CachePruning.cpp Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC 2019-08-05 05:43:48 +00:00
Chrono.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
circular_raw_ostream.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt [Support] Re-introduce the RWMutexImpl for macOS < 10.12 2019-08-15 23:07:20 +00:00
CodeGenCoverage.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
COM.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CommandLine.cpp Revert Recommit "[CommandLine] Remove OptionCategory and SubCommand caches from the Option class." 2019-07-11 08:54:28 +00:00
Compression.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ConvertUTF.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ConvertUTFWrapper.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
COPYRIGHT.regex
CrashRecoveryContext.cpp [Support] Replace sys::Mutex with their standard equivalents. 2019-08-19 19:49:57 +00:00
CRC.cpp Attempt to recommit r357901 2019-04-08 12:31:12 +00:00
DAGDeltaAlgorithm.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DataExtractor.cpp Add error handling to the DataExtractor class 2019-08-27 11:24:08 +00:00
Debug.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DebugCounter.cpp Print out DebugCounter info with -print-debug-counter 2018-10-23 21:51:56 +00:00
DeltaAlgorithm.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DJB.cpp [DJB] Fix variable case after D61178 2019-04-27 15:33:22 +00:00
DynamicLibrary.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Errno.cpp Remove some autoconf references from docs and comments 2019-07-03 09:57:59 +00:00
Error.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
ErrorHandling.cpp [Support] Move the static initializer install_out_memory_new_handler to InitLLVM 2019-07-12 16:23:25 +00:00
FileCheck.cpp Do a sweep of symbol internalization. NFC. 2019-08-23 19:59:23 +00:00
FileCollector.cpp Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC 2019-08-05 05:43:48 +00:00
FileOutputBuffer.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
FileUtilities.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
FoldingSet.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
FormattedStream.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
FormatVariadic.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
GlobPattern.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
GraphWriter.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Hashing.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Host.cpp [X86] Support -march=tigerlake 2019-08-12 01:29:46 +00:00
InitLLVM.cpp [Support] Move the static initializer install_out_memory_new_handler to InitLLVM 2019-07-12 16:23:25 +00:00
IntEqClasses.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IntervalMap.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ItaniumManglingCanonicalizer.cpp Update more file headers across all of the LLVM projects in the monorepo 2019-01-19 10:56:40 +00:00
JamCRC.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
JSON.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
KnownBits.cpp [KnownBits] Add computeForAddCarry() 2019-04-12 18:18:08 +00:00
LEB128.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LineIterator.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Locale.cpp [Windows] Convert from UTF-8 to UTF-16 when writing to a Windows console 2018-09-05 00:08:56 +00:00
LockFileManager.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LowLevelType.cpp Fix parameter name comments using clang-tidy. NFC. 2019-07-16 04:46:31 +00:00
ManagedStatic.cpp [Support] Replace sys::Mutex with their standard equivalents. 2019-08-19 19:49:57 +00:00
MathExtras.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MD5.cpp
Memory.cpp [Support] Renamed member 'Size' to 'AllocatedSize' in MemoryBlock and OwningMemoryBlock. 2019-05-20 20:53:05 +00:00
MemoryBuffer.cpp [Support] Improve readNativeFile(Slice) interface 2019-08-22 08:13:30 +00:00
NativeFormatting.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Optional.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Options.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Parallel.cpp Parallel: only allow the first TaskGroup to run tasks parallelly 2019-04-25 11:33:30 +00:00
Path.cpp [Path] Fix bug in make_absolute logic 2019-08-06 15:46:45 +00:00
PluginLoader.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
PrettyStackTrace.cpp Make GCC happy about attribute location 2019-07-25 16:58:15 +00:00
Process.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Program.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RandomNumberGenerator.cpp [CommandLine] Provide parser<unsigned long> instantiation to allow cl::opt<uint64_t> on LP64 platforms 2019-04-24 02:40:20 +00:00
raw_os_ostream.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
raw_ostream.cpp Revert "raw_ostream: add operator<< overload for std::error_code" 2019-08-14 13:59:04 +00:00
regcomp.c Allow Compiler.h to be included in C files and fix fallthrough warnings 2019-08-23 17:25:21 +00:00
regengine.inc [ADT] Replace std::isprint by llvm::isPrint. 2018-07-26 15:31:41 +00:00
regerror.c
regex2.h
regex_impl.h Remove trailing space 2018-07-30 19:41:25 +00:00
Regex.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
regexec.c
regfree.c
regstrlcpy.c
regutils.h
RWMutex.cpp [RWMutex] Simplify availability check 2019-08-16 21:25:40 +00:00
ScaledNumber.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ScopedPrinter.cpp
SHA1.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Signals.cpp Only use argv[0] as the main executable name if it exists. 2019-04-15 22:07:56 +00:00
Signposts.cpp [Support] Fix Wundef warning 2019-08-15 10:05:22 +00:00
SmallPtrSet.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SmallVector.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SourceMgr.cpp Simplify std::lower_bound with llvm::{bsearch,lower_bound}. NFC 2019-06-21 05:40:31 +00:00
SpecialCaseList.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
Statistic.cpp Use llvm::stable_sort 2019-04-23 14:51:27 +00:00
StringExtras.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StringMap.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StringPool.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StringRef.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StringSaver.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SymbolRemappingReader.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SystemUtils.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TargetParser.cpp [AMDGPU] gfx908 target 2019-07-09 18:10:06 +00:00
TargetRegistry.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TarWriter.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Threading.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadLocal.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ThreadPool.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TimeProfiler.cpp [Support][Time profiler] Make FE codegen blocks to be inside frontend blocks 2019-08-19 22:58:26 +00:00
Timer.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
ToolOutputFile.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TrigramIndex.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Triple.cpp [triple] Use 'macabi' environment name for the Mac Catalyst triples 2019-07-03 01:02:43 +00:00
Twine.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Unicode.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
UnicodeCaseFold.cpp
Valgrind.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
VersionTuple.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
VirtualFileSystem.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
Watchdog.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
WithColor.cpp Revert r367649: Improve raw_ostream so that you can "write" colors using operator<< 2019-08-02 07:22:34 +00:00
xxhash.cpp Make ICF log output order deterministic. 2018-07-31 18:04:58 +00:00
YAMLParser.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
YAMLTraits.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
Z3Solver.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00