summaryrefslogtreecommitdiffstats
path: root/unittests/Support/MemoryBufferTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321257 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321071 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304786 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to fix some temp file leaks in SupportTests, PR18335Reid Kleckner2016-09-021-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280443 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove excess white spaceRafael Espindola2015-11-181-6/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253408 91177308-0d34-0410-b5e6-96231b3b80d8
* Add MemoryBufferRef(MemoryBuffer&) constructor.Rafael Espindola2015-11-171-0/+9
| | | | | | patch by Jonathan Anderson! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253311 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234679 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219260 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-7/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212405 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the last uses of 'using std::error_code'Rafael Espindola2014-06-131-6/+6
| | | | | | This finishes the transition to std::error_code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210877 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210835 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'.Craig Topper2014-06-081-10/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210442 91177308-0d34-0410-b5e6-96231b3b80d8
* Use std::unique_ptr instead of OwningPtr in the MemoryBuffer unittests.Craig Topper2014-05-181-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209102 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202959 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198685 91177308-0d34-0410-b5e6-96231b3b80d8
* Change MemoryBuffer::getFile to take a Twine.Rafael Espindola2013-10-251-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193429 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189965 91177308-0d34-0410-b5e6-96231b3b80d8
* [Win32] mapped_file_region: Fix a bug in CreateFileMapping() that Size must ↵NAKAMURA Takumi2013-08-221-5/+0
| | | | | | contain Offset when Offset >= 65536. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189021 91177308-0d34-0410-b5e6-96231b3b80d8
* Whitespace.NAKAMURA Takumi2013-08-221-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189020 91177308-0d34-0410-b5e6-96231b3b80d8
* Suppress MemoryBufferTest.cpp on win32 for now. Investigating.NAKAMURA Takumi2013-08-221-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189001 91177308-0d34-0410-b5e6-96231b3b80d8
* 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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188999 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186986 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186984 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a simple unit test for MemoryBuffer::getOpenFileEli Bendersky2013-07-221-0/+33
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186887 91177308-0d34-0410-b5e6-96231b3b80d8
* Sort the #include lines for unittest/...Chandler Carruth2012-12-041-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169250 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding MCJIT and MemoryBuffer unit testsAndrew Kaylor2012-10-041-0/+99
Patch by Daniel Malea. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165246 91177308-0d34-0410-b5e6-96231b3b80d8