summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/MemoryBuffer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* keep only the StringRef version of getFileOrSTDIN.Rafael Espindola2013-06-251-8/+0
| | | | llvm-svn: 184826
* Remove the program class.Rafael Espindola2013-06-121-1/+1
| | | | | | | It was only used to implement ExecuteAndWait and ExecuteNoWait. Expose just those two functions and make Execute and Wait implementations details. llvm-svn: 183864
* Remove the old file memory mapping functions.Rafael Espindola2013-06-121-2/+1
| | | | llvm-svn: 183828
* Put private class into an anonmyous namespace.Benjamin Kramer2013-03-301-0/+2
| | | | llvm-svn: 178420
* [Support] Fix lifetime of file descriptors when using MemoryBuffer.Michael J. Spencer2013-03-141-1/+2
| | | | | | | Clients of MemoryBuffer::getOpenFile expect it not to take ownership of the file descriptor passed in. So don't. llvm-svn: 176995
* [Support][MemoryBuffer] Use sys::fs::mapped_file_region instead of ↵Michael J. Spencer2013-03-121-35/+44
| | | | | | | | sys::Path::MapInFilePages. This gives us memory mapped file I/O on Windows. llvm-svn: 176886
* In llvm::MemoryBuffer::getFile() remove an unnecessary stat call check.Argyrios Kyrtzidis2013-03-011-0/+3
| | | | | | | | | | The sys::fs::is_directory() check is unnecessary because, if the filename is a directory, the function will fail anyway with the same error code returned. Remove the check to avoid an unnecessary stat call. Someone needs to review on windows and see if the check is necessary there or not. llvm-svn: 176386
* Update a portability kludge to keep it in sync with changes in the codeDan Gohman2013-02-191-2/+7
| | | | | | | which uses it. This is not ideal, but it ought to at least restore the behavior to what it was before. llvm-svn: 175571
* Whitelist files and block devices instead of blacklisting fifos andDan Gohman2013-02-191-3/+4
| | | | | | character devices. llvm-svn: 175549
* Don't trust st_size of a character device. This fixes usingDan Gohman2013-02-191-3/+3
| | | | | | | | | | /dev/stdin as an input when stdin is connected to a tty, for example. No test, because it's difficult to write a reasonably portable test for this. /dev/stdin isn't a character device when stdin is redirected from a file or connected to a pipe. llvm-svn: 175542
* Go ahead and get rid of the old page size interface and convert all theChandler Carruth2012-12-311-2/+2
| | | | | | | users over to the new one. No sense maintaining this "compatibility" layer it seems. llvm-svn: 171331
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-3/+3
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* MemoryBuffer: Windows doesn't define S_IFIFO.Daniel Dunbar2012-11-061-1/+4
| | | | llvm-svn: 167467
* MemoryBuffer: Support reading named pipes in getFile().Daniel Dunbar2012-11-051-16/+29
| | | | | | - We only support this when the client didn't claim to know the file size. llvm-svn: 167407
* Add LLVM_OVERRIDE to methods that override their base classes.Craig Topper2012-09-231-5/+5
| | | | llvm-svn: 164471
* In MemoryBuffer::getOpenFile() don't verify that the mmap'edArgyrios Kyrtzidis2012-07-111-10/+0
| | | | | | | | | | | | file buffer is null-terminated. If the file is smaller than we thought, mmap will not allow dereferencing past the pages that are enough to cover the actual file size, even though we asked for a larger address range. rdar://11612916 llvm-svn: 160075
* Remove an "else" that snuck in after a "return" ;)Kaelyn Uhrain2012-06-201-1/+1
| | | | llvm-svn: 158844
* Check that a file is not a directory before reading it into a MemoryBuffer.Kaelyn Uhrain2012-06-201-0/+9
| | | | llvm-svn: 158841
* In MemoryBuffer::getOpenFile() make sure that the buffer is null-terminated ifArgyrios Kyrtzidis2012-04-051-0/+11
| | | | | | | | | | | | | the caller requested a null-terminated one. When mapping the file there could be a racing issue that resulted in the file being larger than the FileSize passed by the caller. We already have an assertion for this in MemoryBuffer::init() but have a runtime guarantee that the buffer will be null-terminated, so do a copy that adds a null-terminator. Protects against crash of rdar://11161822. llvm-svn: 154082
* Add a sanity check in MemoryBuffer::getOpenFile() to make sure we don't hangArgyrios Kyrtzidis2012-03-131-1/+5
| | | | | | | | if the passed in FileSize is inaccurate. rdar://11034179 llvm-svn: 152662
* Change default error_code ctor to a 'named ctor' so it's more self-documenting.David Blaikie2012-02-091-5/+3
| | | | | | | | | | | Unify default construction of error_code uses on this idiom so that users don't feel compelled to make static globals for naming convenience. (unfortunately I couldn't make the original ctor private as some APIs don't return their result, instead using an out parameter (that makes sense to default construct) - which is a bit of a pity. I did, however, find/fix some cases of unnecessary default construction of error_code before I hit the unfixable cases) llvm-svn: 150197
* Add configure checking for pread(2) and use it to save a syscall when ↵Benjamin Kramer2011-11-221-0/+7
| | | | | | reading files. llvm-svn: 145061
* Turn error recovery into an assert.Benjamin Kramer2011-11-221-6/+1
| | | | | | | This was put in because in a certain version of DragonFlyBSD stat(2) lied about the size of some files. This was fixed a long time ago so we can remove the workaround. llvm-svn: 145059
* Remove unused include of sys/uio.h in MemoryBuffer.cpp. It was not correctly ↵David Meyer2011-10-201-1/+0
| | | | | | protected by ifdef either. llvm-svn: 142623
* use 64-bit types instead of off_t/size_t to avoid the issue whenIvan Krasin2011-09-151-4/+4
| | | | | | | | gold plugin is built with Large File Support (sizeof(off_t) == 64 on i686) and the rest of LLVM is built w/o Large File Support (sizeof(off_t) == 32 on i686) which corrupts the stack. llvm-svn: 139873
* random comment cleanups.Chris Lattner2011-05-221-4/+4
| | | | llvm-svn: 131829
* Add MemoryBuffer::getBufferKind() to report whether a memory buffer uses ↵Ted Kremenek2011-04-281-0/+8
| | | | | | malloc'ed or mmap'ed memory. This is for performance analysis. llvm-svn: 130432
* We don't need a null terminator for the output file.Rafael Espindola2011-03-221-4/+8
| | | | llvm-svn: 128098
* Check RequiresNullTerminator first, or we might read from an invalid address.Rafael Espindola2011-03-181-1/+1
| | | | llvm-svn: 127853
* Use RequiresNullTerminator to create buffers without a null terminatorRafael Espindola2011-03-171-2/+4
| | | | | | instead of copying. llvm-svn: 127835
* Don't compute the file size if we don't need to.Rafael Espindola2011-03-101-14/+29
| | | | llvm-svn: 127426
* Add r127409 back now that the windows file was updated.Rafael Espindola2011-03-101-25/+74
| | | | llvm-svn: 127417
* Revert r127409 which broke all the Windows bots.Jakob Stoklund Olesen2011-03-101-74/+25
| | | | llvm-svn: 127413
* Add support for MemoryBuffers that are not null terminated and addRafael Espindola2011-03-101-25/+74
| | | | | | support for creating buffers that cover only a part of a file. llvm-svn: 127409
* Don't open the file again in the gold plugin. To be able to do this, updateRafael Espindola2011-02-081-12/+3
| | | | | | MemoryBuffer::getOpenFile to not close the file descriptor. llvm-svn: 125128
* Add missing standard headers. Patch by Joerg Sonnenberger!Nick Lewycky2010-12-191-0/+1
| | | | llvm-svn: 122193
* MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> ↵Michael J. Spencer2010-12-161-34/+38
| | | | | | via an out parm. llvm-svn: 121958
* Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with ↵Michael J. Spencer2010-12-091-18/+20
| | | | | | error_code &ec. And fix clients. llvm-svn: 121379
* Merge System into Support.Michael J. Spencer2010-11-291-9/+9
| | | | llvm-svn: 120298
* add a MemoryBuffer::getOpenFile method, which turns an openChris Lattner2010-11-231-0/+7
| | | | | | file descriptor into a MemoryBuffer (and closes the FD). llvm-svn: 120065
* Revert functionality doug added in r98575 that was neverChris Lattner2010-11-231-15/+11
| | | | | | documented and only used by some clang stuff I just removed. llvm-svn: 120002
* Rewrite MemoryBuffer::getSTDIN to use read(2) and a SmallVector buffer.Benjamin Kramer2010-06-251-15/+15
| | | | llvm-svn: 106856
* Bring back the empty vector workaround I removed in r106839. Looks like MSVC ↵Benjamin Kramer2010-06-251-1/+2
| | | | | | needs it. llvm-svn: 106841
* Tweak MemoryBuffer to allocate the class itself, the name and possibly theBenjamin Kramer2010-06-251-70/+60
| | | | | | | | | | buffer in the same chunk of memory. 2 less mallocs for every uninitialized MemoryBuffer and 1 less malloc for every MemoryBuffer pointing to a memory range translate into 20% less mallocs on clang -cc1 -Eonly Cocoa_h.m. llvm-svn: 106839
* Add overloads for getFile and getFileOrSTDIN which take a const char *Dan Gohman2010-06-241-3/+17
| | | | | | | instead of a StringRef, avoiding the need to copy the string in the common case. llvm-svn: 106754
* Add an explicit keyword.Dan Gohman2010-06-221-1/+1
| | | | llvm-svn: 106538
* Add basic error checking to MemoryBuffer::getSTDIN.Dan Gohman2010-05-271-2/+7
| | | | llvm-svn: 104855
* stringref-ize the MemoryBuffer::get apis. This requiresChris Lattner2010-04-051-11/+8
| | | | | | a co-committed clang patch. llvm-svn: 100485
* Remove accidental include and add a comment.Benjamin Kramer2010-04-011-2/+2
| | | | llvm-svn: 100107
* Various improvements to MemoryBuffer::getFile:Benjamin Kramer2010-04-011-17/+26
| | | | | | | | | | - Use a RAII object to close the FD. - Use sys::StrError instead of thread-unsafe strerror calls. - Recover gracefully if read returns zero. This works around an issue on DragonFlyBSD where /dev/null has an st_size of 136 but we can't read 136 bytes from it. llvm-svn: 100106
OpenPOWER on IntegriCloud