summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/BinaryStreamTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-151-8/+8
| | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
* [Support] Add LEB128 support to BinaryStreamReader/Writer.Lang Hames2019-04-171-0/+71
| | | | | | | | | | | | | | | | | | | Summary: This patch adds support for ULEB128 and SLEB128 encoding and decoding to BinaryStreamWriter and BinaryStreamReader respectively. Support for ULEB128/SLEB128 will be used for eh-frame parsing in the JITLink library currently under development (see https://reviews.llvm.org/D58704). Reviewers: zturner, dblaikie Subscribers: kristina, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60810 llvm-svn: 358584
* 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
* Remove redundant includes from unittests.Michael Zolotukhin2017-12-131-2/+0
| | | | llvm-svn: 320630
* Fix -Werror build for signed/unsigned comparison with use of explicit ↵David Blaikie2017-11-271-10/+10
| | | | | | unsigned literals llvm-svn: 319081
* [BinaryStream] Support growable streams.Zachary Turner2017-11-271-3/+89
| | | | | | | | | The existing library assumed that a stream's length would never change. This makes some things simpler, but it's not flexible enough for what we need, especially for writable streams where what you really want is for each call to write to actually append. llvm-svn: 319070
* Remove unused variables. No functionality change.Benjamin Kramer2017-10-081-2/+0
| | | | llvm-svn: 315196
* Remove unused variables. No functionality change.Benjamin Kramer2017-10-081-1/+0
| | | | llvm-svn: 315185
* [gtest] Create a shared include directory for gtest utilities.Zachary Turner2017-06-141-88/+75
| | | | | | | | | | | | | | | | | | | | | | | Many times unit tests for different libraries would like to use the same helper functions for checking common types of errors. This patch adds a common library with helpers for testing things in Support, and introduces helpers in here for integrating the llvm::Error and llvm::Expected<T> classes with gtest and gmock. Normally, we would just be able to write: EXPECT_THAT(someFunction(), succeeded()); but due to some quirks in llvm::Error's move semantics, gmock doesn't make this easy, so two macros EXPECT_THAT_ERROR() and EXPECT_THAT_EXPECTED() are introduced to gloss over the difficulties. Consider this an exception, and possibly only temporary as we look for ways to improve this. Differential Revision: https://reviews.llvm.org/D33059 llvm-svn: 305395
* Allow VarStreamArray to use stateful extractors.Zachary Turner2017-06-091-5/+4
| | | | | | | | | | | Previously extractors tried to be stateless with any additional context information needed in order to parse items being passed in via the extraction method. This led to quite cumbersome implementation challenges and awkwardness of use. This patch brings back support for stateful extractors, making the implementation and usage simpler. llvm-svn: 305093
* Add some helpers for manipulating BinaryStreamRefs.Zachary Turner2017-05-171-0/+33
| | | | llvm-svn: 303297
* Add test for FixedStreamArrayIterator::operator->Adrian McCarthy2017-05-161-2/+27
| | | | | | | | | | | The operator-> implementation comes from iterator_facade_base, so it should just work given that the iterator has a tested operator*. But r302257 showed that required careful handling of for the const qualifier. This patch ensures the fix in r302257 doesn't regress. Differential Revision: https://reviews.llvm.org/D33249 llvm-svn: 303215
* Fix use after free in BinaryStream library.Zachary Turner2017-05-031-7/+7
| | | | | | | | | | | | | | | This was reported by the ASAN bot, and it turned out to be a fairly fundamental problem with the design of VarStreamArray and the way it passes context information to the extractor. The fix was cumbersome, and I'm not entirely pleased with it, so I plan to revisit this design in the future when I'm not pressed to get the bots green again. For now, this fixes the issue by storing the context information by value instead of by reference, and introduces some impossibly-confusing template magic to make things "work". llvm-svn: 301999
* [Support] Make BinaryStreamArray extractors stateless.Zachary Turner2017-04-271-9/+9
| | | | | | | Instead, we now pass a context memeber through the extraction process. llvm-svn: 301556
* [unittest] Explicitly specify alignment when using BumpPtrAllocator.Jordan Rose2017-03-111-1/+2
| | | | | | | | | | | | | r297310 began inserting red zones around allocations under ASan, which perturbs the alignment of subsequent allocations. Deliberately specify this in two places where it matters. Fixes failures when these tests are run under ASan and UBSan together. Reviewed by Duncan Exon Smith. rdar://problem/30980047 llvm-svn: 297540
* [Support] Move Stream library from MSF -> Support.Zachary Turner2017-03-021-0/+710
After several smaller patches to get most of the core improvements finished up, this patch is a straight move and header fixup of the source. Differential Revision: https://reviews.llvm.org/D30266 llvm-svn: 296810
OpenPOWER on IntegriCloud