summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/DataExtractor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add error handling to the DataExtractor classPavel Labath2019-08-271-41/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove support for 32-bit offsets in utility classes (5/5)Igor Kudrin2019-08-071-85/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D65641 llvm-svn: 368156
* Support 64-bit offsets in utility classes (1/5)Igor Kudrin2019-08-061-23/+107
| | | | | | | | | | Using 64-bit offsets is required to fully implement 64-bit DWARF. As these classes are used in many different libraries they should temporarily support both 32- and 64-bit offsets. Differential Revision: https://reviews.llvm.org/D64006 llvm-svn: 368013
* DataExtractor: use decodeSLEB128 to implement getSLEB128David Blaikie2019-06-241-21/+10
| | | | | | | | | Should've been NFC, but turns out DataExtractor had better test coverage for decoding SLEB128 than the decodeSLEB128 did - revealing a couple of bugs (one in the error handling, another in sign extension). So fixed those to get the DataExtractor tests passing again. llvm-svn: 364253
* NFC: DataExtractor: use decodeULEB128 to implement getULEB128David Blaikie2019-06-241-17/+11
| | | | llvm-svn: 364230
* [Support] Fix error handling in DataExtractor::get[US]LEB128Pavel Labath2019-06-241-14/+14
| | | | | | | | | | | | | | | | | | | | | | | Summary: These functions are documented as not modifying the offset argument if the extraction fails (just like other DataExtractor functions). However, while reviewing D63591 we discovered that this is not the case -- if the function reaches the end of the data buffer, it will just return the value parsed until that point and set offset to point to the end of the buffer. This fixes the functions to act as advertised, and adds a regression test. Reviewers: dblaikie, probinson, bkramer Subscribers: kristina, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63645 llvm-svn: 364169
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [DWARF] Support for DW_FORM_strx3 and complete support for DW_FORM_strx{1,2,4}Wolfgang Pieb2017-06-211-0/+7
| | | | | | | | | | (consumer). Reviewer: aprantl Differential Revision: https://reviews.llvm.org/D34418 llvm-svn: 305944
* Make DWARFDebugLine use StringRef for directory/file tables. NFCPaul Robinson2017-05-021-0/+10
| | | | | | Differential Revision: http://reviews.llvm.org/D32728 llvm-svn: 301940
* Using llvm::sys::swapByteOrder() for the common case of byte-swapping a ↵Artyom Skrobov2014-06-141-1/+1
| | | | | | value in place llvm-svn: 210978
* Renaming SwapByteOrder() to getSwappedBytes()Artyom Skrobov2014-06-141-1/+1
| | | | | | The next commit will add swapByteOrder(), acting in-place llvm-svn: 210973
* [C++11] Make use of 'nullptr' in the Support library.Craig Topper2014-04-071-2/+2
| | | | llvm-svn: 205697
* Make the host endianness check an integer constant expression.Rafael Espindola2013-04-151-1/+1
| | | | | | | | | | | | | | | I will remove the isBigEndianHost function once I update clang. The ifdef logic is designed to * not use configure/cmake to avoid breaking -arch i686 -arch ppc. * default to little endian * be as small as possible It looks like sys/endian.h is the preferred header on most modern BSD systems, but it is better to change this in a followup patch as machine/endian.h is available on FreeBSD, OpenBSD, NetBSD and OS X. llvm-svn: 179527
* DataExtractor: Fix integer truncation issues in LEB128 extraction.Benjamin Kramer2012-08-201-3/+3
| | | | llvm-svn: 162201
* Remove extra semi-colons.Chad Rosier2012-02-221-1/+1
| | | | llvm-svn: 151169
* Add the DataExtractor utility class.Benjamin Kramer2011-09-131-0/+175
It is an endian-aware helper that can read data from a StringRef. It will come in handy for DWARF parsing. This class is inspired by LLDB's DataExtractor, but is stripped down to the bare minimum needed for DWARF. Comes with unit tests! llvm-svn: 139626
OpenPOWER on IntegriCloud