diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-05-05 21:55:51 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-05-05 21:55:51 +0000 |
| commit | 20a92ae3d2110ea6acbd9bbb3e9ecd2064bc34b5 (patch) | |
| tree | b3362bad6caf151aabe22ac31c29c50d006cf616 /llvm/include | |
| parent | eb0bf5af656b896cefe4ce54a3fa783d4f556cc3 (diff) | |
| download | bcm5719-llvm-20a92ae3d2110ea6acbd9bbb3e9ecd2064bc34b5.tar.gz bcm5719-llvm-20a92ae3d2110ea6acbd9bbb3e9ecd2064bc34b5.zip | |
[Support/MemoryBuffer] Introduce a boolean parameter (false by default) 'IsVolatile' for the open file functions.
This provides a hint that the file may be changing often so mmap is avoided.
llvm-svn: 208007
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/Support/MemoryBuffer.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/llvm/include/llvm/Support/MemoryBuffer.h b/llvm/include/llvm/Support/MemoryBuffer.h index 578c7e8eb88..268041e781d 100644 --- a/llvm/include/llvm/Support/MemoryBuffer.h +++ b/llvm/include/llvm/Support/MemoryBuffer.h @@ -67,34 +67,46 @@ public: /// MemoryBuffer if successful, otherwise returning null. If FileSize is /// specified, this means that the client knows that the file exists and that /// it has the specified size. + /// + /// \param IsVolatile true indicates that the file may be changing often. static error_code getFile(Twine Filename, OwningPtr<MemoryBuffer> &Result, int64_t FileSize = -1, - bool RequiresNullTerminator = true); + bool RequiresNullTerminator = true, + bool IsVolatile = false); static error_code getFile(Twine Filename, std::unique_ptr<MemoryBuffer> &Result, int64_t FileSize = -1, - bool RequiresNullTerminator = true); + bool RequiresNullTerminator = true, + bool IsVolatile = false); /// Given an already-open file descriptor, map some slice of it into a /// MemoryBuffer. The slice is specified by an \p Offset and \p MapSize. /// Since this is in the middle of a file, the buffer is not null terminated. + /// + /// \param IsVolatile true indicates that the file may be changing often. static error_code getOpenFileSlice(int FD, const char *Filename, OwningPtr<MemoryBuffer> &Result, - uint64_t MapSize, int64_t Offset); + uint64_t MapSize, int64_t Offset, + bool IsVolatile = false); static error_code getOpenFileSlice(int FD, const char *Filename, std::unique_ptr<MemoryBuffer> &Result, - uint64_t MapSize, int64_t Offset); + uint64_t MapSize, int64_t Offset, + bool IsVolatile = false); /// Given an already-open file descriptor, read the file and return a /// MemoryBuffer. + /// + /// \param IsVolatile true indicates that the file may be changing often. static error_code getOpenFile(int FD, const char *Filename, OwningPtr<MemoryBuffer> &Result, uint64_t FileSize, - bool RequiresNullTerminator = true); + bool RequiresNullTerminator = true, + bool IsVolatile = false); static error_code getOpenFile(int FD, const char *Filename, std::unique_ptr<MemoryBuffer> &Result, uint64_t FileSize, - bool RequiresNullTerminator = true); + bool RequiresNullTerminator = true, + bool IsVolatile = false); /// getMemBuffer - Open the specified memory range as a MemoryBuffer. Note /// that InputData must be null terminated if RequiresNullTerminator is true. |

