[PATCH] D54995: [MemoryBuffer] By default assume that all files are volatile to prevent unintended file locks
Ivan Donchevskii via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 28 00:28:32 PST 2018
yvvan updated this revision to Diff 175635.
yvvan added a comment.
VFS is moved to llvm in 8.0, update the diff
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54995/new/
https://reviews.llvm.org/D54995
Files:
include/llvm/Support/MemoryBuffer.h
include/llvm/Support/VirtualFileSystem.h
lib/Support/VirtualFileSystem.cpp
tools/clang/include/clang/Basic/FileManager.h
Index: lib/Support/VirtualFileSystem.cpp
===================================================================
--- lib/Support/VirtualFileSystem.cpp
+++ lib/Support/VirtualFileSystem.cpp
@@ -193,7 +193,7 @@
ErrorOr<std::unique_ptr<MemoryBuffer>> getBuffer(const Twine &Name,
int64_t FileSize,
bool RequiresNullTerminator,
- bool IsVolatile) override;
+ bool IsVolatile = true) override;
std::error_code close() override;
};
Index: include/llvm/Support/VirtualFileSystem.h
===================================================================
--- include/llvm/Support/VirtualFileSystem.h
+++ include/llvm/Support/VirtualFileSystem.h
@@ -120,7 +120,7 @@
/// Get the contents of the file as a \p MemoryBuffer.
virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
getBuffer(const Twine &Name, int64_t FileSize = -1,
- bool RequiresNullTerminator = true, bool IsVolatile = false) = 0;
+ bool RequiresNullTerminator = true, bool IsVolatile = true) = 0;
/// Closes the file.
virtual std::error_code close() = 0;
@@ -234,7 +234,7 @@
/// closes the file.
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
getBufferForFile(const Twine &Name, int64_t FileSize = -1,
- bool RequiresNullTerminator = true, bool IsVolatile = false);
+ bool RequiresNullTerminator = true, bool IsVolatile = true);
/// Get a directory_iterator for \p Dir.
/// \note The 'end' iterator is directory_iterator().
Index: tools/clang/include/clang/Basic/FileManager.h
===================================================================
--- tools/clang/include/clang/Basic/FileManager.h
+++ tools/clang/include/clang/Basic/FileManager.h
@@ -236,10 +236,10 @@
/// Open the specified file as a MemoryBuffer, returning a new
/// MemoryBuffer if successful, otherwise returning null.
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
- getBufferForFile(const FileEntry *Entry, bool isVolatile = false,
+ getBufferForFile(const FileEntry *Entry, bool isVolatile = true,
bool ShouldCloseOpenFile = true);
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
- getBufferForFile(StringRef Filename, bool isVolatile = false);
+ getBufferForFile(StringRef Filename, bool isVolatile = true);
/// Get the 'stat' information for the given \p Path.
///
Index: include/llvm/Support/MemoryBuffer.h
===================================================================
--- include/llvm/Support/MemoryBuffer.h
+++ include/llvm/Support/MemoryBuffer.h
@@ -79,7 +79,7 @@
/// while the user is editing/updating the file or if the file is on an NFS.
static ErrorOr<std::unique_ptr<MemoryBuffer>>
getFile(const Twine &Filename, int64_t FileSize = -1,
- bool RequiresNullTerminator = true, bool IsVolatile = false);
+ bool RequiresNullTerminator = true, bool IsVolatile = true);
/// Read all of the specified file into a MemoryBuffer as a stream
/// (i.e. until EOF reached). This is useful for special files that
@@ -92,7 +92,7 @@
/// Since this is in the middle of a file, the buffer is not null terminated.
static ErrorOr<std::unique_ptr<MemoryBuffer>>
getOpenFileSlice(int FD, const Twine &Filename, uint64_t MapSize,
- int64_t Offset, bool IsVolatile = false);
+ int64_t Offset, bool IsVolatile = true);
/// Given an already-open file descriptor, read the file and return a
/// MemoryBuffer.
@@ -102,7 +102,7 @@
/// while the user is editing/updating the file or if the file is on an NFS.
static ErrorOr<std::unique_ptr<MemoryBuffer>>
getOpenFile(int FD, const Twine &Filename, uint64_t FileSize,
- bool RequiresNullTerminator = true, bool IsVolatile = false);
+ bool RequiresNullTerminator = true, bool IsVolatile = true);
/// Open the specified memory range as a MemoryBuffer. Note that InputData
/// must be null terminated if RequiresNullTerminator is true.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54995.175635.patch
Type: text/x-patch
Size: 4183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181128/b53a8ad9/attachment-0001.bin>
More information about the cfe-commits
mailing list