summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/MemoryBufferTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Support] Pacify -Wsign-compare in unit test.Benjamin Kramer2018-03-081-2/+2
| | | | llvm-svn: 327070
* [Support] Add WriteThroughMemoryBuffer.Zachary Turner2018-03-081-0/+29
| | | | | | | | | | | This is like MemoryBuffer (read-only) and WritableMemoryBuffer (writable private), but where the underlying file can be modified after writing. This is useful when you want to open a file, make some targeted edits, and then write it back out. Differential Revision: https://reviews.llvm.org/D44230 llvm-svn: 327057
* [Support] Add WritableMemoryBuffer::getNewMemBufferPavel Labath2018-01-091-2/+2
| | | | | | | | | | | | | | | | | | Summary: The idea is that it would replace (non-Writable)MemoryBuffer::getNewMemBuffer, which is quite useless unless you const_cast its contents to write to it (which all (both) callers of this function were doing). This patch also fixes one of the usages in COFFWriter. After fixing the other usage in clang, I plan to delete the old function. Reviewers: dblaikie, Bigcheese Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41540 llvm-svn: 322094
* [Support] Remove MemoryBuffer::getNewUninitMemBufferPavel Labath2017-12-211-3/+3
| | | | | | | | | | | There is nothing useful that can be done with a read-only uninitialized buffer without const_casting its contents to initialize it. A better solution is to obtain a writable buffer (WritableMemoryBuffer::getNewUninitMemBuffer), and then convert it to a read-only buffer after initialization. All callers of this function have already been updated to do this, so this function is now unused. llvm-svn: 321257
* [Support] Add WritableMemoryBuffer classPavel Labath2017-12-191-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The motivation here is LLDB, where we need to fixup relocations in mmapped files before their contents can be read correctly. The MemoryBuffer class does exactly what we need, *except* that it maps the file in read-only mode. WritableMemoryBuffer reuses the existing machinery for opening and mmapping a file. The only difference is in the argument to the mapped_file_region constructor -- we create a private copy-on-write mapping, so that we can make changes to the mapped data, but the changes aren't carried over to the underlying file. This patch is based on an initial version by Zachary Turner. Reviewers: mehdi_amini, rnk, rafael, dblaikie, zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40291 llvm-svn: 321071
* Re-sort #include lines for unittests. This uses a slightly modifiedChandler Carruth2017-06-061-1/+1
| | | | | | | | | | | | | | | clang-format (https://reviews.llvm.org/D33932) to keep primary headers at the top and handle new utility headers like 'gmock' consistently with other utility headers. No other change was made. I did no manual edits, all of this is clang-format. This should allow other changes to have more clear and focused diffs, and is especially motivated by moving some headers into more focused libraries. llvm-svn: 304786
* Try to fix some temp file leaks in SupportTests, PR18335Reid Kleckner2016-09-021-0/+4
| | | | llvm-svn: 280443
* Remove excess white spaceRafael Espindola2015-11-181-6/+0
| | | | llvm-svn: 253408
* Add MemoryBufferRef(MemoryBuffer&) constructor.Rafael Espindola2015-11-171-0/+9
| | | | | | patch by Jonathan Anderson! llvm-svn: 253311
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-1/+1
| | | | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
* [Support] Add MemoryBuffer::getFileSlice()Nick Kledzik2014-10-081-0/+50
| | | | | | | | | | mach-o supports "fat" files which are a header/table-of-contents followed by a concatenation of mach-o files built for different architectures. Currently, MemoryBuffer has no easy way to map a subrange (slice) of a file which lld will need to select a mach-o slice of a fat file. The new function provides an easy way to map a slice of a file into a MemoryBuffer. Test case included. llvm-svn: 219260
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-7/+8
| | | | llvm-svn: 212405
* Remove the last uses of 'using std::error_code'Rafael Espindola2014-06-131-6/+6
| | | | | | This finishes the transition to std::error_code. llvm-svn: 210877
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* [C++11] Use 'nullptr'.Craig Topper2014-06-081-10/+10
| | | | llvm-svn: 210442
* Use std::unique_ptr instead of OwningPtr in the MemoryBuffer unittests.Craig Topper2014-05-181-2/+1
| | | | llvm-svn: 209102
* [C++11] Add overloads for externally used OwningPtr functions.Ahmed Charles2014-03-051-1/+1
| | | | | | | | This will allow external callers of these functions to switch over time rather than forcing a breaking change all a once. These particular functions were determined by building clang/lld/lldb. llvm-svn: 202959
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-071-1/+1
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
* Change MemoryBuffer::getFile to take a Twine.Rafael Espindola2013-10-251-1/+1
| | | | llvm-svn: 193429
* MemoryBufer: add a test: check that a file with size that is a multiple of theDmitri Gribenko2013-09-041-0/+22
| | | | | | page size can be null terminated correctly by MemoryBuffer. llvm-svn: 189965
* [Win32] mapped_file_region: Fix a bug in CreateFileMapping() that Size must ↵NAKAMURA Takumi2013-08-221-5/+0
| | | | | | contain Offset when Offset >= 65536. llvm-svn: 189021
* Whitespace.NAKAMURA Takumi2013-08-221-1/+1
| | | | llvm-svn: 189020
* Suppress MemoryBufferTest.cpp on win32 for now. Investigating.NAKAMURA Takumi2013-08-221-0/+5
| | | | llvm-svn: 189001
* MemoryBufferTest.cpp: Tweak offset corresponding to the case that PageSize ↵NAKAMURA Takumi2013-08-221-1/+1
| | | | | | | | is greater than 8000. PageSize, aka AllocationGranularity, is 65536 on Win32 (and Cygwin). llvm-svn: 188999
* Refactor the unit test for MemoryBuffer::getOpenFileSliceEli Bendersky2013-07-231-6/+27
| | | | | | | Run in two different modes: with and without reopening the temporary file between creating it and mapping it with MemoryBuffer. llvm-svn: 186986
* Split getOpenFile into getOpenFile and getOpenFileSlice.Rafael Espindola2013-07-231-7/+4
| | | | | | | | | | | | | | | | The main observation is that we never need both the filesize and the map size. When mapping a slice of a file, it doesn't make sense to request a null terminator and that would be the only case where the filesize would be used. There are other cleanups that should be done in this area: * A client should not have to pass the size (even an explicit -1) to say if it wants a null terminator or not, so we should probably swap the argument order. * The default should be to not require a null terminator. Very few clients require this, but many end up asking for it just because it is the default. llvm-svn: 186984
* Add a simple unit test for MemoryBuffer::getOpenFileEli Bendersky2013-07-221-0/+33
| | | | llvm-svn: 186887
* Sort the #include lines for unittest/...Chandler Carruth2012-12-041-1/+0
| | | | llvm-svn: 169250
* Adding MCJIT and MemoryBuffer unit testsAndrew Kaylor2012-10-041-0/+99
Patch by Daniel Malea. llvm-svn: 165246
OpenPOWER on IntegriCloud