diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-01 21:05:36 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-01 21:05:36 +0000 |
commit | 8f3be7a32b631e9ba584872c1f0dde8fd8536c07 (patch) | |
tree | b4cfca7eb1e0996decd88a2b1dd1954ff3d7ff28 /lldb/source/Host/macosx/objcxx | |
parent | 8487d22d12f5b7b5c745e5a5cdda61f8a07391e1 (diff) | |
download | bcm5719-llvm-8f3be7a32b631e9ba584872c1f0dde8fd8536c07.tar.gz bcm5719-llvm-8f3be7a32b631e9ba584872c1f0dde8fd8536c07.zip |
[FileSystem] Move path resolution logic out of FileSpec
This patch removes the logic for resolving paths out of FileSpec and
updates call sites to rely on the FileSystem class instead.
Differential revision: https://reviews.llvm.org/D53915
llvm-svn: 345890
Diffstat (limited to 'lldb/source/Host/macosx/objcxx')
-rw-r--r-- | lldb/source/Host/macosx/objcxx/Host.mm | 11 | ||||
-rw-r--r-- | lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | 14 |
2 files changed, 13 insertions, 12 deletions
diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm index 0e39a58602b..6d6cf6a3199 100644 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -106,7 +106,7 @@ bool Host::GetBundleDirectory(const FileSpec &file, if (file.GetPath(path, sizeof(path))) { CFCBundle bundle(path); if (bundle.GetPath(path, sizeof(path))) { - bundle_directory.SetFile(path, false, FileSpec::Style::native); + bundle_directory.SetFile(path, FileSpec::Style::native); return true; } } @@ -126,7 +126,7 @@ bool Host::ResolveExecutableInBundle(FileSpec &file) { if (url.get()) { if (::CFURLGetFileSystemRepresentation(url.get(), YES, (UInt8 *)path, sizeof(path))) { - file.SetFile(path, false, FileSpec::Style::native); + file.SetFile(path, FileSpec::Style::native); return true; } } @@ -542,8 +542,7 @@ static bool GetMacOSXProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr, triple_arch == llvm::Triple::x86_64); const char *cstr = data.GetCStr(&offset); if (cstr) { - process_info.GetExecutableFile().SetFile(cstr, false, - FileSpec::Style::native); + process_info.GetExecutableFile().SetFile(cstr, FileSpec::Style::native); if (match_info_ptr == NULL || NameMatches( @@ -1279,7 +1278,7 @@ Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) { llvm::sys::fs::file_status stats; status(exe_spec.GetPath(), stats); if (!exists(stats)) { - exe_spec.ResolvePath(); + FileSystem::Instance().Resolve(exe_spec); status(exe_spec.GetPath(), stats); } if (!exists(stats)) { @@ -1362,7 +1361,7 @@ Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) { "cwd does not exist; cannot launch with shell argument expansion"); return error; } else { - FileSpec working_dir(wd, false); + FileSpec working_dir(wd); free(wd); launch_info.SetWorkingDirectory(working_dir); } diff --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm index 1bfe78bd261..e9f84778b82 100644 --- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm +++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm @@ -7,8 +7,9 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Host/HostInfo.h" #include "lldb/Host/macosx/HostInfoMacOSX.h" +#include "lldb/Host/FileSystem.h" +#include "lldb/Host/HostInfo.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/Log.h" @@ -96,14 +97,13 @@ FileSpec HostInfoMacOSX::GetProgramFileSpec() { uint32_t len = sizeof(program_fullpath); int err = _NSGetExecutablePath(program_fullpath, &len); if (err == 0) - g_program_filespec.SetFile(program_fullpath, false, - FileSpec::Style::native); + g_program_filespec.SetFile(program_fullpath, FileSpec::Style::native); else if (err == -1) { char *large_program_fullpath = (char *)::malloc(len + 1); err = _NSGetExecutablePath(large_program_fullpath, &len); if (err == 0) - g_program_filespec.SetFile(large_program_fullpath, false, + g_program_filespec.SetFile(large_program_fullpath, FileSpec::Style::native); ::free(large_program_fullpath); @@ -139,7 +139,8 @@ bool HostInfoMacOSX::ComputeSupportExeDirectory(FileSpec &file_spec) { // as in the case of a python script, the executable is python, not // the lldb driver. raw_path.append("/../bin"); - FileSpec support_dir_spec(raw_path, true); + FileSpec support_dir_spec(raw_path); + FileSystem::Instance().Resolve(support_dir_spec); if (!llvm::sys::fs::is_directory(support_dir_spec.GetPath())) { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (log) @@ -203,7 +204,8 @@ bool HostInfoMacOSX::ComputeSystemPluginsDirectory(FileSpec &file_spec) { } bool HostInfoMacOSX::ComputeUserPluginsDirectory(FileSpec &file_spec) { - FileSpec temp_file("~/Library/Application Support/LLDB/PlugIns", true); + FileSpec temp_file("~/Library/Application Support/LLDB/PlugIns"); + FileSystem::Instance().Resolve(temp_file); file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str()); return true; } |