mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Avoid memory mapping source files opened by SourceKit.
This commit is contained in:
@@ -884,8 +884,11 @@ SwiftASTManager::Implementation::getMemoryBuffer(
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem,
|
||||
std::string &Error) const {
|
||||
assert(FileSystem);
|
||||
// Avoid memory-mapping as it could prevent the user from
|
||||
// saving the file in the editor.
|
||||
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> FileBufOrErr =
|
||||
FileSystem->getBufferForFile(Filename);
|
||||
FileSystem->getBufferForFile(Filename, /*FileSize*/-1,
|
||||
/*RequiresNullTerminator*/true, /*IsVolatile*/true);
|
||||
if (FileBufOrErr)
|
||||
return std::move(FileBufOrErr.get());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user