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/Plugins/ObjectFile/Mach-O | |
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/Plugins/ObjectFile/Mach-O')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index b15094e0769..d92f6bc3176 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -2183,7 +2183,7 @@ size_t ObjectFileMachO::ParseSymtab() { uint32_t name_offset = cmd_offset + m_data.GetU32(&offset); const char *path = m_data.PeekCStr(name_offset); if (path) { - FileSpec file_spec(path, false); + FileSpec file_spec(path); // Strip the path if there is @rpath, @executable, etc so we just use // the basename if (path[0] == '@') @@ -4017,9 +4017,9 @@ size_t ObjectFileMachO::ParseSymtab() { // string in the DW_AT_comp_dir, and the second is the // 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); + FileSpec so_dir(so_path); if (!FileSystem::Instance().Exists(so_dir)) { - so_dir.SetFile(&full_so_path[double_slash_pos + 1], false, + so_dir.SetFile(&full_so_path[double_slash_pos + 1], FileSpec::Style::native); if (FileSystem::Instance().Exists(so_dir)) { // Trim off the incorrect path @@ -5084,9 +5084,6 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) { std::vector<std::string> rpath_paths; std::vector<std::string> rpath_relative_paths; std::vector<std::string> at_exec_relative_paths; - const bool resolve_path = false; // Don't resolve the dependent file paths - // since they may not reside on this - // system uint32_t i; for (i = 0; i < m_header.ncmds; ++i) { const uint32_t cmd_offset = offset; @@ -5115,7 +5112,7 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) { at_exec_relative_paths.push_back(path + strlen("@executable_path")); } else { - FileSpec file_spec(path, resolve_path); + FileSpec file_spec(path); if (files.AppendIfUnique(file_spec)) count++; } @@ -5130,8 +5127,8 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) { } FileSpec this_file_spec(m_file); - this_file_spec.ResolvePath(); - + FileSystem::Instance().Resolve(this_file_spec); + if (!rpath_paths.empty()) { // Fixup all LC_RPATH values to be absolute paths std::string loader_path("@loader_path"); @@ -5152,7 +5149,8 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) { path += rpath_relative_path; // 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); + FileSpec file_spec(path); + FileSystem::Instance().Resolve(file_spec); if (FileSystem::Instance().Exists(file_spec) && files.AppendIfUnique(file_spec)) { count++; |