summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/BinaryStreamTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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