Index: include/lldb/Utility/FileSpec.h =================================================================== --- include/lldb/Utility/FileSpec.h +++ include/lldb/Utility/FileSpec.h @@ -280,15 +280,6 @@ //------------------------------------------------------------------ bool Exists() const; - //------------------------------------------------------------------ - /// Check if a file is readable by the current user - /// - /// @return - /// \b true if the file exists on disk and is readable, \b false - /// otherwise. - //------------------------------------------------------------------ - bool Readable() const; - //------------------------------------------------------------------ /// Expanded existence test. /// @@ -450,19 +441,6 @@ //------------------------------------------------------------------ ConstString GetFileNameStrippingExtension() const; - //------------------------------------------------------------------ - /// Return the current permissions of the path. - /// - /// Returns a bitmask for the current permissions of the file ( zero or more - /// of the permission bits defined in File::Permissions). - /// - /// @return - /// Zero if the file doesn't exist or we are unable to get - /// information for the file, otherwise one or more permission - /// bits from the File::Permissions enumeration. - //------------------------------------------------------------------ - uint32_t GetPermissions() const; - //------------------------------------------------------------------ /// Get the memory cost of this object. /// Index: source/API/SBPlatform.cpp =================================================================== --- source/API/SBPlatform.cpp +++ source/API/SBPlatform.cpp @@ -364,7 +364,7 @@ SBError SBPlatform::Put(SBFileSpec &src, SBFileSpec &dst) { return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) { if (src.Exists()) { - uint32_t permissions = src.ref().GetPermissions(); + uint32_t permissions = FileSystem::Instance().GetPermissions(src.ref()); if (permissions == 0) { if (llvm::sys::fs::is_directory(src.ref().GetPath())) permissions = eFilePermissionsDirectoryDefault; Index: source/Commands/CommandObjectTarget.cpp =================================================================== --- source/Commands/CommandObjectTarget.cpp +++ source/Commands/CommandObjectTarget.cpp @@ -280,7 +280,7 @@ result.SetStatus(eReturnStatusFailed); return false; } - if (!core_file.Readable()) { + if (!FileSystem::Instance().Readable(core_file)) { result.AppendErrorWithFormat("core file '%s' is not readable", core_file.GetPath().c_str()); result.SetStatus(eReturnStatusFailed); @@ -292,7 +292,7 @@ FileSpec symfile(m_symbol_file.GetOptionValue().GetCurrentValue()); if (symfile) { if (symfile.Exists()) { - if (!symfile.Readable()) { + if (!FileSystem::Instance().Readable(symfile)) { result.AppendErrorWithFormat("symbol file '%s' is not readable", symfile.GetPath().c_str()); result.SetStatus(eReturnStatusFailed); @@ -405,7 +405,7 @@ char core_path[PATH_MAX]; core_file.GetPath(core_path, sizeof(core_path)); if (core_file.Exists()) { - if (!core_file.Readable()) { + if (!FileSystem::Instance().Readable(core_file)) { result.AppendMessageWithFormat( "Core file '%s' is not readable.\n", core_path); result.SetStatus(eReturnStatusFailed); Index: source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp =================================================================== --- source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -2536,7 +2536,7 @@ return false; } - if (!file.Readable()) { + if (!FileSystem::Instance().Readable(file)) { strm.Printf("Error: File %s does not have readable permissions", path); strm.EOL(); return false; Index: source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp +++ source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp @@ -228,7 +228,7 @@ } if (error.Fail() || !exe_module_sp) { - if (resolved_module_spec.GetFileSpec().Readable()) { + if (FileSystem::Instance().Readable(resolved_module_spec.GetFileSpec())) { error.SetErrorStringWithFormat( "'%s' doesn't contain any '%s' platform architectures: %s", resolved_module_spec.GetFileSpec().GetPath().c_str(), Index: source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp +++ source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp @@ -228,7 +228,7 @@ } if (error.Fail() || !exe_module_sp) { - if (resolved_module_spec.GetFileSpec().Readable()) { + if (FileSystem::Instance().Readable(resolved_module_spec.GetFileSpec())) { error.SetErrorStringWithFormat( "'%s' doesn't contain any '%s' platform architectures: %s", resolved_module_spec.GetFileSpec().GetPath().c_str(), Index: source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -119,7 +119,7 @@ } if (error.Fail() || !exe_module_sp) { - if (resolved_module_spec.GetFileSpec().Readable()) { + if (FileSystem::Instance().Readable(resolved_module_spec.GetFileSpec())) { error.SetErrorStringWithFormat( "'%s' doesn't contain any '%s' platform architectures: %s", resolved_module_spec.GetFileSpec().GetPath().c_str(), Index: source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -234,7 +234,7 @@ } if (error.Fail() || !exe_module_sp) { - if (resolved_module_spec.GetFileSpec().Readable()) { + if (FileSystem::Instance().Readable(resolved_module_spec.GetFileSpec())) { error.SetErrorStringWithFormat( "'%s' doesn't contain any '%s' platform architectures: %s", resolved_module_spec.GetFileSpec().GetPath().c_str(), Index: source/Plugins/Platform/POSIX/PlatformPOSIX.cpp =================================================================== --- source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -143,8 +143,8 @@ if (resolved_module_spec.GetFileSpec().Exists()) error.Clear(); else { - const uint32_t permissions = - resolved_module_spec.GetFileSpec().GetPermissions(); + const uint32_t permissions = FileSystem::Instance().GetPermissions( + resolved_module_spec.GetFileSpec()); if (permissions && (permissions & eFilePermissionsEveryoneR) == 0) error.SetErrorStringWithFormat( "executable '%s' is not readable", @@ -237,7 +237,8 @@ } if (error.Fail() || !exe_module_sp) { - if (resolved_module_spec.GetFileSpec().Readable()) { + if (FileSystem::Instance().Readable( + resolved_module_spec.GetFileSpec())) { error.SetErrorStringWithFormat( "'%s' doesn't contain any '%s' platform architectures: %s", resolved_module_spec.GetFileSpec().GetPath().c_str(), Index: source/Plugins/Platform/Windows/PlatformWindows.cpp =================================================================== --- source/Plugins/Platform/Windows/PlatformWindows.cpp +++ source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -262,7 +262,8 @@ } if (error.Fail() || !exe_module_sp) { - if (resolved_module_spec.GetFileSpec().Readable()) { + if (FileSystem::Instance().Readable( + resolved_module_spec.GetFileSpec())) { error.SetErrorStringWithFormat( "'%s' doesn't contain any '%s' platform architectures: %s", resolved_module_spec.GetFileSpec().GetPath().c_str(), Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp =================================================================== --- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -142,7 +142,7 @@ } if (error.Fail() || !exe_module_sp) { - if (resolved_module_spec.GetFileSpec().Readable()) { + if (FileSystem::Instance().Readable(resolved_module_spec.GetFileSpec())) { error.SetErrorStringWithFormat( "'%s' doesn't contain any '%s' platform architectures: %s", resolved_module_spec.GetFileSpec().GetPath().c_str(), Index: source/Target/Platform.cpp =================================================================== --- source/Target/Platform.cpp +++ source/Target/Platform.cpp @@ -709,7 +709,7 @@ switch (fs::get_file_type(src.GetPath(), false)) { case fs::file_type::directory_file: { llvm::sys::fs::remove(fixed_dst.GetPath()); - uint32_t permissions = src.GetPermissions(); + uint32_t permissions = FileSystem::Instance().GetPermissions(src); if (permissions == 0) permissions = eFilePermissionsDirectoryDefault; error = MakeDirectory(fixed_dst, permissions); Index: source/Utility/FileSpec.cpp =================================================================== --- source/Utility/FileSpec.cpp +++ source/Utility/FileSpec.cpp @@ -458,10 +458,6 @@ //------------------------------------------------------------------ bool FileSpec::Exists() const { return llvm::sys::fs::exists(GetPath()); } -bool FileSpec::Readable() const { - return GetPermissions() & llvm::sys::fs::perms::all_read; -} - bool FileSpec::ResolveExecutableLocation() { // CLEANUP: Use StringRef for string handling. if (!m_directory) { @@ -509,15 +505,6 @@ FileSpec::Style FileSpec::GetPathStyle() const { return m_style; } -uint32_t FileSpec::GetPermissions() const { - namespace fs = llvm::sys::fs; - fs::file_status st; - if (fs::status(GetPath(), st, false)) - return fs::perms::perms_not_known; - - return st.permissions(); -} - //------------------------------------------------------------------ // Directory string get accessor. //------------------------------------------------------------------