[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
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index 65bc051..862e489 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -435,8 +435,8 @@
if (header.filetype == llvm::MachO::MH_EXECUTE &&
(header.flags & llvm::MachO::MH_DYLDLINK) == 0) {
// Create a full module to get the UUID
- ModuleSP memory_module_sp = process->ReadModuleFromMemory(
- FileSpec("temp_mach_kernel", false), addr);
+ ModuleSP memory_module_sp =
+ process->ReadModuleFromMemory(FileSpec("temp_mach_kernel"), addr);
if (!memory_module_sp.get())
return UUID();
@@ -646,8 +646,7 @@
if (m_load_address == LLDB_INVALID_ADDRESS)
return false;
- FileSpec file_spec;
- file_spec.SetFile(m_name.c_str(), false, FileSpec::Style::native);
+ FileSpec file_spec(m_name.c_str());
llvm::MachO::mach_header mh;
size_t size_to_read = 512;
@@ -807,7 +806,7 @@
PlatformDarwinKernel::GetPluginNameStatic());
if (platform_name == g_platform_name) {
ModuleSpec kext_bundle_module_spec(module_spec);
- FileSpec kext_filespec(m_name.c_str(), false);
+ FileSpec kext_filespec(m_name.c_str());
kext_bundle_module_spec.GetFileSpec() = kext_filespec;
platform_sp->GetSharedModule(
kext_bundle_module_spec, process, m_module_sp,
diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
index 648c169..d97bd05 100644
--- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
@@ -367,7 +367,8 @@
E = m_rendezvous.loaded_end();
for (I = m_rendezvous.loaded_begin(); I != E; ++I) {
- FileSpec file(I->path, true);
+ FileSpec file(I->path);
+ FileSystem::Instance().Resolve(file);
ModuleSP module_sp =
LoadModuleAtAddress(file, I->link_addr, I->base_addr, true);
if (module_sp.get()) {
@@ -391,7 +392,8 @@
E = m_rendezvous.unloaded_end();
for (I = m_rendezvous.unloaded_begin(); I != E; ++I) {
- FileSpec file(I->path, true);
+ FileSpec file(I->path);
+ FileSystem::Instance().Resolve(file);
ModuleSpec module_spec(file);
ModuleSP module_sp = loaded_modules.FindFirstModule(module_spec);
@@ -485,7 +487,7 @@
for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I) {
const char *module_path = I->path.c_str();
- FileSpec file(module_path, false);
+ FileSpec file(module_path);
ModuleSP module_sp =
LoadModuleAtAddress(file, I->link_addr, I->base_addr, true);
if (module_sp.get()) {
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 1ee091c..595e848 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -374,7 +374,7 @@
image_infos[i].mod_date =
image->GetValueForKey("mod_date")->GetAsInteger()->GetValue();
image_infos[i].file_spec.SetFile(
- image->GetValueForKey("pathname")->GetAsString()->GetValue(), false,
+ image->GetValueForKey("pathname")->GetAsString()->GetValue(),
FileSpec::Style::native);
StructuredData::Dictionary *mh =
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index 556cc39..50ed1ef 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -693,9 +693,7 @@
error);
// don't resolve the path
if (error.Success()) {
- const bool resolve_path = false;
- image_infos[i].file_spec.SetFile(raw_path, resolve_path,
- FileSpec::Style::native);
+ image_infos[i].file_spec.SetFile(raw_path, FileSpec::Style::native);
}
}
return true;
@@ -894,7 +892,8 @@
const lldb::offset_t name_offset =
load_cmd_offset + data.GetU32(&offset);
const char *path = data.PeekCStr(name_offset);
- lc_id_dylinker->SetFile(path, true, FileSpec::Style::native);
+ lc_id_dylinker->SetFile(path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(*lc_id_dylinker);
}
break;
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
index b1513b5..68eb338 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -243,7 +243,7 @@
entry.base_addr = base_addr;
entry.dyn_addr = dyn_addr;
- entry.file_spec.SetFile(name, false, FileSpec::Style::native);
+ entry.file_spec.SetFile(name, FileSpec::Style::native);
UpdateBaseAddrIfNecessary(entry, name);
@@ -517,7 +517,7 @@
return false;
std::string file_path = ReadStringFromMemory(entry.path_addr);
- entry.file_spec.SetFile(file_path, false, FileSpec::Style::native);
+ entry.file_spec.SetFile(file_path, FileSpec::Style::native);
UpdateBaseAddrIfNecessary(entry, file_path);
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 6edc05d..5892e97 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -512,7 +512,7 @@
if (m_vdso_base == LLDB_INVALID_ADDRESS)
return;
- FileSpec file("[vdso]", false);
+ FileSpec file("[vdso]");
MemoryRegionInfo info;
Status status = m_process->GetMemoryRegionInfo(m_vdso_base, info);
@@ -543,7 +543,7 @@
return nullptr;
}
- FileSpec file(info.GetName().GetCString(), false);
+ FileSpec file(info.GetName().GetCString());
ModuleSpec module_spec(file, target.GetArchitecture());
if (ModuleSP module_sp = target.GetSharedModule(module_spec)) {