Author: jdevlieghere Date: Thu Nov 1 10:09:25 2018 New Revision: 345854 URL: http://llvm.org/viewvc/llvm-project?rev=345854&view=rev Log: [FileSystem] Remove Exists() from FileSpec
This patch removes the Exists method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53845 Modified: lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Commands/CommandObjectPlatform.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Core/DynamicLoader.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Core/PluginManager.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Host/common/HostInfoBase.cpp lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Host/macosx/Symbols.cpp lldb/trunk/source/Host/macosx/objcxx/Host.mm lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Target/ModuleCache.cpp lldb/trunk/source/Target/PathMappingList.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/TargetList.cpp lldb/trunk/source/Utility/FileSpec.cpp lldb/trunk/source/Utility/StructuredData.cpp lldb/trunk/unittests/Target/ModuleCacheTest.cpp Modified: lldb/trunk/include/lldb/Utility/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/include/lldb/Utility/FileSpec.h (original) +++ lldb/trunk/include/lldb/Utility/FileSpec.h Thu Nov 1 10:09:25 2018 @@ -273,14 +273,6 @@ public: void Dump(Stream *s) const; //------------------------------------------------------------------ - /// Existence test. - /// - /// @return - /// \b true if the file exists on disk, \b false otherwise. - //------------------------------------------------------------------ - bool Exists() const; - - //------------------------------------------------------------------ /// Canonicalize this file path (basically running the static /// FileSpec::Resolve method on it). Useful if you asked us not to resolve /// the file path when you set the file. Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Thu Nov 1 10:09:25 2018 @@ -90,7 +90,7 @@ static llvm::sys::DynamicLibrary LoadPlu "lldb::PluginInitialize(lldb::SBDebugger)"); } } else { - if (spec.Exists()) + if (FileSystem::Instance().Exists(spec)) error.SetErrorString("this file does not represent a loadable dylib"); else error.SetErrorString("no such file"); Modified: lldb/trunk/source/API/SBFileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/API/SBFileSpec.cpp (original) +++ lldb/trunk/source/API/SBFileSpec.cpp Thu Nov 1 10:09:25 2018 @@ -51,7 +51,7 @@ bool SBFileSpec::IsValid() const { retur bool SBFileSpec::Exists() const { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); - bool result = m_opaque_ap->Exists(); + bool result = FileSystem::Instance().Exists(*m_opaque_ap); if (log) log->Printf("SBFileSpec(%p)::Exists () => %s", Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Thu Nov 1 10:09:25 2018 @@ -1210,7 +1210,7 @@ public: switch (short_option) { case 'i': m_infile.SetFile(option_value, true, FileSpec::Style::native); - if (!m_infile.Exists()) { + if (!FileSystem::Instance().Exists(m_infile)) { m_infile.Clear(); error.SetErrorStringWithFormat("input file does not exist: '%s'", option_value.str().c_str()); Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Thu Nov 1 10:09:25 2018 @@ -1818,7 +1818,7 @@ public: // TODO: move the bulk of this code over to the platform itself FileSpec src(args.GetArgumentAtIndex(0), true); FileSpec dst(args.GetArgumentAtIndex(1), false); - if (!src.Exists()) { + if (!FileSystem::Instance().Exists(src)) { result.AppendError("source location does not exist or is not accessible"); result.SetStatus(eReturnStatusFailed); return false; Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Nov 1 10:09:25 2018 @@ -274,7 +274,7 @@ protected: FileSpec remote_file(m_remote_file.GetOptionValue().GetCurrentValue()); if (core_file) { - if (!core_file.Exists()) { + if (!FileSystem::Instance().Exists(core_file)) { result.AppendErrorWithFormat("core file '%s' doesn't exist", core_file.GetPath().c_str()); result.SetStatus(eReturnStatusFailed); @@ -291,7 +291,7 @@ protected: if (argc == 1 || core_file || remote_file) { FileSpec symfile(m_symbol_file.GetOptionValue().GetCurrentValue()); if (symfile) { - if (symfile.Exists()) { + if (FileSystem::Instance().Exists(symfile)) { if (!FileSystem::Instance().Readable(symfile)) { result.AppendErrorWithFormat("symbol file '%s' is not readable", symfile.GetPath().c_str()); @@ -336,7 +336,7 @@ protected: if (remote_file) { if (platform_sp) { // I have a remote file.. two possible cases - if (file_spec && file_spec.Exists()) { + if (file_spec && FileSystem::Instance().Exists(file_spec)) { // if the remote file does not exist, push it there if (!platform_sp->GetFileExists(remote_file)) { Status err = platform_sp->PutFile(file_spec, remote_file); @@ -404,7 +404,7 @@ protected: if (core_file) { char core_path[PATH_MAX]; core_file.GetPath(core_path, sizeof(core_path)); - if (core_file.Exists()) { + if (FileSystem::Instance().Exists(core_file)) { if (!FileSystem::Instance().Readable(core_file)) { result.AppendMessageWithFormat( "Core file '%s' is not readable.\n", core_path); @@ -2533,7 +2533,7 @@ protected: continue; FileSpec file_spec(entry.ref, true); - if (file_spec.Exists()) { + if (FileSystem::Instance().Exists(file_spec)) { ModuleSpec module_spec(file_spec); if (m_uuid_option_group.GetOptionValue().OptionWasSet()) module_spec.GetUUID() = @@ -4255,7 +4255,8 @@ protected: ModuleSP frame_module_sp( frame->GetSymbolContext(eSymbolContextModule).module_sp); if (frame_module_sp) { - if (frame_module_sp->GetPlatformFileSpec().Exists()) { + if (FileSystem::Instance().Exists( + frame_module_sp->GetPlatformFileSpec())) { module_spec.GetArchitecture() = frame_module_sp->GetArchitecture(); module_spec.GetFileSpec() = @@ -4302,7 +4303,7 @@ protected: module_spec.GetArchitecture() = target->GetArchitecture(); } success |= module_spec.GetUUID().IsValid() || - module_spec.GetFileSpec().Exists(); + FileSystem::Instance().Exists(module_spec.GetFileSpec()); } } @@ -4362,7 +4363,8 @@ protected: } ArchSpec arch; - bool symfile_exists = module_spec.GetSymbolFileSpec().Exists(); + bool symfile_exists = + FileSystem::Instance().Exists(module_spec.GetSymbolFileSpec()); if (symfile_exists) { if (!AddModuleSymbols(target, module_spec, flush, result)) Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Thu Nov 1 10:09:25 2018 @@ -656,7 +656,8 @@ void Debugger::InstanceInitialize() { const bool find_other = true; char dir_path[PATH_MAX]; if (FileSpec dir_spec = HostInfo::GetSystemPluginDir()) { - if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path))) { + if (FileSystem::Instance().Exists(dir_spec) && + dir_spec.GetPath(dir_path, sizeof(dir_path))) { FileSystem::Instance().EnumerateDirectory(dir_path, find_directories, find_files, find_other, LoadPluginCallback, this); @@ -664,7 +665,8 @@ void Debugger::InstanceInitialize() { } if (FileSpec dir_spec = HostInfo::GetUserPluginDir()) { - if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path))) { + if (FileSystem::Instance().Exists(dir_spec) && + dir_spec.GetPath(dir_path, sizeof(dir_path))) { FileSystem::Instance().EnumerateDirectory(dir_path, find_directories, find_files, find_other, LoadPluginCallback, this); Modified: lldb/trunk/source/Core/DynamicLoader.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DynamicLoader.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Core/DynamicLoader.cpp (original) +++ lldb/trunk/source/Core/DynamicLoader.cpp Thu Nov 1 10:09:25 2018 @@ -81,7 +81,7 @@ ModuleSP DynamicLoader::GetTargetExecuta ModuleSP executable = target.GetExecutableModule(); if (executable) { - if (executable->GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(executable->GetFileSpec())) { ModuleSpec module_spec(executable->GetFileSpec(), executable->GetArchitecture()); auto module_sp = std::make_shared<Module>(module_spec); Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Thu Nov 1 10:09:25 2018 @@ -1418,7 +1418,7 @@ void Module::PreloadSymbols() { } void Module::SetSymbolFileFileSpec(const FileSpec &file) { - if (!file.Exists()) + if (!FileSystem::Instance().Exists(file)) return; if (m_symfile_ap) { // Remove any sections in the unified section list that come from the @@ -1537,7 +1537,8 @@ bool Module::LoadScriptingResourceInTarg if (script_interpreter) { for (uint32_t i = 0; i < num_specs; ++i) { FileSpec scripting_fspec(file_specs.GetFileSpecAtIndex(i)); - if (scripting_fspec && scripting_fspec.Exists()) { + if (scripting_fspec && + FileSystem::Instance().Exists(scripting_fspec)) { if (should_load == eLoadScriptFromSymFileWarn) { if (feedback_stream) feedback_stream->Printf( Modified: lldb/trunk/source/Core/ModuleList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Core/ModuleList.cpp (original) +++ lldb/trunk/source/Core/ModuleList.cpp Thu Nov 1 10:09:25 2018 @@ -864,7 +864,7 @@ Status ModuleList::GetSharedModule(const continue; search_path_spec.AppendPathComponent( module_spec.GetFileSpec().GetFilename().AsCString()); - if (!search_path_spec.Exists()) + if (!FileSystem::Instance().Exists(search_path_spec)) continue; auto resolved_module_spec(module_spec); @@ -905,13 +905,15 @@ Status ModuleList::GetSharedModule(const // Don't look for the file if it appears to be the same one we already // checked for above... if (located_binary_modulespec.GetFileSpec() != module_file_spec) { - if (!located_binary_modulespec.GetFileSpec().Exists()) { + if (!FileSystem::Instance().Exists( + located_binary_modulespec.GetFileSpec())) { located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path)); if (path[0] == '\0') module_file_spec.GetPath(path, sizeof(path)); // How can this check ever be true? This branch it is false, and we // haven't modified file_spec. - if (located_binary_modulespec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists( + located_binary_modulespec.GetFileSpec())) { std::string uuid_str; if (uuid_ptr && uuid_ptr->IsValid()) uuid_str = uuid_ptr->GetAsString(); Modified: lldb/trunk/source/Core/PluginManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/PluginManager.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Core/PluginManager.cpp (original) +++ lldb/trunk/source/Core/PluginManager.cpp Thu Nov 1 10:09:25 2018 @@ -163,7 +163,8 @@ void PluginManager::Initialize() { const bool find_other = true; char dir_path[PATH_MAX]; if (FileSpec dir_spec = HostInfo::GetSystemPluginDir()) { - if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path))) { + if (FileSystem::Instance().Exists(dir_spec) && + dir_spec.GetPath(dir_path, sizeof(dir_path))) { FileSystem::Instance().EnumerateDirectory(dir_path, find_directories, find_files, find_other, LoadPluginCallback, nullptr); @@ -171,7 +172,8 @@ void PluginManager::Initialize() { } if (FileSpec dir_spec = HostInfo::GetUserPluginDir()) { - if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path))) { + if (FileSystem::Instance().Exists(dir_spec) && + dir_spec.GetPath(dir_path, sizeof(dir_path))) { FileSystem::Instance().EnumerateDirectory(dir_path, find_directories, find_files, find_other, LoadPluginCallback, nullptr); Modified: lldb/trunk/source/Core/SourceManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SourceManager.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Core/SourceManager.cpp (original) +++ lldb/trunk/source/Core/SourceManager.cpp Thu Nov 1 10:09:25 2018 @@ -92,7 +92,7 @@ SourceManager::FileSP SourceManager::Get file_sp->UpdateIfNeeded(); // If file_sp is no good or it points to a non-existent file, reset it. - if (!file_sp || !file_sp->GetFileSpec().Exists()) { + if (!file_sp || !FileSystem::Instance().Exists(file_sp->GetFileSpec())) { if (target_sp) file_sp = std::make_shared<File>(file_spec, target_sp.get()); else @@ -427,7 +427,7 @@ void SourceManager::File::CommonInitiali } } // Try remapping if m_file_spec does not correspond to an existing file. - if (!m_file_spec.Exists()) { + if (!FileSystem::Instance().Exists(m_file_spec)) { FileSpec new_file_spec; // Check target specific source remappings first, then fall back to // modules objects can have individual path remappings that were Modified: lldb/trunk/source/Host/common/HostInfoBase.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostInfoBase.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Host/common/HostInfoBase.cpp (original) +++ lldb/trunk/source/Host/common/HostInfoBase.cpp Thu Nov 1 10:09:25 2018 @@ -42,7 +42,7 @@ namespace { struct HostInfoBaseFields { ~HostInfoBaseFields() { - if (m_lldb_process_tmp_dir.Exists()) { + if (FileSystem::Instance().Exists(m_lldb_process_tmp_dir)) { // Remove the LLDB temporary directory if we have one. Set "recurse" to // true to all files that were created for the LLDB process can be // cleaned up. Modified: lldb/trunk/source/Host/common/Symbols.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Symbols.cpp (original) +++ lldb/trunk/source/Host/common/Symbols.cpp Thu Nov 1 10:09:25 2018 @@ -85,17 +85,16 @@ static bool LookForDsymNextToExecutableP dsym_directory.AppendPathComponent("Contents"); dsym_directory.AppendPathComponent("Resources"); dsym_directory.AppendPathComponent("DWARF"); - - if (dsym_directory.Exists()) { + + if (FileSystem::Instance().Exists(dsym_directory)) { // See if the binary name exists in the dSYM DWARF // subdir. dsym_fspec = dsym_directory; dsym_fspec.AppendPathComponent(filename.AsCString()); - if (dsym_fspec.Exists() - && FileAtPathContainsArchAndUUID(dsym_fspec, - mod_spec.GetArchitecturePtr(), - mod_spec.GetUUIDPtr())) { + if (FileSystem::Instance().Exists(dsym_fspec) && + FileAtPathContainsArchAndUUID(dsym_fspec, mod_spec.GetArchitecturePtr(), + mod_spec.GetUUIDPtr())) { return true; } @@ -109,15 +108,15 @@ static bool LookForDsymNextToExecutableP binary_name.erase(last_dot); dsym_fspec = dsym_directory; dsym_fspec.AppendPathComponent(binary_name); - if (dsym_fspec.Exists() - && FileAtPathContainsArchAndUUID(dsym_fspec, - mod_spec.GetArchitecturePtr(), - mod_spec.GetUUIDPtr())) { + if (FileSystem::Instance().Exists(dsym_fspec) && + FileAtPathContainsArchAndUUID(dsym_fspec, + mod_spec.GetArchitecturePtr(), + mod_spec.GetUUIDPtr())) { return true; } } - } - + } + // See if we have a .dSYM.yaa next to this executable path. FileSpec dsym_yaa_fspec = exec_fspec; dsym_yaa_fspec.RemoveLastPathComponent(); @@ -125,10 +124,10 @@ static bool LookForDsymNextToExecutableP dsym_yaa_filename += ".dSYM.yaa"; dsym_yaa_fspec.AppendPathComponent(dsym_yaa_filename); - if (dsym_yaa_fspec.Exists()) { + if (FileSystem::Instance().Exists(dsym_yaa_fspec)) { ModuleSpec mutable_mod_spec = mod_spec; - if (Symbols::DownloadObjectAndSymbolFile (mutable_mod_spec, true) - && mutable_mod_spec.GetSymbolFileSpec().Exists()) { + if (Symbols::DownloadObjectAndSymbolFile(mutable_mod_spec, true) && + FileSystem::Instance().Exists(mutable_mod_spec.GetSymbolFileSpec())) { dsym_fspec = mutable_mod_spec.GetSymbolFileSpec(); return true; } @@ -250,7 +249,8 @@ ModuleSpec Symbols::LocateExecutableObje FileSpec Symbols::LocateExecutableSymbolFile(const ModuleSpec &module_spec) { FileSpec symbol_file_spec = module_spec.GetSymbolFileSpec(); - if (symbol_file_spec.IsAbsolute() && symbol_file_spec.Exists()) + if (symbol_file_spec.IsAbsolute() && + FileSystem::Instance().Exists(symbol_file_spec)) return symbol_file_spec; const char *symbol_filename = symbol_file_spec.GetFilename().AsCString(); @@ -321,7 +321,7 @@ FileSpec Symbols::LocateExecutableSymbol module_file_spec.GetPath())) continue; - if (file_spec.Exists()) { + if (FileSystem::Instance().Exists(file_spec)) { lldb_private::ModuleSpecList specs; const size_t num_specs = ObjectFile::GetModuleSpecifications(file_spec, 0, 0, specs); Modified: lldb/trunk/source/Host/macosx/Symbols.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Symbols.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Host/macosx/Symbols.cpp (original) +++ lldb/trunk/source/Host/macosx/Symbols.cpp Thu Nov 1 10:09:25 2018 @@ -147,7 +147,7 @@ int LocateMacOSXFilesUsingDebugSymbols(c } ++items_found; FileSpec exec_filespec(path, path[0] == '~'); - if (exec_filespec.Exists()) { + if (FileSystem::Instance().Exists(exec_filespec)) { success = true; return_module_spec.GetFileSpec() = exec_filespec; } @@ -494,7 +494,8 @@ bool Symbols::DownloadObjectAndSymbolFil return false; } - if (uuid_ptr || (file_spec_ptr && file_spec_ptr->Exists())) { + if (uuid_ptr || + (file_spec_ptr && FileSystem::Instance().Exists(*file_spec_ptr))) { static bool g_located_dsym_for_uuid_exe = false; static bool g_dsym_for_uuid_exe_exists = false; static char g_dsym_for_uuid_exe_path[PATH_MAX]; @@ -506,13 +507,15 @@ bool Symbols::DownloadObjectAndSymbolFil if (dsym_for_uuid_exe_path_cstr) { dsym_for_uuid_exe_spec.SetFile(dsym_for_uuid_exe_path_cstr, true, FileSpec::Style::native); - g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); + g_dsym_for_uuid_exe_exists = + FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); } if (!g_dsym_for_uuid_exe_exists) { dsym_for_uuid_exe_spec.SetFile("/usr/local/bin/dsymForUUID", false, FileSpec::Style::native); - g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); + g_dsym_for_uuid_exe_exists = + FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); if (!g_dsym_for_uuid_exe_exists) { long bufsize; if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) != -1) { @@ -527,7 +530,8 @@ bool Symbols::DownloadObjectAndSymbolFil dsymforuuid_path += "/bin/dsymForUUID"; dsym_for_uuid_exe_spec.SetFile(dsymforuuid_path.c_str(), false, FileSpec::Style::native); - g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); + g_dsym_for_uuid_exe_exists = + FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); } } } @@ -535,7 +539,8 @@ bool Symbols::DownloadObjectAndSymbolFil if (!g_dsym_for_uuid_exe_exists && g_dbgshell_command != NULL) { dsym_for_uuid_exe_spec.SetFile(g_dbgshell_command, true, FileSpec::Style::native); - g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); + g_dsym_for_uuid_exe_exists = + FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); } if (g_dsym_for_uuid_exe_exists) Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/objcxx/Host.mm?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Host/macosx/objcxx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/objcxx/Host.mm Thu Nov 1 10:09:25 2018 @@ -226,7 +226,7 @@ LaunchInNewTerminalWithAppleScript(const darwin_debug_file_spec.GetFilename().SetCString("darwin-debug"); - if (!darwin_debug_file_spec.Exists()) { + if (!FileSystem::Instance().Exists(darwin_debug_file_spec)) { error.SetErrorStringWithFormat( "the 'darwin-debug' executable doesn't exists at '%s'", darwin_debug_file_spec.GetPath().c_str()); @@ -1338,7 +1338,7 @@ Status Host::ShellExpandArguments(Proces return error; } expand_tool_spec.AppendPathComponent("lldb-argdumper"); - if (!expand_tool_spec.Exists()) { + if (!FileSystem::Instance().Exists(expand_tool_spec)) { error.SetErrorStringWithFormat( "could not find the lldb-argdumper tool: %s", expand_tool_spec.GetPath().c_str()); @@ -1355,7 +1355,7 @@ Status Host::ShellExpandArguments(Proces int status; std::string output; FileSpec cwd(launch_info.GetWorkingDirectory()); - if (!cwd.Exists()) { + if (!FileSystem::Instance().Exists(cwd)) { char *wd = getcwd(nullptr, 0); if (wd == nullptr) { error.SetErrorStringWithFormat( Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Nov 1 10:09:25 2018 @@ -2093,7 +2093,7 @@ void CommandInterpreter::SourceInitFile( FileSpec homedir_dot_lldb(home_dir_path.c_str(), false); homedir_dot_lldb.AppendPathComponent(".lldbinit"); homedir_dot_lldb.ResolvePath(); - if (dot_lldb.Exists() && + if (FileSystem::Instance().Exists(dot_lldb) && dot_lldb.GetDirectory() != homedir_dot_lldb.GetDirectory()) { result.AppendErrorWithFormat( "There is a .lldbinit file in the current directory which is not " @@ -2137,7 +2137,7 @@ void CommandInterpreter::SourceInitFile( "%s-%s", init_file_path.c_str(), program_name); init_file.SetFile(program_init_file_name, true, FileSpec::Style::native); - if (!init_file.Exists()) + if (!FileSystem::Instance().Exists(init_file)) init_file.Clear(); } } @@ -2150,7 +2150,7 @@ void CommandInterpreter::SourceInitFile( // actual broadcasting of the commands back to any appropriate listener (see // CommandObjectSource::Execute for more details). - if (init_file.Exists()) { + if (FileSystem::Instance().Exists(init_file)) { const bool saved_batch = SetBatchCommandMode(true); CommandInterpreterRunOptions options; options.SetSilent(true); @@ -2351,7 +2351,7 @@ enum { void CommandInterpreter::HandleCommandsFromFile( FileSpec &cmd_file, ExecutionContext *context, CommandInterpreterRunOptions &options, CommandReturnObject &result) { - if (cmd_file.Exists()) { + if (FileSystem::Instance().Exists(cmd_file)) { StreamFileSP input_file_sp(new StreamFile()); std::string cmd_file_path = cmd_file.GetPath(); Modified: lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp (original) +++ lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp Thu Nov 1 10:09:25 2018 @@ -13,6 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Host/FileSystem.h" #include "lldb/Host/StringConvert.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/FileSpec.h" @@ -23,7 +24,7 @@ using namespace lldb_private; namespace { static bool VerifyPathExists(const char *path) { if (path && path[0]) - return FileSpec(path, false).Exists(); + return FileSystem::Instance().Exists(path); else return false; } Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Thu Nov 1 10:09:25 2018 @@ -784,7 +784,7 @@ bool DynamicLoaderDarwinKernel::KextImag // to do anything useful. This will force a clal to if (IsKernel()) { if (Symbols::DownloadObjectAndSymbolFile(module_spec, true)) { - if (module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) { m_module_sp.reset(new Module(module_spec.GetFileSpec(), target.GetArchitecture())); if (m_module_sp.get() && Modified: lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp Thu Nov 1 10:09:25 2018 @@ -179,7 +179,7 @@ ModuleSP DynamicLoaderHexagonDYLD::GetTa return executable; // The target executable file does not exits - if (!executable->GetFileSpec().Exists()) + if (!FileSystem::Instance().Exists(executable->GetFileSpec())) return executable; // Prep module for loading Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Nov 1 10:09:25 2018 @@ -2530,7 +2530,7 @@ bool RenderScriptRuntime::LoadAllocation // Check we can read from file FileSpec file(path, true); - if (!file.Exists()) { + if (!FileSystem::Instance().Exists(file)) { strm.Printf("Error: File %s does not exist", path); strm.EOL(); return false; @@ -4652,7 +4652,7 @@ public: switch (short_option) { case 'f': m_outfile.SetFile(option_arg, true, FileSpec::Style::native); - if (m_outfile.Exists()) { + if (FileSystem::Instance().Exists(m_outfile)) { m_outfile.Clear(); err.SetErrorStringWithFormat("file already exists: '%s'", option_arg.str().c_str()); Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu Nov 1 10:09:25 2018 @@ -2636,7 +2636,7 @@ size_t ObjectFileMachO::ParseSymtab() { // shared cache UUID in the development or non-development shared caches // on disk. if (process_shared_cache_uuid.IsValid()) { - if (dsc_development_filespec.Exists()) { + if (FileSystem::Instance().Exists(dsc_development_filespec)) { UUID dsc_development_uuid = GetSharedCacheUUID( dsc_development_filespec, byte_order, addr_byte_size); if (dsc_development_uuid.IsValid() && @@ -2645,7 +2645,8 @@ size_t ObjectFileMachO::ParseSymtab() { dsc_uuid = dsc_development_uuid; } } - if (!dsc_uuid.IsValid() && dsc_nondevelopment_filespec.Exists()) { + if (!dsc_uuid.IsValid() && + FileSystem::Instance().Exists(dsc_nondevelopment_filespec)) { UUID dsc_nondevelopment_uuid = GetSharedCacheUUID( dsc_nondevelopment_filespec, byte_order, addr_byte_size); if (dsc_nondevelopment_uuid.IsValid() && @@ -2658,8 +2659,8 @@ size_t ObjectFileMachO::ParseSymtab() { // Failing a UUID match, prefer the development dyld_shared cache if both // are present. - if (!dsc_filespec.Exists()) { - if (dsc_development_filespec.Exists()) { + if (!FileSystem::Instance().Exists(dsc_filespec)) { + if (FileSystem::Instance().Exists(dsc_development_filespec)) { dsc_filespec = dsc_development_filespec; } else { dsc_filespec = dsc_nondevelopment_filespec; @@ -3067,11 +3068,11 @@ size_t ObjectFileMachO::ParseSymtab() { // file so you end up with a path that looks // like "/tmp/src//tmp/src/" FileSpec so_dir(so_path, false); - if (!so_dir.Exists()) { + if (!FileSystem::Instance().Exists(so_dir)) { so_dir.SetFile( &full_so_path[double_slash_pos + 1], false); - if (so_dir.Exists()) { + if (FileSystem::Instance().Exists(so_dir)) { // Trim off the incorrect path full_so_path.erase(0, double_slash_pos + 1); @@ -4017,10 +4018,10 @@ size_t ObjectFileMachO::ParseSymtab() { // directory for the source file so you end up with a path // that looks like "/tmp/src//tmp/src/" FileSpec so_dir(so_path, false); - if (!so_dir.Exists()) { + if (!FileSystem::Instance().Exists(so_dir)) { so_dir.SetFile(&full_so_path[double_slash_pos + 1], false, FileSpec::Style::native); - if (so_dir.Exists()) { + if (FileSystem::Instance().Exists(so_dir)) { // Trim off the incorrect path full_so_path.erase(0, double_slash_pos + 1); } @@ -5152,7 +5153,8 @@ uint32_t ObjectFileMachO::GetDependentMo // It is OK to resolve this path because we must find a file on disk // for us to accept it anyway if it is rpath relative. FileSpec file_spec(path, true); - if (file_spec.Exists() && files.AppendIfUnique(file_spec)) { + if (FileSystem::Instance().Exists(file_spec) && + files.AppendIfUnique(file_spec)) { count++; break; } @@ -5169,7 +5171,8 @@ uint32_t ObjectFileMachO::GetDependentMo for (const auto &at_exec_relative_path : at_exec_relative_paths) { FileSpec file_spec = exec_dir.CopyByAppendingPathComponent(at_exec_relative_path); - if (file_spec.Exists() && files.AppendIfUnique(file_spec)) + if (FileSystem::Instance().Exists(file_spec) && + files.AppendIfUnique(file_spec)) count++; } } Modified: lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp (original) +++ lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp Thu Nov 1 10:09:25 2018 @@ -53,7 +53,8 @@ OperatingSystem *OperatingSystemPython:: // Python OperatingSystem plug-ins must be requested by name, so force must // be true FileSpec python_os_plugin_spec(process->GetPythonOSPluginPath()); - if (python_os_plugin_spec && python_os_plugin_spec.Exists()) { + if (python_os_plugin_spec && + FileSystem::Instance().Exists(python_os_plugin_spec)) { std::unique_ptr<OperatingSystemPython> os_ap( new OperatingSystemPython(process, python_os_plugin_spec)); if (os_ap.get() && os_ap->IsValid()) Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp Thu Nov 1 10:09:25 2018 @@ -190,7 +190,7 @@ Status PlatformAppleTVSimulator::Resolve // ourselves Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { if (resolved_module_spec.GetArchitecture().IsValid()) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, NULL, NULL, NULL); @@ -317,12 +317,12 @@ Status PlatformAppleTVSimulator::GetSymb // First try in the SDK and see if the file is in there local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; // Else fall back to the actual path itself local_file.SetFile(platform_file_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; } error.SetErrorStringWithFormat( Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp Thu Nov 1 10:09:25 2018 @@ -190,7 +190,7 @@ Status PlatformAppleWatchSimulator::Reso // ourselves Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { if (resolved_module_spec.GetArchitecture().IsValid()) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, NULL, NULL, NULL); @@ -317,12 +317,12 @@ Status PlatformAppleWatchSimulator::GetS // First try in the SDK and see if the file is in there local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; // Else fall back to the actual path itself local_file.SetFile(platform_file_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; } error.SetErrorStringWithFormat( Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Thu Nov 1 10:09:25 2018 @@ -88,7 +88,7 @@ FileSpecList PlatformDarwin::LocateExecu ObjectFile *objfile = symfile->GetObjectFile(); if (objfile) { FileSpec symfile_spec(objfile->GetFileSpec()); - if (symfile_spec && symfile_spec.Exists()) { + if (symfile_spec && FileSystem::Instance().Exists(symfile_spec)) { while (module_spec.GetFilename()) { std::string module_basename( module_spec.GetFilename().GetCString()); @@ -139,11 +139,11 @@ FileSpecList PlatformDarwin::LocateExecu // that the file as-is shall not be loaded if (feedback_stream) { if (module_basename != original_module_basename && - orig_script_fspec.Exists()) { + FileSystem::Instance().Exists(orig_script_fspec)) { const char *reason_for_complaint = was_keyword ? "conflicts with a keyword" : "contains reserved characters"; - if (script_fspec.Exists()) + if (FileSystem::Instance().Exists(script_fspec)) feedback_stream->Printf( "warning: the symbol file '%s' contains a debug " "script. However, its name" @@ -167,7 +167,7 @@ FileSpecList PlatformDarwin::LocateExecu } } - if (script_fspec.Exists()) { + if (FileSystem::Instance().Exists(script_fspec)) { file_list.Append(script_fspec); break; } @@ -270,7 +270,7 @@ lldb_private::Status PlatformDarwin::Get err = BringInRemoteFile(this, module_spec, module_cache_spec); if (err.Fail()) return err; - if (module_cache_spec.Exists()) { + if (FileSystem::Instance().Exists(module_cache_spec)) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("[%s] module %s/%s was rsynced and is now there", @@ -286,7 +286,7 @@ lldb_private::Status PlatformDarwin::Get } // try to find the module in the cache - if (module_cache_spec.Exists()) { + if (FileSystem::Instance().Exists(module_cache_spec)) { // get the local and remote MD5 and compare if (m_remote_platform_sp) { // when going over the *slow* GDB remote transfer mechanism we first @@ -337,7 +337,7 @@ lldb_private::Status PlatformDarwin::Get Status err = BringInRemoteFile(this, module_spec, module_cache_spec); if (err.Fail()) return err; - if (module_cache_spec.Exists()) { + if (FileSystem::Instance().Exists(module_cache_spec)) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("[%s] module %s/%s is now cached and fine", @@ -413,7 +413,7 @@ Status PlatformDarwin::GetSharedModule( sizeof(new_path) - search_path_len, "/%s", platform_path + bundle_directory_len); FileSpec new_file_spec(new_path, false); - if (new_file_spec.Exists()) { + if (FileSystem::Instance().Exists(new_file_spec)) { ModuleSpec new_module_spec(module_spec); new_module_spec.GetFileSpec() = new_file_spec; Status new_error(Platform::GetSharedModule( @@ -1184,7 +1184,7 @@ const char *PlatformDarwin::GetDeveloper if (!developer_dir_path_valid) { FileSpec xcode_select_cmd("/usr/bin/xcode-select", false); - if (xcode_select_cmd.Exists()) { + if (FileSystem::Instance().Exists(xcode_select_cmd)) { int exit_status = -1; int signo = -1; std::string command_output; @@ -1217,7 +1217,7 @@ const char *PlatformDarwin::GetDeveloper if (developer_dir_path_valid) { temp_file_spec.SetFile(developer_dir_path, false, FileSpec::Style::native); - if (temp_file_spec.Exists()) { + if (FileSystem::Instance().Exists(temp_file_spec)) { m_developer_directory.assign(developer_dir_path); return m_developer_directory.c_str(); } @@ -1300,7 +1300,7 @@ static const char *const sdk_strings[] = }; static FileSpec CheckPathForXcode(const FileSpec &fspec) { - if (fspec.Exists()) { + if (FileSystem::Instance().Exists(fspec)) { const char substr[] = ".app/Contents"; std::string path_to_shlib = fspec.GetPath(); @@ -1313,7 +1313,7 @@ static FileSpec CheckPathForXcode(const xcode_binary_path.AppendPathComponent("MacOS"); xcode_binary_path.AppendPathComponent("Xcode"); - if (xcode_binary_path.Exists()) { + if (FileSystem::Instance().Exists(xcode_binary_path)) { return ret; } } @@ -1497,7 +1497,7 @@ FileSpec PlatformDarwin::GetSDKDirectory version.getMinor().getValueOr(0)); native_sdk_spec.AppendPathComponent(native_sdk_name.GetString()); - if (native_sdk_spec.Exists()) { + if (FileSystem::Instance().Exists(native_sdk_spec)) { return native_sdk_spec; } } @@ -1659,7 +1659,7 @@ lldb_private::FileSpec PlatformDarwin::L xcode_lldb_resources.AppendPathComponent("SharedFrameworks"); xcode_lldb_resources.AppendPathComponent("LLDB.framework"); xcode_lldb_resources.AppendPathComponent("Resources"); - if (xcode_lldb_resources.Exists()) { + if (FileSystem::Instance().Exists(xcode_lldb_resources)) { FileSpec dir; dir.GetDirectory().SetCString(xcode_lldb_resources.GetPath().c_str()); g_executable_dirs.push_back(dir); @@ -1673,7 +1673,7 @@ lldb_private::FileSpec PlatformDarwin::L FileSpec executable_file; executable_file.GetDirectory() = executable_dir.GetDirectory(); executable_file.GetFilename().SetCString(basename); - if (executable_file.Exists()) + if (FileSystem::Instance().Exists(executable_file)) return executable_file; } @@ -1757,7 +1757,7 @@ PlatformDarwin::FindBundleBinaryInExecSe path_to_try.AppendPathComponent(path_parts[k]); } - if (path_to_try.Exists()) { + if (FileSystem::Instance().Exists(path_to_try)) { ModuleSpec new_module_spec(module_spec); new_module_spec.GetFileSpec() = path_to_try; Status new_error(Platform::GetSharedModule( Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Thu Nov 1 10:09:25 2018 @@ -719,7 +719,7 @@ Status PlatformDarwinKernel::GetSharedMo module_spec.GetUUID().IsValid()) { // First try all kernel binaries that have a dSYM next to them for (auto possible_kernel : m_kernel_binaries_with_dsyms) { - if (possible_kernel.Exists()) { + if (FileSystem::Instance().Exists(possible_kernel)) { ModuleSpec kern_spec(possible_kernel); kern_spec.GetUUID() = module_spec.GetUUID(); ModuleSP module_sp(new Module(kern_spec)); @@ -755,7 +755,7 @@ Status PlatformDarwinKernel::GetSharedMo // Next try all kernel binaries that don't have a dSYM for (auto possible_kernel : m_kernel_binaries_without_dsyms) { - if (possible_kernel.Exists()) { + if (FileSystem::Instance().Exists(possible_kernel)) { ModuleSpec kern_spec(possible_kernel); kern_spec.GetUUID() = module_spec.GetUUID(); ModuleSP module_sp(new Module(kern_spec)); @@ -806,7 +806,7 @@ Status PlatformDarwinKernel::ExamineKext const ArchSpec &arch, ModuleSP &exe_module_sp) { for (const auto &exe_file : SearchForExecutablesRecursively(kext_bundle_path.GetPath())) { - if (exe_file.Exists()) { + if (FileSystem::Instance().Exists(exe_file)) { ModuleSpec exe_spec(exe_file); exe_spec.GetUUID() = uuid; if (!uuid.IsValid()) { Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Thu Nov 1 10:09:25 2018 @@ -219,13 +219,13 @@ ConstString PlatformMacOSX::GetSDKDirect xcode_contents_path.c_str(), versions[0], versions[1]); fspec.SetFile(sdk_path.GetString(), false, FileSpec::Style::native); - if (fspec.Exists()) + if (FileSystem::Instance().Exists(fspec)) return ConstString(sdk_path.GetString()); } if (!default_xcode_sdk.empty()) { fspec.SetFile(default_xcode_sdk, false, FileSpec::Style::native); - if (fspec.Exists()) + if (FileSystem::Instance().Exists(fspec)) return ConstString(default_xcode_sdk); } } @@ -269,7 +269,7 @@ PlatformMacOSX::GetFileWithUUID(const ll std::string module_path(platform_file.GetPath()); cache_path.append(module_path); FileSpec module_cache_spec(cache_path, false); - if (module_cache_spec.Exists()) { + if (FileSystem::Instance().Exists(module_cache_spec)) { local_file = module_cache_spec; return Status(); } @@ -284,7 +284,7 @@ PlatformMacOSX::GetFileWithUUID(const ll err = GetFile(platform_file, module_cache_spec); if (err.Fail()) return err; - if (module_cache_spec.Exists()) { + if (FileSystem::Instance().Exists(module_cache_spec)) { local_file = module_cache_spec; return Status(); } else Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp Thu Nov 1 10:09:25 2018 @@ -18,6 +18,7 @@ #include "lldb/Core/ModuleList.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" @@ -85,7 +86,7 @@ Status PlatformRemoteDarwinDevice::Resol // ourselves Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { if (resolved_module_spec.GetArchitecture().IsValid() || resolved_module_spec.GetUUID().IsValid()) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, @@ -188,7 +189,7 @@ bool PlatformRemoteDarwinDevice::UpdateS for (const auto &sdk_directory_info : builtin_sdk_directory_infos) { sdk_symbols_symlink_fspec = sdk_directory_info.directory; sdk_symbols_symlink_fspec.AppendPathComponent("Symbols"); - if (sdk_symbols_symlink_fspec.Exists()) { + if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) { m_sdk_directory_infos.push_back(sdk_directory_info); if (log) { log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded " @@ -207,12 +208,12 @@ bool PlatformRemoteDarwinDevice::UpdateS std::string local_sdk_cache_str = "~/Library/Developer/Xcode/"; local_sdk_cache_str += dirname; FileSpec local_sdk_cache(local_sdk_cache_str.c_str(), true); - if (local_sdk_cache.Exists()) { - if (log) { + if (FileSystem::Instance().Exists(local_sdk_cache)) { + if (log) { log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded " "searching %s for additional SDKs", local_sdk_cache.GetPath().c_str()); - } + } char path[PATH_MAX]; if (local_sdk_cache.GetPath(path, sizeof(path))) { FileSystem::Instance().EnumerateDirectory( @@ -244,7 +245,7 @@ bool PlatformRemoteDarwinDevice::UpdateS for (const auto &sdk_directory_info : env_var_sdk_directory_infos) { sdk_symbols_symlink_fspec = sdk_directory_info.directory; sdk_symbols_symlink_fspec.AppendPathComponent("Symbols"); - if (sdk_symbols_symlink_fspec.Exists()) { + if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) { m_sdk_directory_infos.push_back(sdk_directory_info); if (log) { log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded " @@ -424,7 +425,7 @@ bool PlatformRemoteDarwinDevice::GetFile local_file.AppendPathComponent(paths_to_try[i]); local_file.AppendPathComponent(platform_file_path); local_file.ResolvePath(); - if (local_file.Exists()) { + if (FileSystem::Instance().Exists(local_file)) { if (log) log->Printf("Found a copy of %s in the SDK dir %s/%s", platform_file_path, sdkroot_path.c_str(), @@ -453,7 +454,7 @@ Status PlatformRemoteDarwinDevice::GetSy platform_file_path); local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) { + if (FileSystem::Instance().Exists(local_file)) { if (log) { log->Printf("Found a copy of %s in the DeviceSupport dir %s", platform_file_path, os_version_dir); @@ -465,7 +466,7 @@ Status PlatformRemoteDarwinDevice::GetSy os_version_dir, platform_file_path); local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) { + if (FileSystem::Instance().Exists(local_file)) { if (log) { log->Printf( "Found a copy of %s in the DeviceSupport dir %s/Symbols.Internal", @@ -477,7 +478,7 @@ Status PlatformRemoteDarwinDevice::GetSy os_version_dir, platform_file_path); local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) { + if (FileSystem::Instance().Exists(local_file)) { if (log) { log->Printf("Found a copy of %s in the DeviceSupport dir %s/Symbols", platform_file_path, os_version_dir); @@ -486,7 +487,7 @@ Status PlatformRemoteDarwinDevice::GetSy } } local_file = platform_file; - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; error.SetErrorStringWithFormat( Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp Thu Nov 1 10:09:25 2018 @@ -196,7 +196,7 @@ Status PlatformiOSSimulator::ResolveExec // ourselves Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { if (resolved_module_spec.GetArchitecture().IsValid()) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, NULL, NULL, NULL); @@ -322,12 +322,12 @@ Status PlatformiOSSimulator::GetSymbolFi // First try in the SDK and see if the file is in there local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; // Else fall back to the actual path itself local_file.SetFile(platform_file_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; } error.SetErrorStringWithFormat( Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original) +++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Thu Nov 1 10:09:25 2018 @@ -128,20 +128,20 @@ PlatformPOSIX::ResolveExecutable(const M if (IsHost()) { // If we have "ls" as the exe_file, resolve the executable location based // on the current path variables - if (!resolved_module_spec.GetFileSpec().Exists()) { + if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); resolved_module_spec.GetFileSpec().SetFile(exe_path, true, FileSpec::Style::native); } - if (!resolved_module_spec.GetFileSpec().Exists()) + if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) FileSystem::Instance().ResolveExecutableLocation( resolved_module_spec.GetFileSpec()); // Resolve any executable within a bundle on MacOSX Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) error.Clear(); else { const uint32_t permissions = FileSystem::Instance().GetPermissions( @@ -167,7 +167,7 @@ PlatformPOSIX::ResolveExecutable(const M // Resolve any executable within a bundle on MacOSX Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) error.Clear(); else error.SetErrorStringWithFormat("the platform is not currently " @@ -466,7 +466,7 @@ Status PlatformPOSIX::CreateSymlink(cons bool PlatformPOSIX::GetFileExists(const FileSpec &file_spec) { if (IsHost()) - return file_spec.Exists(); + return FileSystem::Instance().Exists(file_spec); else if (m_remote_platform_sp) return m_remote_platform_sp->GetFileExists(file_spec); else Modified: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp (original) +++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp Thu Nov 1 10:09:25 2018 @@ -192,17 +192,17 @@ Status PlatformWindows::ResolveExecutabl if (IsHost()) { // if we cant resolve the executable loation based on the current path // variables - if (!resolved_module_spec.GetFileSpec().Exists()) { + if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); resolved_module_spec.GetFileSpec().SetFile(exe_path, true, FileSpec::Style::native); } - if (!resolved_module_spec.GetFileSpec().Exists()) + if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) FileSystem::Instance().ResolveExecutableLocation( resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) error.Clear(); else { ms.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); @@ -216,7 +216,7 @@ Status PlatformWindows::ResolveExecutabl } else { // We may connect to a process and use the provided executable (Don't use // local $PATH). - if (resolved_module_spec.GetFileSpec().Exists()) + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) error.Clear(); else error.SetErrorStringWithFormat("the platform is not currently " Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original) +++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Thu Nov 1 10:09:25 2018 @@ -107,7 +107,7 @@ Status PlatformRemoteGDBServer::ResolveE // Resolve any executable within an apk on Android? // Host::ResolveExecutableInBundle (resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists() || + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec()) || module_spec.GetUUID().IsValid()) { if (resolved_module_spec.GetArchitecture().IsValid() || resolved_module_spec.GetUUID().IsValid()) { Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Thu Nov 1 10:09:25 2018 @@ -300,7 +300,8 @@ Status ProcessKDP::DoConnectRemote(Strea if (module_spec.GetSymbolFileSpec()) { ModuleSpec executable_module_spec = Symbols::LocateExecutableObjectFile(module_spec); - if (executable_module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists( + executable_module_spec.GetFileSpec())) { module_spec.GetFileSpec() = executable_module_spec.GetFileSpec(); } @@ -309,7 +310,7 @@ Status ProcessKDP::DoConnectRemote(Strea !module_spec.GetSymbolFileSpec()) Symbols::DownloadObjectAndSymbolFile(module_spec, true); - if (module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) { ModuleSP module_sp(new Module(module_spec)); if (module_sp.get() && module_sp->GetObjectFile()) { // Get the current target executable Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original) +++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Thu Nov 1 10:09:25 2018 @@ -81,7 +81,7 @@ lldb::ProcessSP ProcessElfCore::CreateIn bool ProcessElfCore::CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) { // For now we are just making sure the file exists for a given module - if (!m_core_module_sp && m_core_file.Exists()) { + if (!m_core_module_sp && FileSystem::Instance().Exists(m_core_file)) { ModuleSpec core_module_spec(m_core_file, target_sp->GetArchitecture()); Status error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp, NULL, NULL, NULL)); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Thu Nov 1 10:09:25 2018 @@ -18,6 +18,7 @@ // Other libraries and framework includes #include "lldb/Core/StreamFile.h" #include "lldb/Host/ConnectionFileDescriptor.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/Pipe.h" @@ -1005,13 +1006,14 @@ Status GDBRemoteCommunication::StartDebu __FUNCTION__, env_debugserver_path); } else debugserver_file_spec = g_debugserver_file_spec; - bool debugserver_exists = debugserver_file_spec.Exists(); + bool debugserver_exists = + FileSystem::Instance().Exists(debugserver_file_spec); if (!debugserver_exists) { // The debugserver binary is in the LLDB.framework/Resources directory. debugserver_file_spec = HostInfo::GetSupportExeDir(); if (debugserver_file_spec) { debugserver_file_spec.AppendPathComponent(DEBUGSERVER_BASENAME); - debugserver_exists = debugserver_file_spec.Exists(); + debugserver_exists = FileSystem::Instance().Exists(debugserver_file_spec); if (debugserver_exists) { if (log) log->Printf( Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Thu Nov 1 10:09:25 2018 @@ -3220,7 +3220,7 @@ GDBRemoteCommunicationServerLLGS::FindMo if (m_debugged_process_up ->GetLoadedModuleFileSpec(module_path.c_str(), file_spec) .Success()) { - if (file_spec.Exists()) + if (FileSystem::Instance().Exists(file_spec)) return file_spec; } } Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Nov 1 10:09:25 2018 @@ -233,7 +233,7 @@ bool ProcessGDBRemote::CanDebug(lldb::Ta case ObjectFile::eTypeUnknown: break; } - return exe_module->GetFileSpec().Exists(); + return FileSystem::Instance().Exists(exe_module->GetFileSpec()); } // However, if there is no executable module, we return true since we might // be preparing to attach. @@ -439,7 +439,7 @@ void ProcessGDBRemote::BuildDynamicRegis FileSpec target_definition_fspec = GetGlobalPluginProperties()->GetTargetDefinitionFile(); - if (!target_definition_fspec.Exists()) { + if (!FileSystem::Instance().Exists(target_definition_fspec)) { // If the filename doesn't exist, it may be a ~ not having been expanded - // try to resolve it. target_definition_fspec.ResolvePath(); Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp (original) +++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Thu Nov 1 10:09:25 2018 @@ -90,7 +90,7 @@ bool ProcessMachCore::CanDebug(lldb::Tar return true; // For now we are just making sure the file exists for a given module - if (!m_core_module_sp && m_core_file.Exists()) { + if (!m_core_module_sp && FileSystem::Instance().Exists(m_core_file)) { // Don't add the Target's architecture to the ModuleSpec - we may be // working with a core file that doesn't have the correct cpusubtype in the // header but we should still try to use it - Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (original) +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Thu Nov 1 10:09:25 2018 @@ -2017,7 +2017,7 @@ ScriptInterpreterPython::ScriptedBreakpo StructuredData::ObjectSP ScriptInterpreterPython::LoadPluginModule(const FileSpec &file_spec, lldb_private::Status &error) { - if (!file_spec.Exists()) { + if (!FileSystem::Instance().Exists(file_spec)) { error.SetErrorString("no such file"); return StructuredData::ObjectSP(); } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Nov 1 10:09:25 2018 @@ -1640,7 +1640,7 @@ SymbolFileDWARF::GetDwoSymbolFileForComp dwo_file.AppendPathComponent(dwo_name); } - if (!dwo_file.Exists()) + if (!FileSystem::Instance().Exists(dwo_file)) return nullptr; const lldb::offset_t file_offset = 0; @@ -3879,7 +3879,7 @@ SymbolFileDWARFDwp *SymbolFileDWARF::Get module_spec.GetSymbolFileSpec() = FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec); - if (dwp_filespec.Exists()) { + if (FileSystem::Instance().Exists(dwp_filespec)) { m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(), dwp_filespec); } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Thu Nov 1 10:09:25 2018 @@ -423,7 +423,7 @@ Module *SymbolFileDWARFDebugMap::GetModu const char *oso_path = comp_unit_info->oso_path.GetCString(); FileSpec oso_file(oso_path, false); ConstString oso_object; - if (oso_file.Exists()) { + if (FileSystem::Instance().Exists(oso_file)) { auto oso_mod_time = FileSystem::Instance().GetModificationTime(oso_file); if (oso_mod_time != comp_unit_info->oso_mod_time) { obj_file->GetModule()->ReportError( Modified: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Thu Nov 1 10:09:25 2018 @@ -174,7 +174,7 @@ SymbolVendorMacOSX::CreateInstance(const snprintf(dsym_uuid_plist_path, sizeof(dsym_uuid_plist_path), "%s%s.plist", dsym_path, uuid_str.c_str()); FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path, false); - if (dsym_uuid_plist_spec.Exists()) { + if (FileSystem::Instance().Exists(dsym_uuid_plist_spec)) { ApplePropertyList plist(dsym_uuid_plist_path); if (plist) { std::string DBGBuildSourcePath; Modified: lldb/trunk/source/Symbol/ObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ObjectFile.cpp (original) +++ lldb/trunk/source/Symbol/ObjectFile.cpp Thu Nov 1 10:09:25 2018 @@ -47,7 +47,7 @@ ObjectFile::FindPlugin(const lldb::Modul FileSpec archive_file; ObjectContainerCreateInstance create_object_container_callback; - const bool file_exists = file->Exists(); + const bool file_exists = FileSystem::Instance().Exists(*file); if (!data_sp) { // We have an object name which most likely means we have a .o file in // a static archive (.a file). Try and see if we have a cached archive @@ -584,7 +584,7 @@ bool ObjectFile::SplitArchivePathWithObj regex_match.GetMatchAtIndex(path_with_object, 2, obj)) { archive_file.SetFile(path, false, FileSpec::Style::native); archive_object.SetCString(obj.c_str()); - if (must_exist && !archive_file.Exists()) + if (must_exist && !FileSystem::Instance().Exists(archive_file)) return false; return true; } Modified: lldb/trunk/source/Target/ModuleCache.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ModuleCache.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Target/ModuleCache.cpp (original) +++ lldb/trunk/source/Target/ModuleCache.cpp Thu Nov 1 10:09:25 2018 @@ -133,7 +133,7 @@ Status CreateHostSysRootModuleLink(const const auto sysroot_module_path_spec = JoinPath(JoinPath(root_dir_spec, hostname), platform_module_spec.GetPath().c_str()); - if (sysroot_module_path_spec.Exists()) { + if (FileSystem::Instance().Exists(sysroot_module_path_spec)) { if (!delete_existing) return Status(); @@ -225,7 +225,7 @@ Status ModuleCache::Get(const FileSpec & const auto module_file_path = JoinPath( module_spec_dir, module_spec.GetFileSpec().GetFilename().AsCString()); - if (!module_file_path.Exists()) + if (!FileSystem::Instance().Exists(module_file_path)) return Status("Module %s not found", module_file_path.GetPath().c_str()); if (FileSystem::Instance().GetByteSize(module_file_path) != module_spec.GetObjectSize()) @@ -253,7 +253,7 @@ Status ModuleCache::Get(const FileSpec & return error; FileSpec symfile_spec = GetSymbolFileSpec(cached_module_sp->GetFileSpec()); - if (symfile_spec.Exists()) + if (FileSystem::Instance().Exists(symfile_spec)) cached_module_sp->SetSymbolFileFileSpec(symfile_spec); m_loaded_modules.insert( Modified: lldb/trunk/source/Target/PathMappingList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/PathMappingList.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Target/PathMappingList.cpp (original) +++ lldb/trunk/source/Target/PathMappingList.cpp Thu Nov 1 10:09:25 2018 @@ -14,12 +14,13 @@ // Other libraries and framework includes // Project includes -#include "lldb/lldb-private-enumerations.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/PosixApi.h" #include "lldb/Target/PathMappingList.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" +#include "lldb/lldb-private-enumerations.h" using namespace lldb; using namespace lldb_private; @@ -219,7 +220,7 @@ bool PathMappingList::FindFile(const Fil new_spec.SetFile(pos->second.GetCString(), false, FileSpec::Style::native); new_spec.AppendPathComponent(orig_path + prefix_len); - if (new_spec.Exists()) + if (FileSystem::Instance().Exists(new_spec)) return true; } } Modified: lldb/trunk/source/Target/Platform.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Target/Platform.cpp (original) +++ lldb/trunk/source/Target/Platform.cpp Thu Nov 1 10:09:25 2018 @@ -890,7 +890,7 @@ Platform::ResolveExecutable(const Module lldb::ModuleSP &exe_module_sp, const FileSpecList *module_search_paths_ptr) { Status error; - if (module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) { if (module_spec.GetArchitecture().IsValid()) { error = ModuleList::GetSharedModule(module_spec, exe_module_sp, module_search_paths_ptr, nullptr, @@ -921,7 +921,7 @@ Platform::ResolveExecutable(const Module Status Platform::ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, FileSpec &sym_file) { Status error; - if (sym_spec.GetSymbolFileSpec().Exists()) + if (FileSystem::Instance().Exists(sym_spec.GetSymbolFileSpec())) sym_file = sym_spec.GetSymbolFileSpec(); else error.SetErrorString("unable to resolve symbol file"); Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Thu Nov 1 10:09:25 2018 @@ -2734,7 +2734,7 @@ Status Process::Launch(ProcessLaunchInfo sizeof(local_exec_file_path)); exe_module->GetPlatformFileSpec().GetPath(platform_exec_file_path, sizeof(platform_exec_file_path)); - if (exe_module->GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(exe_module->GetFileSpec())) { // Install anything that might need to be installed prior to launching. // For host systems, this will do nothing, but if we are connected to a // remote platform it will install any needed binaries Modified: lldb/trunk/source/Target/TargetList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Target/TargetList.cpp (original) +++ lldb/trunk/source/Target/TargetList.cpp Thu Nov 1 10:09:25 2018 @@ -347,7 +347,7 @@ Status TargetList::CreateTargetInternal( arch = specified_arch; FileSpec file(user_exe_path, false); - if (!file.Exists() && user_exe_path.startswith("~")) { + if (!FileSystem::Instance().Exists(file) && user_exe_path.startswith("~")) { // we want to expand the tilde but we don't want to resolve any symbolic // links so we can't use the FileSpec constructor's resolve flag llvm::SmallString<64> unglobbed_path; @@ -372,7 +372,7 @@ Status TargetList::CreateTargetInternal( if (! llvm::sys::fs::current_path(cwd)) { FileSpec cwd_file(cwd.c_str(), false); cwd_file.AppendPathComponent(file); - if (cwd_file.Exists()) + if (FileSystem::Instance().Exists(cwd_file)) file = cwd_file; } } Modified: lldb/trunk/source/Utility/FileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/FileSpec.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Utility/FileSpec.cpp (original) +++ lldb/trunk/source/Utility/FileSpec.cpp Thu Nov 1 10:09:25 2018 @@ -453,11 +453,6 @@ void FileSpec::Dump(Stream *s) const { } } -//------------------------------------------------------------------ -// Returns true if the file exists. -//------------------------------------------------------------------ -bool FileSpec::Exists() const { return llvm::sys::fs::exists(GetPath()); } - bool FileSpec::ResolvePath() { if (m_is_resolved) return true; // We have already resolved this path Modified: lldb/trunk/source/Utility/StructuredData.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StructuredData.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/source/Utility/StructuredData.cpp (original) +++ lldb/trunk/source/Utility/StructuredData.cpp Thu Nov 1 10:09:25 2018 @@ -33,11 +33,6 @@ static StructuredData::ObjectSP ParseJSO StructuredData::ObjectSP StructuredData::ParseJSONFromFile(const FileSpec &input_spec, Status &error) { StructuredData::ObjectSP return_sp; - if (!input_spec.Exists()) { - error.SetErrorStringWithFormatv("input file {0} does not exist.", - input_spec); - return return_sp; - } auto buffer_or_error = llvm::MemoryBuffer::getFile(input_spec.GetPath()); if (!buffer_or_error) { Modified: lldb/trunk/unittests/Target/ModuleCacheTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Target/ModuleCacheTest.cpp?rev=345854&r1=345853&r2=345854&view=diff ============================================================================== --- lldb/trunk/unittests/Target/ModuleCacheTest.cpp (original) +++ lldb/trunk/unittests/Target/ModuleCacheTest.cpp Thu Nov 1 10:09:25 2018 @@ -82,12 +82,13 @@ void ModuleCacheTest::TearDownTestCase() static void VerifyDiskState(const FileSpec &cache_dir, const char *hostname) { FileSpec uuid_view = GetUuidView(cache_dir); - EXPECT_TRUE(uuid_view.Exists()) << "uuid_view is: " << uuid_view.GetCString(); + EXPECT_TRUE(FileSystem::Instance().Exists(uuid_view)) + << "uuid_view is: " << uuid_view.GetCString(); EXPECT_EQ(module_size, FileSystem::Instance().GetByteSize(uuid_view)); FileSpec sysroot_view = GetSysrootView(cache_dir, hostname); - EXPECT_TRUE(sysroot_view.Exists()) << "sysroot_view is: " - << sysroot_view.GetCString(); + EXPECT_TRUE(FileSystem::Instance().Exists(sysroot_view)) + << "sysroot_view is: " << sysroot_view.GetCString(); EXPECT_EQ(module_size, FileSystem::Instance().GetByteSize(sysroot_view)); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits