diff options
Diffstat (limited to 'lldb/source/Host/common/FileSystem.cpp')
| -rw-r--r-- | lldb/source/Host/common/FileSystem.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp index 9fa8854d950e..a2c3b3556a6c 100644 --- a/lldb/source/Host/common/FileSystem.cpp +++ b/lldb/source/Host/common/FileSystem.cpp @@ -19,11 +19,11 @@ #include "llvm/Support/Program.h" #include "llvm/Support/Threading.h" -#include <errno.h> +#include <cerrno> +#include <climits> +#include <cstdarg> +#include <cstdio> #include <fcntl.h> -#include <limits.h> -#include <stdarg.h> -#include <stdio.h> #ifdef _WIN32 #include "lldb/Host/windows/windows.h" @@ -307,7 +307,7 @@ FileSystem::CreateDataBuffer(const llvm::Twine &path, uint64_t size, std::unique_ptr<llvm::WritableMemoryBuffer> buffer; if (size == 0) { auto buffer_or_error = - llvm::WritableMemoryBuffer::getFile(*external_path, -1, is_volatile); + llvm::WritableMemoryBuffer::getFile(*external_path, is_volatile); if (!buffer_or_error) return nullptr; buffer = std::move(*buffer_or_error); @@ -478,20 +478,18 @@ ErrorOr<std::string> FileSystem::GetExternalPath(const llvm::Twine &path) { return path.str(); // If VFS mapped we know the underlying FS is a RedirectingFileSystem. - ErrorOr<vfs::RedirectingFileSystem::Entry *> E = + ErrorOr<vfs::RedirectingFileSystem::LookupResult> Result = static_cast<vfs::RedirectingFileSystem &>(*m_fs).lookupPath(path.str()); - if (!E) { - if (E.getError() == llvm::errc::no_such_file_or_directory) { + if (!Result) { + if (Result.getError() == llvm::errc::no_such_file_or_directory) { return path.str(); } - return E.getError(); + return Result.getError(); } - auto *F = dyn_cast<vfs::RedirectingFileSystem::RedirectingFileEntry>(*E); - if (!F) - return make_error_code(llvm::errc::not_supported); - - return F->getExternalContentsPath().str(); + if (Optional<StringRef> ExtRedirect = Result->getExternalRedirect()) + return std::string(*ExtRedirect); + return make_error_code(llvm::errc::not_supported); } ErrorOr<std::string> FileSystem::GetExternalPath(const FileSpec &file_spec) { |
