llvm-project/llvm/lib
Pavel Labath b1f29cec25 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
..
Analysis [NFC] Replace the FIXME I added in rL369989 with a comment clarifying the current code 2019-08-27 04:52:35 +00:00
AsmParser [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
BinaryFormat [BinaryFormat] Teach identify_magic about Tapi files. 2019-08-21 21:00:16 +00:00
Bitcode Do a sweep of symbol internalization. NFC. 2019-08-23 19:59:23 +00:00
Bitstream [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
CodeGen [DAGCombiner] Add node to the worklist in topological order after relegalization. 2019-08-27 11:06:09 +00:00
DebugInfo Add error handling to the DataExtractor class 2019-08-27 11:24:08 +00:00
Demangle llvm-undname: Correctly demangle vararg parameters 2019-06-04 19:10:08 +00:00
ExecutionEngine [ORC] Make sure that queries on emitted-but-not-ready symbols fail correctly. 2019-08-26 21:42:51 +00:00
FuzzMutate [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
Fuzzer
IR [Constant] Add 'isElementWiseEqual()' method 2019-08-24 06:49:51 +00:00
IRReader [IRReader] Expose getLazyIRModule 2019-02-11 22:01:13 +00:00
LTO Do a sweep of symbol internalization. NFC. 2019-08-23 19:59:23 +00:00
LineEditor [CMake] Delete redundant DEPENDS/LINK_LIBS from LineEditor/XRay 2019-06-22 01:50:21 +00:00
Linker Linker: Add support for GlobalIFunc. 2019-08-08 22:09:18 +00:00
MC [PowerPC][AIX] Adds support for writing the .data section in assembly files 2019-08-25 15:17:25 +00:00
MCA [MCA] consistently use MCPhysReg instead of unsigned as register type. NFCI 2019-08-22 13:32:17 +00:00
Object [Object] FIX: update PlatformKind name in TapiFile 2019-08-21 23:57:57 +00:00
ObjectYAML [yaml2obj] - Don't allow setting StOther and Other/Visibility at the same time. 2019-08-27 09:58:39 +00:00
Option [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
Passes [LoopPassManager + MemorySSA] Only enable use of MemorySSA for LPMs known to preserve it. 2019-08-21 17:00:57 +00:00
ProfileData [SampleFDO] Extract the code calling each section reader to readOneSection. 2019-08-26 15:54:16 +00:00
Remarks Do a sweep of symbol internalization. NFC. 2019-08-23 19:59:23 +00:00
Support Add error handling to the DataExtractor class 2019-08-27 11:24:08 +00:00
TableGen [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
Target AArch64: avoid creating cycle in DAG for post-increment NEON ops. 2019-08-27 10:21:11 +00:00
Testing [Testing] Move clangd::Annotations to llvm testing support 2019-04-25 10:08:31 +00:00
TextAPI [TextAPI] Update reader to be supported by lib/Object 2019-08-16 15:30:48 +00:00
ToolDrivers [llvm-dlltool] Make sure to strip decorations from ExtName for renamed exports 2019-08-23 11:18:11 +00:00
Transforms [InstCombine] Fold select with ctlz to cttz 2019-08-27 10:22:40 +00:00
WindowsManifest Fight a bit against global initializers. NFC. 2019-08-22 19:43:27 +00:00
XRay [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
CMakeLists.txt Fix build errors LLVM tests are disabled. 2019-07-11 22:08:35 +00:00
LLVMBuild.txt [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00