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> 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> 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> 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. 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> 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> 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: lib/Support/VirtualFileSystem.cpp =================================================================== --- lib/Support/VirtualFileSystem.cpp +++ lib/Support/VirtualFileSystem.cpp @@ -193,7 +193,7 @@ ErrorOr> getBuffer(const Twine &Name, int64_t FileSize, bool RequiresNullTerminator, - bool IsVolatile) override; + bool IsVolatile = true) override; std::error_code close() override; }; 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> - getBufferForFile(const FileEntry *Entry, bool isVolatile = false, + getBufferForFile(const FileEntry *Entry, bool isVolatile = true, bool ShouldCloseOpenFile = true); llvm::ErrorOr> - getBufferForFile(StringRef Filename, bool isVolatile = false); + getBufferForFile(StringRef Filename, bool isVolatile = true); /// Get the 'stat' information for the given \p Path. ///