aboutsummaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/Target/Process.h2
-rw-r--r--lldb/include/lldb/Utility/FileSpec.h42
-rw-r--r--lldb/source/API/SBAttachInfo.cpp9
-rw-r--r--lldb/source/API/SBDebugger.cpp2
-rw-r--r--lldb/source/API/SBFileSpec.cpp12
-rw-r--r--lldb/source/API/SBHostOS.cpp6
-rw-r--r--lldb/source/API/SBLaunchInfo.cpp7
-rw-r--r--lldb/source/API/SBModuleSpec.cpp3
-rw-r--r--lldb/source/API/SBPlatform.cpp14
-rw-r--r--lldb/source/API/SBProcess.cpp9
-rw-r--r--lldb/source/API/SBTarget.cpp24
-rw-r--r--lldb/source/Breakpoint/BreakpointResolverAddress.cpp2
-rw-r--r--lldb/source/Breakpoint/BreakpointResolverFileLine.cpp2
-rw-r--r--lldb/source/Commands/CommandCompletions.cpp4
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp13
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectLog.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectPlatform.cpp36
-rw-r--r--lldb/source/Commands/CommandObjectPlugin.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp16
-rw-r--r--lldb/source/Commands/CommandObjectSettings.cpp7
-rw-r--r--lldb/source/Commands/CommandObjectSource.cpp10
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp19
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp2
-rw-r--r--lldb/source/Core/Debugger.cpp4
-rw-r--r--lldb/source/Core/DynamicLoader.cpp5
-rw-r--r--lldb/source/Core/Module.cpp2
-rw-r--r--lldb/source/Core/ModuleList.cpp5
-rw-r--r--lldb/source/Core/PluginManager.cpp4
-rw-r--r--lldb/source/Core/SearchFilter.cpp8
-rw-r--r--lldb/source/Expression/REPL.cpp4
-rw-r--r--lldb/source/Host/common/Editline.cpp8
-rw-r--r--lldb/source/Host/common/File.cpp4
-rw-r--r--lldb/source/Host/common/FileSystem.cpp5
-rw-r--r--lldb/source/Host/common/Host.cpp8
-rw-r--r--lldb/source/Host/common/HostInfoBase.cpp3
-rw-r--r--lldb/source/Host/common/MonitoringProcessLauncher.cpp2
-rw-r--r--lldb/source/Host/common/Symbols.cpp31
-rw-r--r--lldb/source/Host/linux/Host.cpp3
-rw-r--r--lldb/source/Host/linux/HostInfoLinux.cpp5
-rw-r--r--lldb/source/Host/macosx/Symbols.cpp41
-rw-r--r--lldb/source/Host/macosx/objcxx/Host.mm11
-rw-r--r--lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm14
-rw-r--r--lldb/source/Host/posix/FileSystem.cpp4
-rw-r--r--lldb/source/Host/posix/HostInfoPosix.cpp4
-rw-r--r--lldb/source/Host/posix/HostProcessPosix.cpp2
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp18
-rw-r--r--lldb/source/Interpreter/OptionValueFileSpec.cpp4
-rw-r--r--lldb/source/Interpreter/OptionValueFileSpecLIst.cpp6
-rw-r--r--lldb/source/Interpreter/Options.cpp2
-rw-r--r--lldb/source/Interpreter/Property.cpp6
-rw-r--r--lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp9
-rw-r--r--lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp8
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp2
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp7
-rw-r--r--lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp4
-rw-r--r--lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp4
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp10
-rw-r--r--lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp4
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp9
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp6
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp18
-rw-r--r--lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp7
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp5
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp8
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp8
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp33
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp31
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp6
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp22
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp8
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm2
-rw-r--r--lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp6
-rw-r--r--lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp3
-rw-r--r--lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp3
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp10
-rw-r--r--lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp3
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp10
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp39
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp4
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp13
-rw-r--r--lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp4
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp3
-rw-r--r--lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp20
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp6
-rw-r--r--lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp2
-rw-r--r--lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp14
-rw-r--r--lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp8
-rw-r--r--lldb/source/Symbol/CompileUnit.cpp2
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp2
-rw-r--r--lldb/source/Symbol/Symbol.cpp2
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp6
-rw-r--r--lldb/source/Target/ModuleCache.cpp4
-rw-r--r--lldb/source/Target/PathMappingList.cpp13
-rw-r--r--lldb/source/Target/Platform.cpp22
-rw-r--r--lldb/source/Target/Process.cpp12
-rw-r--r--lldb/source/Target/ProcessInfo.cpp10
-rw-r--r--lldb/source/Target/ProcessLaunchInfo.cpp8
-rw-r--r--lldb/source/Target/TargetList.cpp12
-rw-r--r--lldb/source/Utility/FileSpec.cpp111
-rw-r--r--lldb/tools/lldb-server/lldb-gdbserver.cpp6
-rw-r--r--lldb/tools/lldb-server/lldb-platform.cpp4
-rw-r--r--lldb/tools/lldb-test/lldb-test.cpp10
-rw-r--r--lldb/unittests/Core/MangledTest.cpp4
-rw-r--r--lldb/unittests/Editline/EditlineTest.cpp5
-rw-r--r--lldb/unittests/Expression/ClangParserTest.cpp2
-rw-r--r--lldb/unittests/Host/FileSystemTest.cpp26
-rw-r--r--lldb/unittests/Host/SymbolsTest.cpp3
-rw-r--r--lldb/unittests/Host/linux/HostTest.cpp11
-rw-r--r--lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp6
-rw-r--r--lldb/unittests/Platform/PlatformDarwinTest.cpp17
-rw-r--r--lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp10
-rw-r--r--lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp2
-rw-r--r--lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp2
-rw-r--r--lldb/unittests/Target/ModuleCacheTest.cpp2
-rw-r--r--lldb/unittests/Target/PathMappingListTest.cpp5
-rw-r--r--lldb/unittests/Utility/FileSpecTest.cpp83
-rw-r--r--lldb/unittests/Utility/StructuredDataTest.cpp4
128 files changed, 627 insertions, 628 deletions
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index d669f56..b16fabe 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -319,7 +319,7 @@ public:
NameMatch process_name_match_type)
: m_match_info(), m_name_match_type(process_name_match_type),
m_match_all_users(false) {
- m_match_info.GetExecutableFile().SetFile(process_name, false,
+ m_match_info.GetExecutableFile().SetFile(process_name,
FileSpec::Style::native);
}
diff --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h
index 2067535..232ecda 100644
--- a/lldb/include/lldb/Utility/FileSpec.h
+++ b/lldb/include/lldb/Utility/FileSpec.h
@@ -70,23 +70,19 @@ public:
///
/// Takes a path to a file which can be just a filename, or a full path. If
/// \a path is not nullptr or empty, this function will call
- /// FileSpec::SetFile (const char *path, bool resolve).
+ /// FileSpec::SetFile (const char *path).
///
/// @param[in] path
/// The full or partial path to a file.
///
- /// @param[in] resolve_path
- /// If \b true, then we resolve the path, removing stray ../.. and so
- /// forth,
- /// if \b false we trust the path is in canonical form already.
+ /// @param[in] style
+ /// The style of the path
///
- /// @see FileSpec::SetFile (const char *path, bool resolve)
+ /// @see FileSpec::SetFile (const char *path)
//------------------------------------------------------------------
- explicit FileSpec(llvm::StringRef path, bool resolve_path,
- Style style = Style::native);
+ explicit FileSpec(llvm::StringRef path, Style style = Style::native);
- explicit FileSpec(llvm::StringRef path, bool resolve_path,
- const llvm::Triple &Triple);
+ explicit FileSpec(llvm::StringRef path, const llvm::Triple &Triple);
//------------------------------------------------------------------
/// Copy constructor
@@ -272,13 +268,6 @@ public:
//------------------------------------------------------------------
void Dump(Stream *s) 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.
- //------------------------------------------------------------------
- bool ResolvePath();
-
Style GetPathStyle() const;
//------------------------------------------------------------------
@@ -342,7 +331,7 @@ public:
bool IsAbsolute() const;
/// Temporary helper for FileSystem change.
- void SetPath(llvm::StringRef p) { SetFile(p, false); }
+ void SetPath(llvm::StringRef p) { SetFile(p); }
//------------------------------------------------------------------
/// Extract the full path to the file.
@@ -446,10 +435,9 @@ public:
/// If \b true, then we will try to resolve links the path using
/// the static FileSpec::Resolve.
//------------------------------------------------------------------
- void SetFile(llvm::StringRef path, bool resolve_path, Style style);
+ void SetFile(llvm::StringRef path, Style style);
- void SetFile(llvm::StringRef path, bool resolve_path,
- const llvm::Triple &Triple);
+ void SetFile(llvm::StringRef path, const llvm::Triple &Triple);
bool IsResolved() const { return m_is_resolved; }
@@ -468,16 +456,6 @@ public:
//------------------------------------------------------------------
void SetIsResolved(bool is_resolved) { m_is_resolved = is_resolved; }
- //------------------------------------------------------------------
- /// Resolves user name and links in \a path, and overwrites the input
- /// argument with the resolved path.
- ///
- /// @param[in] path
- /// Input path to be resolved, in the form of a llvm::SmallString or
- /// similar.
- //------------------------------------------------------------------
- static void Resolve(llvm::SmallVectorImpl<char> &path);
-
FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const;
FileSpec CopyByRemovingLastPathComponent() const;
@@ -502,7 +480,7 @@ protected:
//------------------------------------------------------------------
// Convenience method for setting the file without changing the style.
//------------------------------------------------------------------
- void SetFile(llvm::StringRef path, bool resolve_path);
+ void SetFile(llvm::StringRef path);
//------------------------------------------------------------------
// Member variables
diff --git a/lldb/source/API/SBAttachInfo.cpp b/lldb/source/API/SBAttachInfo.cpp
index d6cb212..a74487a 100644
--- a/lldb/source/API/SBAttachInfo.cpp
+++ b/lldb/source/API/SBAttachInfo.cpp
@@ -26,16 +26,14 @@ SBAttachInfo::SBAttachInfo(lldb::pid_t pid)
SBAttachInfo::SBAttachInfo(const char *path, bool wait_for)
: m_opaque_sp(new ProcessAttachInfo()) {
if (path && path[0])
- m_opaque_sp->GetExecutableFile().SetFile(path, false,
- FileSpec::Style::native);
+ m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native);
m_opaque_sp->SetWaitForLaunch(wait_for);
}
SBAttachInfo::SBAttachInfo(const char *path, bool wait_for, bool async)
: m_opaque_sp(new ProcessAttachInfo()) {
if (path && path[0])
- m_opaque_sp->GetExecutableFile().SetFile(path, false,
- FileSpec::Style::native);
+ m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native);
m_opaque_sp->SetWaitForLaunch(wait_for);
m_opaque_sp->SetAsync(async);
}
@@ -79,8 +77,7 @@ void SBAttachInfo::SetProcessPluginName(const char *plugin_name) {
void SBAttachInfo::SetExecutable(const char *path) {
if (path && path[0])
- m_opaque_sp->GetExecutableFile().SetFile(path, false,
- FileSpec::Style::native);
+ m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native);
else
m_opaque_sp->GetExecutableFile().Clear();
}
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index ad6147d..c7dc478 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -735,7 +735,7 @@ SBTarget SBDebugger::FindTargetWithFileAndArch(const char *filename,
m_opaque_sp->GetPlatformList().GetSelectedPlatform().get(), arch_name);
TargetSP target_sp(
m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture(
- FileSpec(filename, false), arch_name ? &arch : nullptr));
+ FileSpec(filename), arch_name ? &arch : nullptr));
sb_target.SetSP(target_sp);
}
return sb_target;
diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp
index 067db0d..0a8a281 100644
--- a/lldb/source/API/SBFileSpec.cpp
+++ b/lldb/source/API/SBFileSpec.cpp
@@ -32,11 +32,15 @@ SBFileSpec::SBFileSpec(const lldb_private::FileSpec &fspec)
: m_opaque_ap(new lldb_private::FileSpec(fspec)) {}
// Deprecated!!!
-SBFileSpec::SBFileSpec(const char *path)
- : m_opaque_ap(new FileSpec(path, true)) {}
+SBFileSpec::SBFileSpec(const char *path) : m_opaque_ap(new FileSpec(path)) {
+ FileSystem::Instance().Resolve(*m_opaque_ap);
+}
SBFileSpec::SBFileSpec(const char *path, bool resolve)
- : m_opaque_ap(new FileSpec(path, resolve)) {}
+ : m_opaque_ap(new FileSpec(path)) {
+ if (resolve)
+ FileSystem::Instance().Resolve(*m_opaque_ap);
+}
SBFileSpec::~SBFileSpec() {}
@@ -68,7 +72,7 @@ bool SBFileSpec::ResolveExecutableLocation() {
int SBFileSpec::ResolvePath(const char *src_path, char *dst_path,
size_t dst_len) {
llvm::SmallString<64> result(src_path);
- lldb_private::FileSpec::Resolve(result);
+ FileSystem::Instance().Resolve(result);
::snprintf(dst_path, dst_len, "%s", result.c_str());
return std::min(dst_len - 1, result.size());
}
diff --git a/lldb/source/API/SBHostOS.cpp b/lldb/source/API/SBHostOS.cpp
index e56951d..ac6ab40 100644
--- a/lldb/source/API/SBHostOS.cpp
+++ b/lldb/source/API/SBHostOS.cpp
@@ -11,8 +11,9 @@
#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
#endif
-#include "lldb/API/SBHostOS.h"
#include "lldb/API/SBError.h"
+#include "lldb/API/SBHostOS.h"
+#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/HostNativeThread.h"
@@ -86,7 +87,8 @@ SBFileSpec SBHostOS::GetUserHomeDirectory() {
llvm::SmallString<64> home_dir_path;
llvm::sys::path::home_directory(home_dir_path);
- FileSpec homedir(home_dir_path.c_str(), true);
+ FileSpec homedir(home_dir_path.c_str());
+ FileSystem::Instance().Resolve(homedir);
sb_fspec.SetFileSpec(homedir);
return sb_fspec;
diff --git a/lldb/source/API/SBLaunchInfo.cpp b/lldb/source/API/SBLaunchInfo.cpp
index aa1759a..b1bbfa5 100644
--- a/lldb/source/API/SBLaunchInfo.cpp
+++ b/lldb/source/API/SBLaunchInfo.cpp
@@ -128,7 +128,7 @@ const char *SBLaunchInfo::GetWorkingDirectory() const {
}
void SBLaunchInfo::SetWorkingDirectory(const char *working_dir) {
- m_opaque_sp->SetWorkingDirectory(FileSpec{working_dir, false});
+ m_opaque_sp->SetWorkingDirectory(FileSpec(working_dir));
}
uint32_t SBLaunchInfo::GetLaunchFlags() {
@@ -155,7 +155,7 @@ const char *SBLaunchInfo::GetShell() {
}
void SBLaunchInfo::SetShell(const char *path) {
- m_opaque_sp->SetShell(FileSpec(path, false));
+ m_opaque_sp->SetShell(FileSpec(path));
}
bool SBLaunchInfo::GetShellExpandArguments() {
@@ -184,8 +184,7 @@ bool SBLaunchInfo::AddDuplicateFileAction(int fd, int dup_fd) {
bool SBLaunchInfo::AddOpenFileAction(int fd, const char *path, bool read,
bool write) {
- return m_opaque_sp->AppendOpenFileAction(fd, FileSpec{path, false}, read,
- write);
+ return m_opaque_sp->AppendOpenFileAction(fd, FileSpec(path), read, write);
}
bool SBLaunchInfo::AddSuppressFileAction(int fd, bool read, bool write) {
diff --git a/lldb/source/API/SBModuleSpec.cpp b/lldb/source/API/SBModuleSpec.cpp
index afabd9a..65492f5 100644
--- a/lldb/source/API/SBModuleSpec.cpp
+++ b/lldb/source/API/SBModuleSpec.cpp
@@ -114,7 +114,8 @@ SBModuleSpecList::~SBModuleSpecList() {}
SBModuleSpecList SBModuleSpecList::GetModuleSpecifications(const char *path) {
SBModuleSpecList specs;
- FileSpec file_spec(path, true);
+ FileSpec file_spec(path);
+ FileSystem::Instance().Resolve(file_spec);
Host::ResolveExecutableInBundle(file_spec);
ObjectFile::GetModuleSpecifications(file_spec, 0, 0, *specs.m_opaque_ap);
return specs;
diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp
index bce3fd7..2c254b2 100644
--- a/lldb/source/API/SBPlatform.cpp
+++ b/lldb/source/API/SBPlatform.cpp
@@ -244,9 +244,9 @@ bool SBPlatform::SetWorkingDirectory(const char *path) {
PlatformSP platform_sp(GetSP());
if (platform_sp) {
if (path)
- platform_sp->SetWorkingDirectory(FileSpec{path, false});
+ platform_sp->SetWorkingDirectory(FileSpec(path));
else
- platform_sp->SetWorkingDirectory(FileSpec{});
+ platform_sp->SetWorkingDirectory(FileSpec());
return true;
}
return false;
@@ -406,7 +406,7 @@ SBError SBPlatform::Run(SBPlatformShellCommand &shell_command) {
if (working_dir)
shell_command.SetWorkingDirectory(working_dir);
}
- return platform_sp->RunShellCommand(command, FileSpec{working_dir, false},
+ return platform_sp->RunShellCommand(command, FileSpec(working_dir),
&shell_command.m_opaque_ptr->m_status,
&shell_command.m_opaque_ptr->m_signo,
&shell_command.m_opaque_ptr->m_output,
@@ -449,7 +449,7 @@ SBError SBPlatform::MakeDirectory(const char *path, uint32_t file_permissions) {
PlatformSP platform_sp(GetSP());
if (platform_sp) {
sb_error.ref() =
- platform_sp->MakeDirectory(FileSpec{path, false}, file_permissions);
+ platform_sp->MakeDirectory(FileSpec(path), file_permissions);
} else {
sb_error.SetErrorString("invalid platform");
}
@@ -460,7 +460,7 @@ uint32_t SBPlatform::GetFilePermissions(const char *path) {
PlatformSP platform_sp(GetSP());
if (platform_sp) {
uint32_t file_permissions = 0;
- platform_sp->GetFilePermissions(FileSpec{path, false}, file_permissions);
+ platform_sp->GetFilePermissions(FileSpec(path), file_permissions);
return file_permissions;
}
return 0;
@@ -471,8 +471,8 @@ SBError SBPlatform::SetFilePermissions(const char *path,
SBError sb_error;
PlatformSP platform_sp(GetSP());
if (platform_sp) {
- sb_error.ref() = platform_sp->SetFilePermissions(FileSpec{path, false},
- file_permissions);
+ sb_error.ref() =
+ platform_sp->SetFilePermissions(FileSpec(path), file_permissions);
} else {
sb_error.SetErrorString("invalid platform");
}
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index e79231d..c8b2943 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -130,10 +130,9 @@ bool SBProcess::RemoteLaunch(char const **argv, char const **envp,
if (process_sp->GetState() == eStateConnected) {
if (stop_at_entry)
launch_flags |= eLaunchFlagStopAtEntry;
- ProcessLaunchInfo launch_info(
- FileSpec{stdin_path, false}, FileSpec{stdout_path, false},
- FileSpec{stderr_path, false}, FileSpec{working_directory, false},
- launch_flags);
+ ProcessLaunchInfo launch_info(FileSpec(stdin_path), FileSpec(stdout_path),
+ FileSpec(stderr_path),
+ FileSpec(working_directory), launch_flags);
Module *exe_module = process_sp->GetTarget().GetExecutableModulePointer();
if (exe_module)
launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true);
@@ -1351,7 +1350,7 @@ lldb::SBError SBProcess::SaveCore(const char *file_name) {
return error;
}
- FileSpec core_file(file_name, false);
+ FileSpec core_file(file_name);
error.ref() = PluginManager::SaveCore(process_sp, core_file);
return error;
}
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 8b55927..e25fa31 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -226,7 +226,8 @@ SBProcess SBTarget::LoadCore(const char *core_file, lldb::SBError &error) {
SBProcess sb_process;
TargetSP target_sp(GetSP());
if (target_sp) {
- FileSpec filespec(core_file, true);
+ FileSpec filespec(core_file);
+ FileSystem::Instance().Resolve(filespec);
ProcessSP process_sp(target_sp->CreateProcess(
target_sp->GetDebugger().GetListener(), "", &filespec));
if (process_sp) {
@@ -325,10 +326,9 @@ SBProcess SBTarget::Launch(SBListener &listener, char const **argv,
if (getenv("LLDB_LAUNCH_FLAG_DISABLE_STDIO"))
launch_flags |= eLaunchFlagDisableSTDIO;
- ProcessLaunchInfo launch_info(
- FileSpec{stdin_path, false}, FileSpec{stdout_path, false},
- FileSpec{stderr_path, false}, FileSpec{working_directory, false},
- launch_flags);
+ ProcessLaunchInfo launch_info(FileSpec(stdin_path), FileSpec(stdout_path),
+ FileSpec(stderr_path),
+ FileSpec(working_directory), launch_flags);
Module *exe_module = target_sp->GetExecutableModulePointer();
if (exe_module)
@@ -516,8 +516,7 @@ lldb::SBProcess SBTarget::AttachToProcessWithName(
if (name && target_sp) {
ProcessAttachInfo attach_info;
- attach_info.GetExecutableFile().SetFile(name, false,
- FileSpec::Style::native);
+ attach_info.GetExecutableFile().SetFile(name, FileSpec::Style::native);
attach_info.SetWaitForLaunch(wait_for);
if (listener.IsValid())
attach_info.SetListener(listener.GetSP());
@@ -766,7 +765,7 @@ SBBreakpoint SBTarget::BreakpointCreateByName(const char *symbol_name,
const lldb::addr_t offset = 0;
if (module_name && module_name[0]) {
FileSpecList module_spec_list;
- module_spec_list.Append(FileSpec(module_name, false));
+ module_spec_list.Append(FileSpec(module_name));
sb_bp = target_sp->CreateBreakpoint(
&module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto,
eLanguageTypeUnknown, offset, skip_prologue, internal, hardware);
@@ -894,7 +893,7 @@ SBBreakpoint SBTarget::BreakpointCreateByRegex(const char *symbol_name_regex,
SBFileSpecList module_spec_list;
SBFileSpecList comp_unit_list;
if (module_name && module_name[0]) {
- module_spec_list.Append(FileSpec(module_name, false));
+ module_spec_list.Append(FileSpec(module_name));
}
return BreakpointCreateByRegex(symbol_name_regex, eLanguageTypeUnknown,
module_spec_list, comp_unit_list);
@@ -995,7 +994,7 @@ SBTarget::BreakpointCreateBySourceRegex(const char *source_regex,
SBFileSpecList module_spec_list;
if (module_name && module_name[0]) {
- module_spec_list.Append(FileSpec(module_name, false));
+ module_spec_list.Append(FileSpec(module_name));
}
SBFileSpecList source_file_list;
@@ -1549,7 +1548,7 @@ lldb::SBModule SBTarget::AddModule(const char *path, const char *triple,
if (target_sp) {
ModuleSpec module_spec;
if (path)
- module_spec.GetFileSpec().SetFile(path, false, FileSpec::Style::native);
+ module_spec.GetFileSpec().SetFile(path, FileSpec::Style::native);
if (uuid_cstr)
module_spec.GetUUID().SetFromStringRef(uuid_cstr);
@@ -1561,8 +1560,7 @@ lldb::SBModule SBTarget::AddModule(const char *path, const char *triple,
module_spec.GetArchitecture() = target_sp->GetArchitecture();
if (symfile)
- module_spec.GetSymbolFileSpec().SetFile(symfile, false,
- FileSpec::Style::native);
+ module_spec.GetSymbolFileSpec().SetFile(symfile, FileSpec::Style::native);
sb_module.SetSP(target_sp->GetSharedModule(module_spec));
}
diff --git a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp
index 194a7d1..811b823 100644
--- a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp
@@ -66,7 +66,7 @@ BreakpointResolver *BreakpointResolverAddress::CreateFromStructuredData(
error.SetErrorString("BRA::CFSD: Couldn't read module name entry.");
return nullptr;
}
- module_filespec.SetFile(module_name, false, FileSpec::Style::native);
+ module_filespec.SetFile(module_name, FileSpec::Style::native);
}
return new BreakpointResolverAddress(bkpt, address, module_filespec);
}
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
index 476da41..138af78 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -92,7 +92,7 @@ BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData(
return nullptr;
}
- FileSpec file_spec(filename, false);
+ FileSpec file_spec(filename);
return new BreakpointResolverFileLine(bkpt, file_spec, line_no, column,
offset, check_inlines, skip_prologue,
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp
index fbc9a33..af699a5 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -361,7 +361,7 @@ CommandCompletions::SourceFileCompleter::SourceFileCompleter(
CompletionRequest &request)
: CommandCompletions::Completer(interpreter, request),
m_include_support_files(include_support_files), m_matching_files() {
- FileSpec partial_spec(m_request.GetCursorArgumentPrefix(), false);
+ FileSpec partial_spec(m_request.GetCursorArgumentPrefix());
m_file_name = partial_spec.GetFilename().GetCString();
m_dir_name = partial_spec.GetDirectory().GetCString();
}
@@ -501,7 +501,7 @@ size_t CommandCompletions::SymbolCompleter::DoCompletion(SearchFilter *filter) {
CommandCompletions::ModuleCompleter::ModuleCompleter(
CommandInterpreter &interpreter, CompletionRequest &request)
: CommandCompletions::Completer(interpreter, request) {
- FileSpec partial_spec(m_request.GetCursorArgumentPrefix(), false);
+ FileSpec partial_spec(m_request.GetCursorArgumentPrefix());
m_file_name = partial_spec.GetFilename().GetCString();
m_dir_name = partial_spec.GetDirectory().GetCString();
}
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index 1f324c7..0002b7f 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -438,7 +438,7 @@ public:
} break;
case 'f':
- m_filenames.AppendIfUnique(FileSpec(option_arg, false));
+ m_filenames.AppendIfUnique(FileSpec(option_arg));
break;
case 'F':
@@ -557,7 +557,7 @@ public:
break;
case 's':
- m_modules.AppendIfUnique(FileSpec(option_arg, false));
+ m_modules.AppendIfUnique(FileSpec(option_arg));
break;
case 'S':
@@ -2370,7 +2370,8 @@ protected:
std::unique_lock<std::recursive_mutex> lock;
target->GetBreakpointList().GetListMutex(lock);
- FileSpec input_spec(m_options.m_filename, true);
+ FileSpec input_spec(m_options.m_filename);
+ FileSystem::Instance().Resolve(input_spec);
BreakpointIDList new_bps;
Status error = target->CreateBreakpointsFromFile(
input_spec, m_options.m_names, new_bps);
@@ -2504,8 +2505,10 @@ protected:
return false;
}
}
- Status error = target->SerializeBreakpointsToFile(
- FileSpec(m_options.m_filename, true), valid_bp_ids, m_options.m_append);
+ FileSpec file_spec(m_options.m_filename);
+ FileSystem::Instance().Resolve(file_spec);
+ Status error = target->SerializeBreakpointsToFile(file_spec, valid_bp_ids,
+ m_options.m_append);
if (!error.Success()) {
result.AppendErrorWithFormat("error serializing breakpoints: %s.",
error.AsCString());
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 7f50025..1759bef 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -308,7 +308,8 @@ protected:
return false;
}
- FileSpec cmd_file(command[0].ref, true);
+ FileSpec cmd_file(command[0].ref);
+ FileSystem::Instance().Resolve(cmd_file);
ExecutionContext *exe_ctx = nullptr; // Just use the default context.
// If any options were set, then use them
diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp
index 8cc21ec..6fca265 100644
--- a/lldb/source/Commands/CommandObjectLog.cpp
+++ b/lldb/source/Commands/CommandObjectLog.cpp
@@ -101,7 +101,8 @@ public:
switch (short_option) {
case 'f':
- log_file.SetFile(option_arg, true, FileSpec::Style::native);
+ log_file.SetFile(option_arg, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(log_file);
break;
case 't':
log_options |= LLDB_LOG_OPTION_THREADSAFE;
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 5fbc622..95001e0 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -1209,7 +1209,8 @@ public:
switch (short_option) {
case 'i':
- m_infile.SetFile(option_value, true, FileSpec::Style::native);
+ m_infile.SetFile(option_value, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(m_infile);
if (!FileSystem::Instance().Exists(m_infile)) {
m_infile.Clear();
error.SetErrorStringWithFormat("input file does not exist: '%s'",
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index b800174..6cbbf42 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -491,8 +491,7 @@ public:
else
mode = lldb::eFilePermissionsUserRWX | lldb::eFilePermissionsGroupRWX |
lldb::eFilePermissionsWorldRX;
- Status error =
- platform_sp->MakeDirectory(FileSpec{cmd_line, false}, mode);
+ Status error = platform_sp->MakeDirectory(FileSpec(cmd_line), mode);
if (error.Success()) {
result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
@@ -545,7 +544,7 @@ public:
perms = lldb::eFilePermissionsUserRW | lldb::eFilePermissionsGroupRW |
lldb::eFilePermissionsWorldRead;
lldb::user_id_t fd = platform_sp->OpenFile(
- FileSpec(cmd_line, false),
+ FileSpec(cmd_line),
File::eOpenOptionRead | File::eOpenOptionWrite |
File::eOpenOptionAppend | File::eOpenOptionCanCreate,
perms, error);
@@ -883,8 +882,8 @@ public:
if (platform_sp) {
const char *remote_file_path = args.GetArgumentAtIndex(0);
const char *local_file_path = args.GetArgumentAtIndex(1);
- Status error = platform_sp->GetFile(FileSpec(remote_file_path, false),
- FileSpec(local_file_path, false));
+ Status error = platform_sp->GetFile(FileSpec(remote_file_path),
+ FileSpec(local_file_path));
if (error.Success()) {
result.AppendMessageWithFormat(
"successfully get-file from %s (remote) to %s (host)\n",
@@ -949,8 +948,7 @@ public:
m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
if (platform_sp) {
std::string remote_file_path(args.GetArgumentAtIndex(0));
- user_id_t size =
- platform_sp->GetFileSize(FileSpec(remote_file_path, false));
+ user_id_t size = platform_sp->GetFileSize(FileSpec(remote_file_path));
if (size != UINT64_MAX) {
result.AppendMessageWithFormat("File size of %s (remote): %" PRIu64
"\n",
@@ -987,8 +985,9 @@ public:
const char *src = args.GetArgumentAtIndex(0);
const char *dst = args.GetArgumentAtIndex(1);
- FileSpec src_fs(src, true);
- FileSpec dst_fs(dst ? dst : src_fs.GetFilename().GetCString(), false);
+ FileSpec src_fs(src);
+ FileSystem::Instance().Resolve(src_fs);
+ FileSpec dst_fs(dst ? dst : src_fs.GetFilename().GetCString());
PlatformSP platform_sp(
m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
@@ -1336,31 +1335,31 @@ protected:
case 'n':
match_info.GetProcessInfo().GetExecutableFile().SetFile(
- option_arg, false, FileSpec::Style::native);
+ option_arg, FileSpec::Style::native);
match_info.SetNameMatchType(NameMatch::Equals);
break;
case 'e':
match_info.GetProcessInfo().GetExecutableFile().SetFile(
- option_arg, false, FileSpec::Style::native);
+ option_arg, FileSpec::Style::native);
match_info.SetNameMatchType(NameMatch::EndsWith);
break;
case 's':
match_info.GetProcessInfo().GetExecutableFile().SetFile(
- option_arg, false, FileSpec::Style::native);
+ option_arg, FileSpec::Style::native);
match_info.SetNameMatchType(NameMatch::StartsWith);
break;
case 'c':
match_info.GetProcessInfo().GetExecutableFile().SetFile(
- option_arg, false, FileSpec::Style::native);
+ option_arg, FileSpec::Style::native);
match_info.SetNameMatchType(NameMatch::Contains);
break;
case 'r':
match_info.GetProcessInfo().GetExecutableFile().SetFile(
- option_arg, false, FileSpec::Style::native);
+ option_arg, FileSpec::Style::native);
match_info.SetNameMatchType(NameMatch::RegularExpression);
break;
@@ -1529,7 +1528,7 @@ public:
break;
case 'n':
- attach_info.GetExecutableFile().SetFile(option_arg, false,
+ attach_info.GetExecutableFile().SetFile(option_arg,
FileSpec::Style::native);
break;
@@ -1576,7 +1575,7 @@ public:
ProcessInstanceInfoMatch match_info;
if (partial_name) {
match_info.GetProcessInfo().GetExecutableFile().SetFile(
- partial_name, false, FileSpec::Style::native);
+ partial_name, FileSpec::Style::native);
match_info.SetNameMatchType(NameMatch::StartsWith);
}
platform_sp->FindProcesses(match_info, process_infos);
@@ -1816,8 +1815,9 @@ public:
return false;
}
// TODO: move the bulk of this code over to the platform itself
- FileSpec src(args.GetArgumentAtIndex(0), true);
- FileSpec dst(args.GetArgumentAtIndex(1), false);
+ FileSpec src(args.GetArgumentAtIndex(0));
+ FileSystem::Instance().Resolve(src);
+ FileSpec dst(args.GetArgumentAtIndex(1));
if (!FileSystem::Instance().Exists(src)) {
result.AppendError("source location does not exist or is not accessible");
result.SetStatus(eReturnStatusFailed);
diff --git a/lldb/source/Commands/CommandObjectPlugin.cpp b/lldb/source/Commands/CommandObjectPlugin.cpp
index 13ef6b2..af450ae 100644
--- a/lldb/source/Commands/CommandObjectPlugin.cpp
+++ b/lldb/source/Commands/CommandObjectPlugin.cpp
@@ -63,7 +63,8 @@ protected:
Status error;
- FileSpec dylib_fspec(command[0].ref, true);
+ FileSpec dylib_fspec(command[0].ref);
+ FileSystem::Instance().Resolve(dylib_fspec);
if (m_interpreter.GetDebugger().LoadPlugin(dylib_fspec, error))
result.SetStatus(eReturnStatusSuccessFinishResult);
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 73af71f..2bd98b2 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -352,7 +352,7 @@ public:
break;
case 'n':
- attach_info.GetExecutableFile().SetFile(option_arg, false,
+ attach_info.GetExecutableFile().SetFile(option_arg,
FileSpec::Style::native);
break;
@@ -403,7 +403,7 @@ public:
ProcessInstanceInfoMatch match_info;
if (partial_name) {
match_info.GetProcessInfo().GetExecutableFile().SetFile(
- partial_name, false, FileSpec::Style::native);
+ partial_name, FileSpec::Style::native);
match_info.SetNameMatchType(NameMatch::StartsWith);
}
platform_sp->FindProcesses(match_info, process_infos);
@@ -975,7 +975,7 @@ public:
case 'i':
do_install = true;
if (!option_arg.empty())
- install_path.SetFile(option_arg, false, FileSpec::Style::native);
+ install_path.SetFile(option_arg, FileSpec::Style::native);
break;
default:
error.SetErrorStringWithFormat("invalid short option character '%c'",
@@ -1023,18 +1023,20 @@ protected:
uint32_t image_token = LLDB_INVALID_IMAGE_TOKEN;
if (!m_options.do_install) {
- FileSpec image_spec(image_path, false);
+ FileSpec image_spec(image_path);
platform->ResolveRemotePath(image_spec, image_spec);
image_token =
platform->LoadImage(process, FileSpec(), image_spec, error);
} else if (m_options.install_path) {
- FileSpec image_spec(image_path, true);
+ FileSpec image_spec(image_path);
+ FileSystem::Instance().Resolve(image_spec);
platform->ResolveRemotePath(m_options.install_path,
m_options.install_path);
image_token = platform->LoadImage(process, image_spec,
m_options.install_path, error);
} else {
- FileSpec image_spec(image_path, true);
+ FileSpec image_spec(image_path);
+ FileSystem::Instance().Resolve(image_spec);
image_token =
platform->LoadImage(process, image_spec, FileSpec(), error);
}
@@ -1281,7 +1283,7 @@ protected:
ProcessSP process_sp = m_exe_ctx.GetProcessSP();
if (process_sp) {
if (command.GetArgumentCount() == 1) {
- FileSpec output_file(command.GetArgumentAtIndex(0), false);
+ FileSpec output_file(command.GetArgumentAtIndex(0));
Status error = PluginManager::SaveCore(process_sp, output_file);
if (error.Success()) {
result.SetStatus(eReturnStatusSuccessFinishResult);
diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp
index 48ce3753f..cceb420 100644
--- a/lldb/source/Commands/CommandObjectSettings.cpp
+++ b/lldb/source/Commands/CommandObjectSettings.cpp
@@ -403,7 +403,9 @@ public:
protected:
bool DoExecute(Args &args, CommandReturnObject &result) override {
- std::string path(FileSpec(m_options.m_filename, true).GetPath());
+ FileSpec file_spec(m_options.m_filename);
+ FileSystem::Instance().Resolve(file_spec);
+ std::string path(file_spec.GetPath());
uint32_t options = File::OpenOptions::eOpenOptionWrite |
File::OpenOptions::eOpenOptionCanCreate;
if (m_options.m_append)
@@ -506,7 +508,8 @@ public:
protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
- FileSpec file(m_options.m_filename, true);
+ FileSpec file(m_options.m_filename);
+ FileSystem::Instance().Resolve(file);
ExecutionContext clean_ctx;
CommandInterpreterRunOptions options;
options.SetAddToHistory(false);
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index d321afd..c484a2c 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -517,7 +517,7 @@ protected:
// Dump the line entries found in the file specified in the option.
bool DumpLinesForFile(CommandReturnObject &result) {
- FileSpec file_spec(m_options.file_name, false);
+ FileSpec file_spec(m_options.file_name);
const char *filename = m_options.file_name.c_str();
Target *target = m_exe_ctx.GetTargetPtr();
const ModuleList &module_list =
@@ -596,7 +596,7 @@ protected:
m_module_list.Clear();
if (!m_options.modules.empty()) {
for (size_t i = 0, e = m_options.modules.size(); i < e; ++i) {
- FileSpec module_file_spec(m_options.modules[i], false);
+ FileSpec module_file_spec(m_options.modules[i]);
if (module_file_spec) {
ModuleSpec module_spec(module_file_spec);
if (target->GetImages().FindModules(module_spec, m_module_list) == 0)
@@ -921,7 +921,7 @@ protected:
if (num_modules > 0) {
ModuleList matching_modules;
for (size_t i = 0; i < num_modules; ++i) {
- FileSpec module_file_spec(m_options.modules[i], false);
+ FileSpec module_file_spec(m_options.modules[i]);
if (module_file_spec) {
ModuleSpec module_spec(module_file_spec);
matching_modules.Clear();
@@ -946,7 +946,7 @@ protected:
if (num_modules > 0) {
ModuleList matching_modules;
for (size_t i = 0; i < num_modules; ++i) {
- FileSpec module_file_spec(m_options.modules[i], false);
+ FileSpec module_file_spec(m_options.modules[i]);
if (module_file_spec) {
ModuleSpec module_spec(module_file_spec);
matching_modules.Clear();
@@ -1203,7 +1203,7 @@ protected:
if (!m_options.modules.empty()) {
ModuleList matching_modules;
for (size_t i = 0, e = m_options.modules.size(); i < e; ++i) {
- FileSpec module_file_spec(m_options.modules[i], false);
+ FileSpec module_file_spec(m_options.modules[i]);
if (module_file_spec) {
ModuleSpec module_spec(module_file_spec);
matching_modules.Clear();
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index de9526d..d897799 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -313,8 +313,10 @@ protected:
Timer scoped_timer(func_cat, "(lldb) target create '%s'", file_path);
FileSpec file_spec;
- if (file_path)
- file_spec.SetFile(file_path, true, FileSpec::Style::native);
+ if (file_path) {
+ file_spec.SetFile(file_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(file_spec);
+ }
bool must_set_platform_path = false;
@@ -1793,7 +1795,7 @@ static uint32_t LookupFileAndLineInModule(CommandInterpreter &interpreter,
static size_t FindModulesByName(Target *target, const char *module_name,
ModuleList &module_list,
bool check_global_list) {
- FileSpec module_file_spec(module_name, false);
+ FileSpec module_file_spec(module_name);
ModuleSpec module_spec(module_file_spec);
const size_t initial_size = module_list.GetSize();
@@ -2352,7 +2354,7 @@ protected:
for (int arg_idx = 0;
(arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr;
++arg_idx) {
- FileSpec file_spec(arg_cstr, false);
+ FileSpec file_spec(arg_cstr);
const ModuleList &target_modules = target->GetImages();
std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
@@ -2532,7 +2534,7 @@ protected:
if (entry.ref.empty())
continue;
- FileSpec file_spec(entry.ref, true);
+ FileSpec file_spec(entry.ref);
if (FileSystem::Instance().Exists(file_spec)) {
ModuleSpec module_spec(file_spec);
if (m_uuid_option_group.GetOptionValue().OptionWasSet())
@@ -3616,7 +3618,7 @@ public:
break;
case 'f':
- m_file.SetFile(option_arg, false, FileSpec::Style::native);
+ m_file.SetFile(option_arg, FileSpec::Style::native);
m_type = eLookupTypeFileLine;
break;
@@ -4348,8 +4350,9 @@ protected:
for (auto &entry : args.entries()) {
if (!entry.ref.empty()) {
- module_spec.GetSymbolFileSpec().SetFile(entry.ref, true,
- FileSpec::Style::native);
+ auto &symbol_file_spec = module_spec.GetSymbolFileSpec();
+ symbol_file_spec.SetFile(entry.ref, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(symbol_file_spec);
if (file_option_set) {
module_spec.GetFileSpec() =
m_file_option.GetOptionValue().GetCurrentValue();
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 53b5b7a..44ed39c 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -1729,7 +1729,7 @@ public:
switch (short_option) {
case 'f':
- m_filenames.AppendIfUnique(FileSpec(option_arg, false));
+ m_filenames.AppendIfUnique(FileSpec(option_arg));
if (m_filenames.GetSize() > 1)
return Status("only one source file expected.");
break;
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 5b88246..16924d5 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -625,8 +625,8 @@ LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft,
// file type information.
if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file ||
ft == fs::file_type::type_unknown) {
- FileSpec plugin_file_spec(path, false);
- plugin_file_spec.ResolvePath();
+ FileSpec plugin_file_spec(path);
+ FileSystem::Instance().Resolve(plugin_file_spec);
if (plugin_file_spec.GetFileNameExtension() != g_dylibext &&
plugin_file_spec.GetFileNameExtension() != g_solibext) {
diff --git a/lldb/source/Core/DynamicLoader.cpp b/lldb/source/Core/DynamicLoader.cpp
index f1bc6dd..51f34ef 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -195,9 +195,8 @@ ModuleSP DynamicLoader::LoadModuleAtAddress(const FileSpec &file,
if (error.Success() && memory_info.GetMapped() &&
memory_info.GetRange().GetRangeBase() == base_addr &&
!(memory_info.GetName().IsEmpty())) {
- ModuleSpec new_module_spec(
- FileSpec(memory_info.GetName().AsCString(), false),
- target.GetArchitecture());
+ ModuleSpec new_module_spec(FileSpec(memory_info.GetName().AsCString()),
+ target.GetArchitecture());
if ((module_sp = modules.FindFirstModule(new_module_spec))) {
UpdateLoadedSections(module_sp, link_map_addr, base_addr, false);
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 914e34e..7fdca8a 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -569,7 +569,7 @@ uint32_t Module::ResolveSymbolContextForAddress(
uint32_t Module::ResolveSymbolContextForFilePath(
const char *file_path, uint32_t line, bool check_inlines,
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
- FileSpec file_spec(file_path, false);
+ FileSpec file_spec(file_path);
return ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines,
resolve_scope, sc_list);
}
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 01d5da7..baa5ff5 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -690,7 +690,7 @@ ModuleList::ResolveSymbolContextForAddress(const Address &so_addr,
uint32_t ModuleList::ResolveSymbolContextForFilePath(
const char *file_path, uint32_t line, bool check_inlines,
SymbolContextItem resolve_scope, SymbolContextList &sc_list) const {
- FileSpec file_spec(file_path, false);
+ FileSpec file_spec(file_path);
return ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines,
resolve_scope, sc_list);
}
@@ -857,8 +857,7 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
const auto num_directories = module_search_paths_ptr->GetSize();
for (size_t idx = 0; idx < num_directories; ++idx) {
auto search_path_spec = module_search_paths_ptr->GetFileSpecAtIndex(idx);
- if (!search_path_spec.ResolvePath())
- continue;
+ FileSystem::Instance().Resolve(search_path_spec);
namespace fs = llvm::sys::fs;
if (!fs::is_directory(search_path_spec.GetPath()))
continue;
diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp
index f0a8111..de1a64e 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -103,8 +103,8 @@ LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft,
// file type information.
if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file ||
ft == fs::file_type::type_unknown) {
- FileSpec plugin_file_spec(path, false);
- plugin_file_spec.ResolvePath();
+ FileSpec plugin_file_spec(path);
+ FileSystem::Instance().Resolve(plugin_file_spec);
if (PluginIsLoaded(plugin_file_spec))
return FileSystem::eEnumerateDirectoryResultNext;
diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp
index baef7b0..a858a21f 100644
--- a/lldb/source/Core/SearchFilter.cpp
+++ b/lldb/source/Core/SearchFilter.cpp
@@ -524,7 +524,7 @@ SearchFilterSP SearchFilterByModule::CreateFromStructuredData(
error.SetErrorString("SFBM::CFSD: filter module item not a string.");
return nullptr;
}
- FileSpec module_spec(module, false);
+ FileSpec module_spec(module);
return std::make_shared<SearchFilterByModule>(target.shared_from_this(),
module_spec);
@@ -680,7 +680,7 @@ SearchFilterSP SearchFilterByModuleList::CreateFromStructuredData(
"SFBM::CFSD: filter module item %zu not a string.", i);
return nullptr;
}
- modules.Append(FileSpec(module, false));
+ modules.Append(FileSpec(module));
}
}
@@ -745,7 +745,7 @@ lldb::SearchFilterSP SearchFilterByModuleListAndCU::CreateFromStructuredData(
"SFBM::CFSD: filter module item %zu not a string.", i);
return result_sp;
}
- modules.Append(FileSpec(module, false));
+ modules.Append(FileSpec(module));
}
}
@@ -767,7 +767,7 @@ lldb::SearchFilterSP SearchFilterByModuleListAndCU::CreateFromStructuredData(
"SFBM::CFSD: filter cu item %zu not a string.", i);
return nullptr;
}
- cus.Append(FileSpec(cu, false));
+ cus.Append(FileSpec(cu));
}
return std::make_shared<SearchFilterByModuleListAndCU>(
diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp
index 50d4a09..afd1b5b 100644
--- a/lldb/source/Expression/REPL.cpp
+++ b/lldb/source/Expression/REPL.cpp
@@ -66,7 +66,7 @@ std::string REPL::GetSourcePath() {
tmpdir_file_spec.GetFilename().SetCString(file_basename.AsCString());
m_repl_source_path = tmpdir_file_spec.GetPath();
} else {
- tmpdir_file_spec = FileSpec("/tmp", false);
+ tmpdir_file_spec = FileSpec("/tmp");
tmpdir_file_spec.AppendPathComponent(file_basename.AsCString());
}
@@ -429,7 +429,7 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) {
// Now set the default file and line to the REPL source file
m_target.GetSourceManager().SetDefaultFileAndLine(
- FileSpec(m_repl_source_path, false), new_default_line);
+ FileSpec(m_repl_source_path), new_default_line);
}
static_cast<IOHandlerEditline &>(io_handler)
.SetBaseLineNumber(m_code.GetSize() + 1);
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp
index 71b0332..a330eca 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -13,6 +13,7 @@
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/Editline.h"
+#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/LLDBAssert.h"
@@ -172,7 +173,8 @@ private:
const char *GetHistoryFilePath() {
if (m_path.empty() && m_history && !m_prefix.empty()) {
- FileSpec parent_path{"~/.lldb", true};
+ FileSpec parent_path("~/.lldb");
+ FileSystem::Instance().Resolve(parent_path);
char history_path[PATH_MAX];
if (!llvm::sys::fs::create_directory(parent_path.GetPath())) {
snprintf(history_path, sizeof(history_path), "~/.lldb/%s-history",
@@ -181,7 +183,9 @@ private:
snprintf(history_path, sizeof(history_path), "~/%s-widehistory",
m_prefix.c_str());
}
- m_path = FileSpec(history_path, true).GetPath();
+ auto file_spec = FileSpec(history_path);
+ FileSystem::Instance().Resolve(file_spec);
+ m_path = file_spec.GetPath();
}
if (m_path.empty())
return NULL;
diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp
index c26225c..fb95495 100644
--- a/lldb/source/Host/common/File.cpp
+++ b/lldb/source/Host/common/File.cpp
@@ -315,7 +315,7 @@ Status File::GetFileSpec(FileSpec &file_spec) const {
if (::fcntl(GetDescriptor(), F_GETPATH, path) == -1)
error.SetErrorToErrno();
else
- file_spec.SetFile(path, false, FileSpec::Style::native);
+ file_spec.SetFile(path, FileSpec::Style::native);
} else {
error.SetErrorString("invalid file handle");
}
@@ -330,7 +330,7 @@ Status File::GetFileSpec(FileSpec &file_spec) const {
error.SetErrorToErrno();
else {
path[len] = '\0';
- file_spec.SetFile(path, false, FileSpec::Style::native);
+ file_spec.SetFile(path, FileSpec::Style::native);
}
}
#else
diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp
index c5f4db6..664f794 100644
--- a/lldb/source/Host/common/FileSystem.cpp
+++ b/lldb/source/Host/common/FileSystem.cpp
@@ -141,7 +141,7 @@ std::error_code FileSystem::MakeAbsolute(FileSpec &file_spec) const {
if (EC)
return EC;
- FileSpec new_file_spec(path, false, file_spec.GetPathStyle());
+ FileSpec new_file_spec(path, file_spec.GetPathStyle());
file_spec = new_file_spec;
return {};
}
@@ -179,6 +179,7 @@ void FileSystem::Resolve(FileSpec &file_spec) {
// Update the FileSpec with the resolved path.
file_spec.SetPath(path);
+ file_spec.SetIsResolved(true);
}
bool FileSystem::ResolveExecutableLocation(FileSpec &file_spec) {
@@ -206,7 +207,7 @@ bool FileSystem::ResolveExecutableLocation(FileSpec &file_spec) {
return false;
// Make sure that the result exists.
- FileSpec result(*error_or_path, false);
+ FileSpec result(*error_or_path);
if (!Exists(result))
return false;
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 6091680..65534b9 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -420,8 +420,10 @@ FileSpec Host::GetModuleFileSpecForHostAddress(const void *host_addr) {
#if !defined(__ANDROID__)
Dl_info info;
if (::dladdr(host_addr, &info)) {
- if (info.dli_fname)
- module_filespec.SetFile(info.dli_fname, true, FileSpec::Style::native);
+ if (info.dli_fname) {
+ module_filespec.SetFile(info.dli_fname, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(module_filespec);
+ }
}
#endif
return module_filespec;
@@ -511,7 +513,7 @@ Status Host::RunShellCommand(const Args &args, const FileSpec &working_dir,
}
}
- FileSpec output_file_spec{output_file_path.c_str(), false};
+ FileSpec output_file_spec(output_file_path.c_str());
launch_info.AppendSuppressFileAction(STDIN_FILENO, true, false);
if (output_file_spec) {
diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp
index 07058d3..34c362e 100644
--- a/lldb/source/Host/common/HostInfoBase.cpp
+++ b/lldb/source/Host/common/HostInfoBase.cpp
@@ -256,7 +256,8 @@ bool HostInfoBase::ComputeProcessTempFileDirectory(FileSpec &file_spec) {
bool HostInfoBase::ComputeTempFileBaseDirectory(FileSpec &file_spec) {
llvm::SmallVector<char, 16> tmpdir;
llvm::sys::path::system_temp_directory(/*ErasedOnReboot*/ true, tmpdir);
- file_spec = FileSpec(std::string(tmpdir.data(), tmpdir.size()), true);
+ file_spec = FileSpec(std::string(tmpdir.data(), tmpdir.size()));
+ FileSystem::Instance().Resolve(file_spec);
return true;
}
diff --git a/lldb/source/Host/common/MonitoringProcessLauncher.cpp b/lldb/source/Host/common/MonitoringProcessLauncher.cpp
index bdded15..6b7b18b 100644
--- a/lldb/source/Host/common/MonitoringProcessLauncher.cpp
+++ b/lldb/source/Host/common/MonitoringProcessLauncher.cpp
@@ -35,7 +35,7 @@ MonitoringProcessLauncher::LaunchProcess(const 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)) {
diff --git a/lldb/source/Host/common/Symbols.cpp b/lldb/source/Host/common/Symbols.cpp
index bfa3ea3..0a1eb8fd 100644
--- a/lldb/source/Host/common/Symbols.cpp
+++ b/lldb/source/Host/common/Symbols.cpp
@@ -264,20 +264,34 @@ FileSpec Symbols::LocateExecutableSymbolFile(const ModuleSpec &module_spec) {
FileSystem::Instance().ResolveSymbolicLink(module_file_spec, module_file_spec);
const ConstString &file_dir = module_file_spec.GetDirectory();
- debug_file_search_paths.AppendIfUnique(
- FileSpec(file_dir.AsCString("."), true));
+ {
+ FileSpec file_spec(file_dir.AsCString("."));
+ FileSystem::Instance().Resolve(file_spec);
+ debug_file_search_paths.AppendIfUnique(file_spec);
+ }
// Add current working directory.
- debug_file_search_paths.AppendIfUnique(FileSpec(".", true));
+ {
+ FileSpec file_spec(".");
+ FileSystem::Instance().Resolve(file_spec);
+ debug_file_search_paths.AppendIfUnique(file_spec);
+ }
#ifndef _WIN32
#if defined(__NetBSD__)
// Add /usr/libdata/debug directory.
- debug_file_search_paths.AppendIfUnique(
- FileSpec("/usr/libdata/debug", true));
+ {
+ FileSpec file_spec("/usr/libdata/debug");
+ FileSystem::Instance().Resolve(file_spec);
+ debug_file_search_paths.AppendIfUnique(file_spec);
+ }
#else
// Add /usr/lib/debug directory.
- debug_file_search_paths.AppendIfUnique(FileSpec("/usr/lib/debug", true));
+ {
+ FileSpec file_spec("/usr/lib/debug");
+ FileSystem::Instance().Resolve(file_spec);
+ debug_file_search_paths.AppendIfUnique(file_spec);
+ }
#endif
#endif // _WIN32
@@ -296,7 +310,7 @@ FileSpec Symbols::LocateExecutableSymbolFile(const ModuleSpec &module_spec) {
size_t num_directories = debug_file_search_paths.GetSize();
for (size_t idx = 0; idx < num_directories; ++idx) {
FileSpec dirspec = debug_file_search_paths.GetFileSpecAtIndex(idx);
- dirspec.ResolvePath();
+ FileSystem::Instance().Resolve(dirspec);
if (!llvm::sys::fs::is_directory(dirspec.GetPath()))
continue;
@@ -315,7 +329,8 @@ FileSpec Symbols::LocateExecutableSymbolFile(const ModuleSpec &module_spec) {
const uint32_t num_files = files.size();
for (size_t idx_file = 0; idx_file < num_files; ++idx_file) {
const std::string &filename = files[idx_file];
- FileSpec file_spec(filename, true);
+ FileSpec file_spec(filename);
+ FileSystem::Instance().Resolve(file_spec);
if (llvm::sys::fs::equivalent(file_spec.GetPath(),
module_file_spec.GetPath()))
diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp
index 1a0eb76..35a03f4 100644
--- a/lldb/source/Host/linux/Host.cpp
+++ b/lldb/source/Host/linux/Host.cpp
@@ -190,8 +190,7 @@ static bool GetProcessAndStatInfo(::pid_t pid,
return false;
process_info.SetProcessID(pid);
- process_info.GetExecutableFile().SetFile(PathRef, false,
- FileSpec::Style::native);
+ process_info.GetExecutableFile().SetFile(PathRef, FileSpec::Style::native);
llvm::StringRef Rest = Environ->getBuffer();
while (!Rest.empty()) {
diff --git a/lldb/source/Host/linux/HostInfoLinux.cpp b/lldb/source/Host/linux/HostInfoLinux.cpp
index 1288575..e0bf49f 100644
--- a/lldb/source/Host/linux/HostInfoLinux.cpp
+++ b/lldb/source/Host/linux/HostInfoLinux.cpp
@@ -171,7 +171,7 @@ FileSpec HostInfoLinux::GetProgramFileSpec() {
ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1);
if (len > 0) {
exe_path[len] = 0;
- g_program_filespec.SetFile(exe_path, false, FileSpec::Style::native);
+ g_program_filespec.SetFile(exe_path, FileSpec::Style::native);
}
}
@@ -187,7 +187,8 @@ bool HostInfoLinux::ComputeSupportExeDirectory(FileSpec &file_spec) {
}
bool HostInfoLinux::ComputeSystemPluginsDirectory(FileSpec &file_spec) {
- FileSpec temp_file("/usr/lib" LLDB_LIBDIR_SUFFIX "/lldb/plugins", true);
+ FileSpec temp_file("/usr/lib" LLDB_LIBDIR_SUFFIX "/lldb/plugins");
+ FileSystem::Instance().Resolve(temp_file);
file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str());
return true;
}
diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp
index 7193a7eb..6c09014 100644
--- a/lldb/source/Host/macosx/Symbols.cpp
+++ b/lldb/source/Host/macosx/Symbols.cpp
@@ -105,7 +105,9 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec,
"UUID %s -- looking for the dSYM",
path, uuid->GetAsString().c_str());
}
- FileSpec dsym_filespec(path, path[0] == '~');
+ FileSpec dsym_filespec(path);
+ if (path[0] == '~')
+ FileSystem::Instance().Resolve(dsym_filespec);
if (llvm::sys::fs::is_directory(dsym_filespec.GetPath())) {
dsym_filespec =
@@ -146,7 +148,9 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec,
path, uuid->GetAsString().c_str());
}
++items_found;
- FileSpec exec_filespec(path, path[0] == '~');
+ FileSpec exec_filespec(path);
+ if (path[0] == '~')
+ FileSystem::Instance().Resolve(exec_filespec);
if (FileSystem::Instance().Exists(exec_filespec)) {
success = true;
return_module_spec.GetFileSpec() = exec_filespec;
@@ -167,7 +171,8 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec,
"bundle with name with name %s",
path);
}
- FileSpec file_spec(path, true);
+ FileSpec file_spec(path);
+ FileSystem::Instance().Resolve(file_spec);
ModuleSpecList module_specs;
ModuleSpec matched_module_spec;
using namespace llvm::sys::fs;
@@ -182,7 +187,8 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec,
if (::CFURLGetFileSystemRepresentation(bundle_exe_url.get(),
true, (UInt8 *)path,
sizeof(path) - 1)) {
- FileSpec bundle_exe_file_spec(path, true);
+ FileSpec bundle_exe_file_spec(path);
+ FileSystem::Instance().Resolve(bundle_exe_file_spec);
if (ObjectFile::GetModuleSpecifications(
bundle_exe_file_spec, 0, 0, module_specs) &&
module_specs.FindMatchingModuleSpec(
@@ -307,8 +313,8 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict,
(CFDictionaryRef)uuid_dict, CFSTR("DBGSymbolRichExecutable"));
if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) {
if (CFCString::FileSystemRepresentation(cf_str, str)) {
- module_spec.GetFileSpec().SetFile(str.c_str(), true,
- FileSpec::Style::native);
+ module_spec.GetFileSpec().SetFile(str.c_str(), FileSpec::Style::native);
+ FileSystem::Instance().Resolve(module_spec.GetFileSpec());
if (log) {
log->Printf(
"From dsymForUUID plist: Symbol rich executable is at '%s'",
@@ -321,8 +327,9 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict,
CFSTR("DBGDSYMPath"));
if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) {
if (CFCString::FileSystemRepresentation(cf_str, str)) {
- module_spec.GetSymbolFileSpec().SetFile(str.c_str(), true,
+ module_spec.GetSymbolFileSpec().SetFile(str.c_str(),
FileSpec::Style::native);
+ FileSystem::Instance().Resolve(module_spec.GetFileSpec());
success = true;
if (log) {
log->Printf("From dsymForUUID plist: dSYM is at '%s'", str.c_str());
@@ -401,7 +408,8 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict,
DBGSourcePath = original_DBGSourcePath_value;
}
if (DBGSourcePath[0] == '~') {
- FileSpec resolved_source_path(DBGSourcePath.c_str(), true);
+ FileSpec resolved_source_path(DBGSourcePath.c_str());
+ FileSystem::Instance().Resolve(resolved_source_path);
DBGSourcePath = resolved_source_path.GetPath();
}
// With version 2 of DBGSourcePathRemapping, we can chop off the
@@ -412,8 +420,8 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict,
ConstString(DBGBuildSourcePath.c_str()),
ConstString(DBGSourcePath.c_str()), true);
if (do_truncate_remapping_names) {
- FileSpec build_path(DBGBuildSourcePath.c_str(), false);
- FileSpec source_path(DBGSourcePath.c_str(), false);
+ FileSpec build_path(DBGBuildSourcePath.c_str());
+ FileSpec source_path(DBGSourcePath.c_str());
build_path.RemoveLastPathComponent();
build_path.RemoveLastPathComponent();
source_path.RemoveLastPathComponent();
@@ -449,7 +457,8 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict,
if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty()) {
if (DBGSourcePath[0] == '~') {
- FileSpec resolved_source_path(DBGSourcePath.c_str(), true);
+ FileSpec resolved_source_path(DBGSourcePath.c_str());
+ FileSystem::Instance().Resolve(resolved_source_path);
DBGSourcePath = resolved_source_path.GetPath();
}
module_spec.GetSourceMappingList().Append(
@@ -505,14 +514,15 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
getenv("LLDB_APPLE_DSYMFORUUID_EXECUTABLE");
FileSpec dsym_for_uuid_exe_spec;
if (dsym_for_uuid_exe_path_cstr) {
- dsym_for_uuid_exe_spec.SetFile(dsym_for_uuid_exe_path_cstr, true,
+ dsym_for_uuid_exe_spec.SetFile(dsym_for_uuid_exe_path_cstr,
FileSpec::Style::native);
+ FileSystem::Instance().Resolve(dsym_for_uuid_exe_spec);
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,
+ dsym_for_uuid_exe_spec.SetFile("/usr/local/bin/dsymForUUID",
FileSpec::Style::native);
g_dsym_for_uuid_exe_exists =
FileSystem::Instance().Exists(dsym_for_uuid_exe_spec);
@@ -528,7 +538,7 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
tilde_rc && tilde_rc->pw_dir) {
std::string dsymforuuid_path(tilde_rc->pw_dir);
dsymforuuid_path += "/bin/dsymForUUID";
- dsym_for_uuid_exe_spec.SetFile(dsymforuuid_path.c_str(), false,
+ dsym_for_uuid_exe_spec.SetFile(dsymforuuid_path.c_str(),
FileSpec::Style::native);
g_dsym_for_uuid_exe_exists =
FileSystem::Instance().Exists(dsym_for_uuid_exe_spec);
@@ -537,8 +547,9 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
}
}
if (!g_dsym_for_uuid_exe_exists && g_dbgshell_command != NULL) {
- dsym_for_uuid_exe_spec.SetFile(g_dbgshell_command, true,
+ dsym_for_uuid_exe_spec.SetFile(g_dbgshell_command,
FileSpec::Style::native);
+ FileSystem::Instance().Resolve(dsym_for_uuid_exe_spec);
g_dsym_for_uuid_exe_exists =
FileSystem::Instance().Exists(dsym_for_uuid_exe_spec);
}
diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm
index 0e39a58..6d6cf6a 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 1bfe78b..e9f8477 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;
}
diff --git a/lldb/source/Host/posix/FileSystem.cpp b/lldb/source/Host/posix/FileSystem.cpp
index 60be642..c4b203b 100644
--- a/lldb/source/Host/posix/FileSystem.cpp
+++ b/lldb/source/Host/posix/FileSystem.cpp
@@ -47,7 +47,7 @@ Status FileSystem::Readlink(const FileSpec &src, FileSpec &dst) {
error.SetErrorToErrno();
else {
buf[count] = '\0'; // Success
- dst.SetFile(buf, false, FileSpec::Style::native);
+ dst.SetFile(buf, FileSpec::Style::native);
}
return error;
}
@@ -65,7 +65,7 @@ Status FileSystem::ResolveSymbolicLink(const FileSpec &src, FileSpec &dst) {
return err;
}
- dst = FileSpec(real_path, false);
+ dst = FileSpec(real_path);
return Status();
}
diff --git a/lldb/source/Host/posix/HostInfoPosix.cpp b/lldb/source/Host/posix/HostInfoPosix.cpp
index 62c70fa..4763ebc 100644
--- a/lldb/source/Host/posix/HostInfoPosix.cpp
+++ b/lldb/source/Host/posix/HostInfoPosix.cpp
@@ -119,7 +119,7 @@ uint32_t HostInfoPosix::GetEffectiveUserID() { return geteuid(); }
uint32_t HostInfoPosix::GetEffectiveGroupID() { return getegid(); }
-FileSpec HostInfoPosix::GetDefaultShell() { return FileSpec("/bin/sh", false); }
+FileSpec HostInfoPosix::GetDefaultShell() { return FileSpec("/bin/sh"); }
bool HostInfoPosix::ComputePathRelativeToLibrary(FileSpec &file_spec,
llvm::StringRef dir) {
@@ -163,7 +163,7 @@ bool HostInfoPosix::ComputeSupportExeDirectory(FileSpec &file_spec) {
}
bool HostInfoPosix::ComputeHeaderDirectory(FileSpec &file_spec) {
- FileSpec temp_file("/opt/local/include/lldb", false);
+ FileSpec temp_file("/opt/local/include/lldb");
file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str());
return true;
}
diff --git a/lldb/source/Host/posix/HostProcessPosix.cpp b/lldb/source/Host/posix/HostProcessPosix.cpp
index 7cdea25..f431e0c 100644
--- a/lldb/source/Host/posix/HostProcessPosix.cpp
+++ b/lldb/source/Host/posix/HostProcessPosix.cpp
@@ -62,7 +62,7 @@ Status HostProcessPosix::GetMainModule(FileSpec &file_spec) const {
return error;
}
- error = FileSystem::Instance().Readlink(FileSpec{link_path, false}, file_spec);
+ error = FileSystem::Instance().Readlink(FileSpec(link_path), file_spec);
if (!error.Success())
return error;
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 8f38517..564e6e9 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2087,12 +2087,13 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
LoadCWDlldbinitFile should_load =
target->TargetProperties::GetLoadCWDlldbinitFile();
if (should_load == eLoadCWDlldbinitWarn) {
- FileSpec dot_lldb(".lldbinit", true);
+ FileSpec dot_lldb(".lldbinit");
+ FileSystem::Instance().Resolve(dot_lldb);
llvm::SmallString<64> home_dir_path;
llvm::sys::path::home_directory(home_dir_path);
- FileSpec homedir_dot_lldb(home_dir_path.c_str(), false);
+ FileSpec homedir_dot_lldb(home_dir_path.c_str());
homedir_dot_lldb.AppendPathComponent(".lldbinit");
- homedir_dot_lldb.ResolvePath();
+ FileSystem::Instance().Resolve(homedir_dot_lldb);
if (FileSystem::Instance().Exists(dot_lldb) &&
dot_lldb.GetDirectory() != homedir_dot_lldb.GetDirectory()) {
result.AppendErrorWithFormat(
@@ -2111,7 +2112,8 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
return;
}
} else if (should_load == eLoadCWDlldbinitTrue) {
- init_file.SetFile("./.lldbinit", true, FileSpec::Style::native);
+ init_file.SetFile("./.lldbinit", FileSpec::Style::native);
+ FileSystem::Instance().Resolve(init_file);
}
}
} else {
@@ -2123,7 +2125,7 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
// init files.
llvm::SmallString<64> home_dir_path;
llvm::sys::path::home_directory(home_dir_path);
- FileSpec profilePath(home_dir_path.c_str(), false);
+ FileSpec profilePath(home_dir_path.c_str());
profilePath.AppendPathComponent(".lldbinit");
std::string init_file_path = profilePath.GetPath();
@@ -2135,15 +2137,15 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
char program_init_file_name[PATH_MAX];
::snprintf(program_init_file_name, sizeof(program_init_file_name),
"%s-%s", init_file_path.c_str(), program_name);
- init_file.SetFile(program_init_file_name, true,
- FileSpec::Style::native);
+ init_file.SetFile(program_init_file_name, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(init_file);
if (!FileSystem::Instance().Exists(init_file))
init_file.Clear();
}
}
if (!init_file && !m_skip_lldbinit_files)
- init_file.SetFile(init_file_path, false, FileSpec::Style::native);
+ init_file.SetFile(init_file_path, FileSpec::Style::native);
}
// If the file exists, tell HandleCommand to 'source' it; this will do the
diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp
index 7d6ad93..92b4900 100644
--- a/lldb/source/Interpreter/OptionValueFileSpec.cpp
+++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp
@@ -75,7 +75,9 @@ Status OptionValueFileSpec::SetValueFromString(llvm::StringRef value,
// or whitespace.
value = value.trim("\"' \t");
m_value_was_set = true;
- m_current_value.SetFile(value.str(), m_resolve, FileSpec::Style::native);
+ m_current_value.SetFile(value.str(), FileSpec::Style::native);
+ if (m_resolve)
+ FileSystem::Instance().Resolve(m_current_value);
m_data_sp.reset();
m_data_mod_time = llvm::sys::TimePoint<>();
NotifyValueChanged();
diff --git a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
index 94dc9b6..d390fc7 100644
--- a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
+++ b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
@@ -69,7 +69,7 @@ Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
count);
} else {
for (size_t i = 1; i < argc; ++i, ++idx) {
- FileSpec file(args.GetArgumentAtIndex(i), false);
+ FileSpec file(args.GetArgumentAtIndex(i));
if (idx < count)
m_current_value.Replace(idx, file);
else
@@ -91,7 +91,7 @@ Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
if (argc > 0) {
m_value_was_set = true;
for (size_t i = 0; i < argc; ++i) {
- FileSpec file(args.GetArgumentAtIndex(i), false);
+ FileSpec file(args.GetArgumentAtIndex(i));
m_current_value.Append(file);
}
NotifyValueChanged();
@@ -115,7 +115,7 @@ Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
if (op == eVarSetOperationInsertAfter)
++idx;
for (size_t i = 1; i < argc; ++i, ++idx) {
- FileSpec file(args.GetArgumentAtIndex(i), false);
+ FileSpec file(args.GetArgumentAtIndex(i));
m_current_value.Insert(idx, file);
}
NotifyValueChanged();
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp
index bdea5b4..47b1015 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -831,7 +831,7 @@ bool Options::HandleOptionArgumentCompletion(
const char *module_name =
request.GetParsedLine().GetArgumentAtIndex(cur_arg_pos);
if (module_name) {
- FileSpec module_spec(module_name, false);
+ FileSpec module_spec(module_name);
lldb::TargetSP target_sp =
interpreter.GetDebugger().GetSelectedTarget();
// Search filters require a target...
diff --git a/lldb/source/Interpreter/Property.cpp b/lldb/source/Interpreter/Property.cpp
index 2c3e372..c38a696 100644
--- a/lldb/source/Interpreter/Property.cpp
+++ b/lldb/source/Interpreter/Property.cpp
@@ -102,8 +102,10 @@ Property::Property(const PropertyDefinition &definition)
// "definition.default_uint_value" represents if the
// "definition.default_cstr_value" should be resolved or not
const bool resolve = definition.default_uint_value != 0;
- m_value_sp.reset(new OptionValueFileSpec(
- FileSpec(definition.default_cstr_value, resolve), resolve));
+ FileSpec file_spec = FileSpec(definition.default_cstr_value);
+ if (resolve)
+ FileSystem::Instance().Resolve(file_spec);
+ m_value_sp.reset(new OptionValueFileSpec(file_spec, resolve));
break;
}
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 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr,
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 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule(
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 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
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 @@ void DynamicLoaderHexagonDYLD::RefreshModules() {
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 @@ void DynamicLoaderHexagonDYLD::RefreshModules() {
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 @@ void DynamicLoaderHexagonDYLD::LoadAllCurrentModules() {
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 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo(
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 @@ bool DynamicLoaderMacOSXDYLD::ReadImageInfos(
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 @@ uint32_t DynamicLoaderMacOSXDYLD::ParseLoadCommands(const DataExtractor &data,
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 @@ bool DYLDRendezvous::FillSOEntryFromModuleInfo(
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 @@ bool DYLDRendezvous::ReadSOEntryFromMemory(lldb::addr_t addr, SOEntry &entry) {
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 @@ void DynamicLoaderPOSIXDYLD::LoadVDSO() {
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 @@ ModuleSP DynamicLoaderPOSIXDYLD::LoadInterpreterModule() {
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)) {
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
index 4251d2e..5f82781 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -18,6 +18,7 @@
#include "llvm/Support/Threading.h"
// Project includes
+#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostInfo.h"
#if !defined(_WIN32)
#include "lldb/Host/posix/HostInfoPosix.h"
@@ -84,7 +85,8 @@ bool lldb_private::ComputeClangDirectory(FileSpec &lldb_shlib_spec,
"Developer/Toolchains/XcodeDefault.xctoolchain",
swift_clang_resource_dir);
if (!verify || VerifyClangPath(clang_path)) {
- file_spec.SetFile(clang_path.c_str(), true, FileSpec::Style::native);
+ file_spec.SetFile(clang_path.c_str(), FileSpec::Style::native);
+ FileSystem::Instance().Resolve(file_spec);
return true;
}
} else if (parent != r_end && *parent == "PrivateFrameworks" &&
@@ -98,7 +100,8 @@ bool lldb_private::ComputeClangDirectory(FileSpec &lldb_shlib_spec,
raw_path.resize(parent - r_end);
llvm::sys::path::append(clang_path, raw_path, swift_clang_resource_dir);
if (!verify || VerifyClangPath(clang_path)) {
- file_spec.SetFile(clang_path.c_str(), true, FileSpec::Style::native);
+ file_spec.SetFile(clang_path.c_str(), FileSpec::Style::native);
+ FileSystem::Instance().Resolve(file_spec);
return true;
}
raw_path = lldb_shlib_spec.GetPath();
@@ -110,7 +113,8 @@ bool lldb_private::ComputeClangDirectory(FileSpec &lldb_shlib_spec,
// Fall back to the Clang resource directory inside the framework.
raw_path.append("LLDB.framework/Resources/Clang");
- file_spec.SetFile(raw_path.c_str(), true, FileSpec::Style::native);
+ file_spec.SetFile(raw_path.c_str(), FileSpec::Style::native);
+ FileSystem::Instance().Resolve(file_spec);
return true;
}
diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
index 48189d2..fcaf05f 100644
--- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -315,7 +315,7 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {
char jit_name[64];
snprintf(jit_name, 64, "JIT(0x%" PRIx64 ")", symbolfile_addr);
module_sp = m_process->ReadModuleFromMemory(
- FileSpec(jit_name, false), symbolfile_addr, symbolfile_size);
+ FileSpec(jit_name), symbolfile_addr, symbolfile_size);
if (module_sp && module_sp->GetObjectFile()) {
// load the symbol table right away
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 1682398..062ae28 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -483,8 +483,8 @@ lldb::SearchFilterSP ItaniumABILanguageRuntime::CreateExceptionSearchFilter() {
// Limit the number of modules that are searched for these breakpoints for
// Apple binaries.
FileSpecList filter_modules;
- filter_modules.Append(FileSpec("libc++abi.dylib", false));
- filter_modules.Append(FileSpec("libSystem.B.dylib", false));
+ filter_modules.Append(FileSpec("libc++abi.dylib"));
+ filter_modules.Append(FileSpec("libSystem.B.dylib"));
return target.GetSearchFilterForModuleList(&filter_modules);
} else {
return LanguageRuntime::CreateExceptionSearchFilter();
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index c3ed8a8..bc57480 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -455,7 +455,7 @@ lldb::SearchFilterSP AppleObjCRuntime::CreateExceptionSearchFilter() {
if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {
FileSpecList filter_modules;
- filter_modules.Append(FileSpec("libobjc.A.dylib", false));
+ filter_modules.Append(FileSpec("libobjc.A.dylib"));
return target.GetSearchFilterForModuleList(&filter_modules);
} else {
return LanguageRuntime::CreateExceptionSearchFilter();
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index 8302a45..7e6a950 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -2529,7 +2529,8 @@ bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id,
"Allocation information not available");
// Check we can read from file
- FileSpec file(path, true);
+ FileSpec file(path);
+ FileSystem::Instance().Resolve(file);
if (!FileSystem::Instance().Exists(file)) {
strm.Printf("Error: File %s does not exist", path);
strm.EOL();
@@ -2753,7 +2754,8 @@ bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id,
"Allocation information not available");
// Check we can create writable file
- FileSpec file_spec(path, true);
+ FileSpec file_spec(path);
+ FileSystem::Instance().Resolve(file_spec);
File file(file_spec, File::eOpenOptionWrite | File::eOpenOptionCanCreate |
File::eOpenOptionTruncate);
if (!file) {
@@ -4651,7 +4653,8 @@ public:
switch (short_option) {
case 'f':
- m_outfile.SetFile(option_arg, true, FileSpec::Style::native);
+ m_outfile.SetFile(option_arg, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(m_outfile);
if (FileSystem::Instance().Exists(m_outfile)) {
m_outfile.Clear();
err.SetErrorStringWithFormat("file already exists: '%s'",
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 0f05632..ba82165 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -955,7 +955,7 @@ lldb_private::FileSpecList ObjectFileELF::GetDebugSymbolFilePaths() {
FileSpecList file_spec_list;
if (!m_gnu_debuglink_file.empty()) {
- FileSpec file_spec(m_gnu_debuglink_file, false);
+ FileSpec file_spec(m_gnu_debuglink_file);
file_spec_list.Append(file_spec);
}
return file_spec_list;
@@ -1109,7 +1109,9 @@ size_t ObjectFileELF::ParseDependentModules() {
uint32_t str_index = static_cast<uint32_t>(symbol.d_val);
const char *lib_name = dynstr_data.PeekCStr(str_index);
- m_filespec_ap->Append(FileSpec(lib_name, true));
+ FileSpec file_spec(lib_name);
+ FileSystem::Instance().Resolve(file_spec);
+ m_filespec_ap->Append(file_spec);
}
}
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index b15094e..d92f6bc 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++;
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index b1252bb9..dc27641 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -193,7 +193,7 @@ Status PlatformAndroid::GetFile(const FileSpec &source,
if (IsHost() || !m_remote_platform_sp)
return PlatformLinux::GetFile(source, destination);
- FileSpec source_spec(source.GetPath(false), false, FileSpec::Style::posix);
+ FileSpec source_spec(source.GetPath(false), FileSpec::Style::posix);
if (source_spec.IsRelative())
source_spec = GetRemoteWorkingDirectory().CopyByAppendingPathComponent(
source_spec.GetCString(false));
@@ -237,8 +237,7 @@ Status PlatformAndroid::PutFile(const FileSpec &source,
if (IsHost() || !m_remote_platform_sp)
return PlatformLinux::PutFile(source, destination, uid, gid);
- FileSpec destination_spec(destination.GetPath(false), false,
- FileSpec::Style::posix);
+ FileSpec destination_spec(destination.GetPath(false), FileSpec::Style::posix);
if (destination_spec.IsRelative())
destination_spec = GetRemoteWorkingDirectory().CopyByAppendingPathComponent(
destination_spec.GetCString(false));
@@ -343,7 +342,7 @@ Status PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp,
log->Printf("Failed to remove temp directory: %s", error.AsCString());
});
- FileSpec symfile_platform_filespec(tmpdir, false);
+ FileSpec symfile_platform_filespec(tmpdir);
symfile_platform_filespec.AppendPathComponent("symbolized.oat");
// Execute oatdump on the remote device to generate a file with symtab
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
index 6852097..127895a 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
@@ -229,9 +229,8 @@ FileSpec PlatformAppleSimulator::GetCoreSimulatorPath() {
cs_path.Printf(
"%s/Library/PrivateFrameworks/CoreSimulator.framework/CoreSimulator",
developer_dir);
- const bool resolve_path = true;
- m_core_simulator_framework_path =
- FileSpec(cs_path.GetData(), resolve_path);
+ m_core_simulator_framework_path = FileSpec(cs_path.GetData());
+ FileSystem::Instance().Resolve(*m_core_simulator_framework_path);
}
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
index f447e14..b2102df 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
@@ -251,7 +251,7 @@ static FileSystem::EnumerateDirectoryResult
EnumerateDirectoryCallback(void *baton, llvm::sys::fs::file_type ft,
llvm::StringRef path) {
if (ft == llvm::sys::fs::file_type::directory_file) {
- FileSpec file_spec(path, false);
+ FileSpec file_spec(path);
const char *filename = file_spec.GetFilename().GetCString();
if (filename &&
strncmp(filename, "AppleTVSimulator", strlen("AppleTVSimulator")) ==
@@ -316,12 +316,14 @@ Status PlatformAppleTVSimulator::GetSymbolFile(const FileSpec &platform_file,
platform_file_path);
// First try in the SDK and see if the file is in there
- local_file.SetFile(resolved_path, true, FileSpec::Style::native);
+ local_file.SetFile(resolved_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(local_file);
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);
+ local_file.SetFile(platform_file_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(local_file);
if (FileSystem::Instance().Exists(local_file))
return error;
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
index 9f8aea1e..ddc0976 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
@@ -251,7 +251,7 @@ static FileSystem::EnumerateDirectoryResult
EnumerateDirectoryCallback(void *baton, llvm::sys::fs::file_type ft,
llvm::StringRef path) {
if (ft == llvm::sys::fs::file_type::directory_file) {
- FileSpec file_spec(path, false);
+ FileSpec file_spec(path);
const char *filename = file_spec.GetFilename().GetCString();
if (filename &&
strncmp(filename, "AppleWatchSimulator",
@@ -316,12 +316,14 @@ Status PlatformAppleWatchSimulator::GetSymbolFile(const FileSpec &platform_file,
platform_file_path);
// First try in the SDK and see if the file is in there
- local_file.SetFile(resolved_path, true, FileSpec::Style::native);
+ local_file.SetFile(resolved_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(local_file);
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);
+ local_file.SetFile(platform_file_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(local_file);
if (FileSystem::Instance().Exists(local_file))
return error;
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 1038eef..9e33896 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -130,9 +130,10 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources(
"%s/../Python/%s.py",
symfile_spec.GetDirectory().GetCString(),
original_module_basename.c_str());
- FileSpec script_fspec(path_string.GetString(), true);
- FileSpec orig_script_fspec(original_path_string.GetString(),
- true);
+ FileSpec script_fspec(path_string.GetString());
+ FileSystem::Instance().Resolve(script_fspec);
+ FileSpec orig_script_fspec(original_path_string.GetString());
+ FileSystem::Instance().Resolve(orig_script_fspec);
// if we did some replacements of reserved characters, and a
// file with the untampered name exists, then warn the user
@@ -261,7 +262,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
if (!cache_path.empty()) {
std::string module_path(module_spec.GetFileSpec().GetPath());
cache_path.append(module_path);
- FileSpec module_cache_spec(cache_path, false);
+ FileSpec module_cache_spec(cache_path);
// if rsync is supported, always bring in the file - rsync will be very
// efficient when files are the same on the local and remote end of the
@@ -412,7 +413,7 @@ Status PlatformDarwin::GetSharedModule(
snprintf(new_path + search_path_len,
sizeof(new_path) - search_path_len, "/%s",
platform_path + bundle_directory_len);
- FileSpec new_file_spec(new_path, false);
+ FileSpec new_file_spec(new_path);
if (FileSystem::Instance().Exists(new_file_spec)) {
ModuleSpec new_module_spec(module_spec);
new_module_spec.GetFileSpec() = new_file_spec;
@@ -1167,7 +1168,7 @@ const char *PlatformDarwin::GetDeveloperDirectory() {
if (xcode_select_prefix_dir)
xcode_dir_path.append(xcode_select_prefix_dir);
xcode_dir_path.append("/usr/share/xcode-select/xcode_dir_path");
- temp_file_spec.SetFile(xcode_dir_path, false, FileSpec::Style::native);
+ temp_file_spec.SetFile(xcode_dir_path, FileSpec::Style::native);
auto dir_buffer =
DataBufferLLVM::CreateFromPath(temp_file_spec.GetPath());
if (dir_buffer && dir_buffer->GetByteSize() > 0) {
@@ -1183,7 +1184,7 @@ const char *PlatformDarwin::GetDeveloperDirectory() {
}
if (!developer_dir_path_valid) {
- FileSpec xcode_select_cmd("/usr/bin/xcode-select", false);
+ FileSpec xcode_select_cmd("/usr/bin/xcode-select");
if (FileSystem::Instance().Exists(xcode_select_cmd)) {
int exit_status = -1;
int signo = -1;
@@ -1206,7 +1207,7 @@ const char *PlatformDarwin::GetDeveloperDirectory() {
}
developer_dir_path[i] = '\0';
- FileSpec devel_dir(developer_dir_path, false);
+ FileSpec devel_dir(developer_dir_path);
if (llvm::sys::fs::is_directory(devel_dir.GetPath())) {
developer_dir_path_valid = true;
}
@@ -1215,8 +1216,7 @@ const char *PlatformDarwin::GetDeveloperDirectory() {
}
if (developer_dir_path_valid) {
- temp_file_spec.SetFile(developer_dir_path, false,
- FileSpec::Style::native);
+ temp_file_spec.SetFile(developer_dir_path, FileSpec::Style::native);
if (FileSystem::Instance().Exists(temp_file_spec)) {
m_developer_directory.assign(developer_dir_path);
return m_developer_directory.c_str();
@@ -1247,7 +1247,7 @@ BreakpointSP PlatformDarwin::SetThreadCreationBreakpoint(Target &target) {
FileSpecList bp_modules;
for (size_t i = 0; i < llvm::array_lengthof(g_bp_modules); i++) {
const char *bp_module = g_bp_modules[i];
- bp_modules.Append(FileSpec(bp_module, false));
+ bp_modules.Append(FileSpec(bp_module));
}
bool internal = true;
@@ -1307,7 +1307,7 @@ static FileSpec CheckPathForXcode(const FileSpec &fspec) {
size_t pos = path_to_shlib.rfind(substr);
if (pos != std::string::npos) {
path_to_shlib.erase(pos + strlen(substr));
- FileSpec ret(path_to_shlib, false);
+ FileSpec ret(path_to_shlib);
FileSpec xcode_binary_path = ret;
xcode_binary_path.AppendPathComponent("MacOS");
@@ -1348,8 +1348,9 @@ static FileSpec GetXcodeContentsPath() {
if (!g_xcode_filespec) {
const char *developer_dir_env_var = getenv("DEVELOPER_DIR");
if (developer_dir_env_var && developer_dir_env_var[0]) {
- g_xcode_filespec =
- CheckPathForXcode(FileSpec(developer_dir_env_var, true));
+ FileSpec developer_dir_spec = FileSpec(developer_dir_env_var);
+ FileSystem::Instance().Resolve(developer_dir_spec);
+ g_xcode_filespec = CheckPathForXcode(developer_dir_spec);
}
// Fall back to using "xcrun" to find the selected Xcode
@@ -1373,7 +1374,7 @@ static FileSpec GetXcodeContentsPath() {
}
output.append("/..");
- g_xcode_filespec = CheckPathForXcode(FileSpec(output, false));
+ g_xcode_filespec = CheckPathForXcode(FileSpec(output));
}
}
}
@@ -1421,7 +1422,7 @@ FileSystem::EnumerateDirectoryResult PlatformDarwin::DirectoryEnumerator(
void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef path) {
SDKEnumeratorInfo *enumerator_info = static_cast<SDKEnumeratorInfo *>(baton);
- FileSpec spec(path, false);
+ FileSpec spec(path);
if (SDKSupportsModules(enumerator_info->sdk_type, spec)) {
enumerator_info->found_path = spec;
return FileSystem::EnumerateDirectoryResult::eEnumerateDirectoryResultNext;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index 3a04976..c567db2 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -377,12 +377,15 @@ void PlatformDarwinKernel::CollectKextAndKernelDirectories() {
GetUserSpecifiedDirectoriesToSearch();
// Add simple directory /Applications/Xcode.app/Contents/Developer/../Symbols
- FileSpec possible_dir(developer_dir + "/../Symbols", true);
+ FileSpec possible_dir(developer_dir + "/../Symbols");
+ FileSystem::Instance().Resolve(possible_dir);
if (llvm::sys::fs::is_directory(possible_dir.GetPath()))
m_search_directories.push_back(possible_dir);
// Add simple directory of the current working directory
- m_search_directories_no_recursing.push_back(FileSpec(".", true));
+ FileSpec cwd(".");
+ FileSystem::Instance().Resolve(cwd);
+ m_search_directories_no_recursing.push_back(cwd);
}
void PlatformDarwinKernel::GetUserSpecifiedDirectoriesToSearch() {
@@ -392,7 +395,7 @@ void PlatformDarwinKernel::GetUserSpecifiedDirectoriesToSearch() {
const uint32_t user_dirs_count = user_dirs.GetSize();
for (uint32_t i = 0; i < user_dirs_count; i++) {
FileSpec dir = user_dirs.GetFileSpecAtIndex(i);
- dir.ResolvePath();
+ FileSystem::Instance().Resolve(dir);
if (llvm::sys::fs::is_directory(dir.GetPath())) {
m_search_directories.push_back(dir);
}
@@ -408,14 +411,14 @@ void PlatformDarwinKernel::AddRootSubdirsToSearchPaths(
// /AppleInternal/Developer/KDKs/*.kdk/...
nullptr};
for (int i = 0; subdirs[i] != nullptr; i++) {
- FileSpec testdir(dir + subdirs[i], true);
+ FileSpec testdir(dir + subdirs[i]);
+ FileSystem::Instance().Resolve(testdir);
if (llvm::sys::fs::is_directory(testdir.GetPath()))
thisp->m_search_directories.push_back(testdir);
}
// Look for kernel binaries in the top level directory, without any recursion
- thisp->m_search_directories_no_recursing.push_back(
- FileSpec(dir + "/", false));
+ thisp->m_search_directories_no_recursing.push_back(FileSpec(dir + "/"));
}
// Given a directory path dir, look for any subdirs named *.kdk and *.sdk
@@ -437,7 +440,7 @@ PlatformDarwinKernel::FindKDKandSDKDirectoriesInDirectory(
static ConstString g_kdk_suffix = ConstString(".kdk");
PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton;
- FileSpec file_spec(path, false);
+ FileSpec file_spec(path);
if (ft == llvm::sys::fs::file_type::directory_file &&
(file_spec.GetFileNameExtension() == g_sdk_suffix ||
file_spec.GetFileNameExtension() == g_kdk_suffix)) {
@@ -499,7 +502,7 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
static ConstString g_dsym_suffix = ConstString(".dSYM");
static ConstString g_bundle_suffix = ConstString("Bundle");
- FileSpec file_spec(path, false);
+ FileSpec file_spec(path);
ConstString file_spec_extension = file_spec.GetFileNameExtension();
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
@@ -537,12 +540,12 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
file_spec_extension == g_kext_suffix) {
AddKextToMap(thisp, file_spec);
// Look to see if there is a PlugIns subdir with more kexts
- FileSpec contents_plugins(file_spec.GetPath() + "/Contents/PlugIns", false);
+ FileSpec contents_plugins(file_spec.GetPath() + "/Contents/PlugIns");
std::string search_here_too;
if (llvm::sys::fs::is_directory(contents_plugins.GetPath())) {
search_here_too = contents_plugins.GetPath();
} else {
- FileSpec plugins(file_spec.GetPath() + "/PlugIns", false);
+ FileSpec plugins(file_spec.GetPath() + "/PlugIns");
if (llvm::sys::fs::is_directory(plugins.GetPath())) {
search_here_too = plugins.GetPath();
}
@@ -628,7 +631,8 @@ bool PlatformDarwinKernel::KextHasdSYMSibling(
kext_bundle_filepath.GetPath() + "/Contents/MacOS/";
deep_bundle_str += executable_name.AsCString();
deep_bundle_str += ".dSYM";
- dsym_fspec.SetFile(deep_bundle_str, true, FileSpec::Style::native);
+ dsym_fspec.SetFile(deep_bundle_str, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(dsym_fspec);
if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) {
return true;
}
@@ -638,7 +642,8 @@ bool PlatformDarwinKernel::KextHasdSYMSibling(
std::string shallow_bundle_str = kext_bundle_filepath.GetPath() + "/";
shallow_bundle_str += executable_name.AsCString();
shallow_bundle_str += ".dSYM";
- dsym_fspec.SetFile(shallow_bundle_str, true, FileSpec::Style::native);
+ dsym_fspec.SetFile(shallow_bundle_str, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(dsym_fspec);
if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) {
return true;
}
@@ -796,7 +801,7 @@ PlatformDarwinKernel::SearchForExecutablesRecursively(const std::string &dir) {
break;
if (llvm::sys::fs::is_regular_file(*status) &&
llvm::sys::fs::can_execute(it->path()))
- executables.emplace_back(it->path(), false);
+ executables.emplace_back(it->path());
}
return executables;
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index f2f95af..b065c91 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -218,13 +218,13 @@ ConstString PlatformMacOSX::GetSDKDirectory(lldb_private::Target &target) {
"SDKs/MacOSX%u.%u.sdk",
xcode_contents_path.c_str(), versions[0],
versions[1]);
- fspec.SetFile(sdk_path.GetString(), false, FileSpec::Style::native);
+ fspec.SetFile(sdk_path.GetString(), FileSpec::Style::native);
if (FileSystem::Instance().Exists(fspec))
return ConstString(sdk_path.GetString());
}
if (!default_xcode_sdk.empty()) {
- fspec.SetFile(default_xcode_sdk, false, FileSpec::Style::native);
+ fspec.SetFile(default_xcode_sdk, FileSpec::Style::native);
if (FileSystem::Instance().Exists(fspec))
return ConstString(default_xcode_sdk);
}
@@ -268,7 +268,7 @@ PlatformMacOSX::GetFileWithUUID(const lldb_private::FileSpec &platform_file,
std::string cache_path(GetLocalCacheDirectory());
std::string module_path(platform_file.GetPath());
cache_path.append(module_path);
- FileSpec module_cache_spec(cache_path, false);
+ FileSpec module_cache_spec(cache_path);
if (FileSystem::Instance().Exists(module_cache_spec)) {
local_file = module_cache_spec;
return Status();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
index 2dd0a25..e44c5b9 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
@@ -144,8 +144,7 @@ FileSystem::EnumerateDirectoryResult
PlatformRemoteDarwinDevice::GetContainedFilesIntoVectorOfStringsCallback(
void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path) {
((PlatformRemoteDarwinDevice::SDKDirectoryInfoCollection *)baton)
- ->push_back(
- PlatformRemoteDarwinDevice::SDKDirectoryInfo(FileSpec(path, false)));
+ ->push_back(PlatformRemoteDarwinDevice::SDKDirectoryInfo(FileSpec(path)));
return FileSystem::eEnumerateDirectoryResultNext;
}
@@ -155,7 +154,8 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
if (m_sdk_directory_infos.empty()) {
// A --sysroot option was supplied - add it to our list of SDKs to check
if (m_sdk_sysroot) {
- FileSpec sdk_sysroot_fspec(m_sdk_sysroot.GetCString(), true);
+ FileSpec sdk_sysroot_fspec(m_sdk_sysroot.GetCString());
+ FileSystem::Instance().Resolve(sdk_sysroot_fspec);
const SDKDirectoryInfo sdk_sysroot_directory_info(sdk_sysroot_fspec);
m_sdk_directory_infos.push_back(sdk_sysroot_directory_info);
if (log) {
@@ -207,7 +207,8 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
const uint32_t num_installed = m_sdk_directory_infos.size();
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);
+ FileSpec local_sdk_cache(local_sdk_cache_str.c_str());
+ FileSystem::Instance().Resolve(local_sdk_cache);
if (FileSystem::Instance().Exists(local_sdk_cache)) {
if (log) {
log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
@@ -420,11 +421,11 @@ bool PlatformRemoteDarwinDevice::GetFileInSDK(const char *platform_file_path,
const char *paths_to_try[] = {"Symbols", "", "Symbols.Internal", nullptr};
for (size_t i = 0; paths_to_try[i] != nullptr; i++) {
- local_file.SetFile(sdkroot_path, false, FileSpec::Style::native);
+ local_file.SetFile(sdkroot_path, FileSpec::Style::native);
if (paths_to_try[i][0] != '\0')
local_file.AppendPathComponent(paths_to_try[i]);
local_file.AppendPathComponent(platform_file_path);
- local_file.ResolvePath();
+ FileSystem::Instance().Resolve(local_file);
if (FileSystem::Instance().Exists(local_file)) {
if (log)
log->Printf("Found a copy of %s in the SDK dir %s/%s",
@@ -453,7 +454,8 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
::snprintf(resolved_path, sizeof(resolved_path), "%s/%s", os_version_dir,
platform_file_path);
- local_file.SetFile(resolved_path, true, FileSpec::Style::native);
+ local_file.SetFile(resolved_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(local_file);
if (FileSystem::Instance().Exists(local_file)) {
if (log) {
log->Printf("Found a copy of %s in the DeviceSupport dir %s",
@@ -465,7 +467,8 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
::snprintf(resolved_path, sizeof(resolved_path), "%s/Symbols.Internal/%s",
os_version_dir, platform_file_path);
- local_file.SetFile(resolved_path, true, FileSpec::Style::native);
+ local_file.SetFile(resolved_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(local_file);
if (FileSystem::Instance().Exists(local_file)) {
if (log) {
log->Printf(
@@ -477,7 +480,8 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
::snprintf(resolved_path, sizeof(resolved_path), "%s/Symbols/%s",
os_version_dir, platform_file_path);
- local_file.SetFile(resolved_path, true, FileSpec::Style::native);
+ local_file.SetFile(resolved_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(local_file);
if (FileSystem::Instance().Exists(local_file)) {
if (log) {
log->Printf("Found a copy of %s in the DeviceSupport dir %s/Symbols",
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
index 212edde..9419dc7 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
@@ -257,7 +257,7 @@ static FileSystem::EnumerateDirectoryResult
EnumerateDirectoryCallback(void *baton, llvm::sys::fs::file_type ft,
llvm::StringRef path) {
if (ft == llvm::sys::fs::file_type::directory_file) {
- FileSpec file_spec(path, false);
+ FileSpec file_spec(path);
const char *filename = file_spec.GetFilename().GetCString();
if (filename &&
strncmp(filename, "iPhoneSimulator", strlen("iPhoneSimulator")) == 0) {
@@ -321,12 +321,14 @@ Status PlatformiOSSimulator::GetSymbolFile(const FileSpec &platform_file,
platform_file_path);
// First try in the SDK and see if the file is in there
- local_file.SetFile(resolved_path, true, FileSpec::Style::native);
+ local_file.SetFile(resolved_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(local_file);
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);
+ local_file.SetFile(platform_file_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(local_file);
if (FileSystem::Instance().Exists(local_file))
return error;
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
index 4516a66e..8964906 100644
--- a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
+++ b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
@@ -409,7 +409,7 @@ static Status HandleFileAction(ProcessLaunchInfo &launch_info,
// Check in case our file action open wants to open the slave
const char *slave_path = launch_info.GetPTY().GetSlaveName(NULL, 0);
if (slave_path) {
- FileSpec slave_spec(slave_path, false);
+ FileSpec slave_spec(slave_path);
if (file_spec == slave_spec) {
int slave_fd = launch_info.GetPTY().GetSlaveFileDescriptor();
if (slave_fd == PseudoTerminal::invalid_fd)
diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index 78761f5..e3f043d 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -130,8 +130,9 @@ PlatformPOSIX::ResolveExecutable(const ModuleSpec &module_spec,
// on the current path variables
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,
+ resolved_module_spec.GetFileSpec().SetFile(exe_path,
FileSpec::Style::native);
+ FileSystem::Instance().Resolve(resolved_module_spec.GetFileSpec());
}
if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec()))
@@ -1284,8 +1285,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
std::string name_string;
process->ReadCStringFromMemory(buffer_addr, name_string, utility_error);
if (utility_error.Success())
- loaded_image->SetFile(name_string, false,
- llvm::sys::path::Style::posix);
+ loaded_image->SetFile(name_string, llvm::sys::path::Style::posix);
}
return process->AddImageToken(token);
}
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index 9eb24ba..878c0a3 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -194,8 +194,9 @@ Status PlatformWindows::ResolveExecutable(
// variables
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,
+ resolved_module_spec.GetFileSpec().SetFile(exe_path,
FileSpec::Style::native);
+ FileSystem::Instance().Resolve(resolved_module_spec.GetFileSpec());
}
if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec()))
diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
index 2ba3ea7..a1ee5314 100644
--- a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
@@ -391,8 +391,7 @@ Status ProcessFreeBSD::DoLaunch(Module *module,
FileSpec stdout_file_spec{};
FileSpec stderr_file_spec{};
- const FileSpec dbg_pts_file_spec{launch_info.GetPTY().GetSlaveName(NULL, 0),
- false};
+ const FileSpec dbg_pts_file_spec{launch_info.GetPTY().GetSlaveName(NULL, 0)};
file_action = launch_info.GetFileActionForFD(STDIN_FILENO);
stdin_file_spec =
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 4f36fba..45736b5 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -1418,8 +1418,9 @@ Status NativeProcessLinux::PopulateMemoryRegionCache() {
m_supports_mem_region = LazyBool::eLazyBoolNo;
return parse_error;
}
- m_mem_region_cache.emplace_back(
- info, FileSpec(info.GetName().GetCString(), true));
+ FileSpec file_spec(info.GetName().GetCString());
+ FileSystem::Instance().Resolve(file_spec);
+ m_mem_region_cache.emplace_back(info, file_spec);
}
if (m_mem_region_cache.empty()) {
@@ -1723,7 +1724,8 @@ Status NativeProcessLinux::GetLoadedModuleFileSpec(const char *module_path,
if (error.Fail())
return error;
- FileSpec module_file_spec(module_path, true);
+ FileSpec module_file_spec(module_path);
+ FileSystem::Instance().Resolve(module_file_spec);
file_spec.Clear();
for (const auto &it : m_mem_region_cache) {
@@ -1743,7 +1745,7 @@ Status NativeProcessLinux::GetFileLoadAddress(const llvm::StringRef &file_name,
if (error.Fail())
return error;
- FileSpec file(file_name, false);
+ FileSpec file(file_name);
for (const auto &it : m_mem_region_cache) {
if (it.second == file) {
load_addr = it.first.GetRange().GetRangeBase();
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 0f0feba..70a1e55 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -249,8 +249,7 @@ Status ProcessElfCore::DoLoadCore() {
ModuleSpec exe_module_spec;
exe_module_spec.GetArchitecture() = arch;
exe_module_spec.GetFileSpec().SetFile(
- m_nt_file_entries[0].path.GetCString(), false,
- FileSpec::Style::native);
+ m_nt_file_entries[0].path.GetCString(), FileSpec::Style::native);
if (exe_module_spec.GetFileSpec()) {
exe_module_sp = GetTarget().GetSharedModule(exe_module_spec);
if (exe_module_sp)
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index c4f0a67..390bfa0 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -998,7 +998,7 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
// debugserver to use and use it if we do.
const char *env_debugserver_path = getenv("LLDB_DEBUGSERVER_PATH");
if (env_debugserver_path) {
- debugserver_file_spec.SetFile(env_debugserver_path, false,
+ debugserver_file_spec.SetFile(env_debugserver_path,
FileSpec::Style::native);
if (log)
log->Printf("GDBRemoteCommunication::%s() gdb-remote stub exe path set "
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 942447c..f7551f3 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1818,7 +1818,7 @@ bool GDBRemoteCommunicationClient::GetWorkingDir(FileSpec &working_dir) {
return false;
std::string cwd;
response.GetHexByteString(cwd);
- working_dir.SetFile(cwd, false, GetHostArchitecture().GetTriple());
+ working_dir.SetFile(cwd, GetHostArchitecture().GetTriple());
return !cwd.empty();
}
return false;
@@ -1928,8 +1928,7 @@ bool GDBRemoteCommunicationClient::DecodeProcessInfoResponse(
// characters in a process name
std::string name;
extractor.GetHexByteString(name);
- process_info.GetExecutableFile().SetFile(name, false,
- FileSpec::Style::native);
+ process_info.GetExecutableFile().SetFile(name, FileSpec::Style::native);
} else if (name.equals("cputype")) {
value.getAsInteger(0, cpu);
} else if (name.equals("cpusubtype")) {
@@ -3562,7 +3561,7 @@ bool GDBRemoteCommunicationClient::GetModuleInfo(
StringExtractor extractor(value);
std::string path;
extractor.GetHexByteString(path);
- module_spec.GetFileSpec() = FileSpec(path, false, arch_spec.GetTriple());
+ module_spec.GetFileSpec() = FileSpec(path, arch_spec.GetTriple());
}
}
@@ -3598,8 +3597,7 @@ ParseModuleSpec(StructuredData::Dictionary *dict) {
if (!dict->GetValueForKeyAsString("file_path", string))
return llvm::None;
- result.GetFileSpec() =
- FileSpec(string, false, result.GetArchitecture().GetTriple());
+ result.GetFileSpec() = FileSpec(string, result.GetArchitecture().GetTriple());
return result;
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
index dfff7ec..60b56b0 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -353,7 +353,7 @@ GDBRemoteCommunicationServerCommon::Handle_qfProcessInfo(
std::string file;
extractor.GetHexByteString(file);
match_info.GetProcessInfo().GetExecutableFile().SetFile(
- file, false, FileSpec::Style::native);
+ file, FileSpec::Style::native);
} else if (key.equals("name_match")) {
NameMatch name_match = llvm::StringSwitch<NameMatch>(value)
.Case("equals", NameMatch::Equals)
@@ -520,7 +520,8 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Open(
if (packet.GetChar() == ',') {
mode_t mode = packet.GetHexMaxU32(false, 0600);
Status error;
- const FileSpec path_spec{path, true};
+ FileSpec path_spec(path);
+ FileSystem::Instance().Resolve(path_spec);
int fd = ::open(path_spec.GetCString(), flags, mode);
const int save_errno = fd == -1 ? errno : 0;
StreamString response;
@@ -660,7 +661,9 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Mode(
packet.GetHexByteString(path);
if (!path.empty()) {
Status error;
- const uint32_t mode = File::GetPermissions(FileSpec{path, true}, error);
+ FileSpec file_spec(path);
+ FileSystem::Instance().Resolve(file_spec);
+ const uint32_t mode = File::GetPermissions(file_spec, error);
StreamString response;
response.Printf("F%u", mode);
if (mode == 0 || error.Fail())
@@ -698,7 +701,11 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_symlink(
packet.GetHexByteStringTerminatedBy(dst, ',');
packet.GetChar(); // Skip ',' char
packet.GetHexByteString(src);
- Status error = FileSystem::Instance().Symlink(FileSpec{src, true}, FileSpec{dst, false});
+
+ FileSpec src_spec(src);
+ FileSystem::Instance().Resolve(src_spec);
+ Status error = FileSystem::Instance().Symlink(src_spec, FileSpec(dst));
+
StreamString response;
response.Printf("F%u,%u", error.GetError(), error.GetError());
return SendPacketNoLock(response.GetString());
@@ -731,9 +738,11 @@ GDBRemoteCommunicationServerCommon::Handle_qPlatform_shell(
packet.GetHexByteString(working_dir);
int status, signo;
std::string output;
- Status err = Host::RunShellCommand(
- path.c_str(), FileSpec{working_dir, true}, &status, &signo, &output,
- std::chrono::seconds(10));
+ FileSpec working_spec(working_dir);
+ FileSystem::Instance().Resolve(working_spec);
+ Status err =
+ Host::RunShellCommand(path.c_str(), working_spec, &status, &signo,
+ &output, std::chrono::seconds(10));
StreamGDBRemote response;
if (err.Fail()) {
response.PutCString("F,");
@@ -884,7 +893,7 @@ GDBRemoteCommunicationServerCommon::Handle_QSetSTDIN(
packet.GetHexByteString(path);
const bool read = true;
const bool write = false;
- if (file_action.Open(STDIN_FILENO, FileSpec{path, false}, read, write)) {
+ if (file_action.Open(STDIN_FILENO, FileSpec(path), read, write)) {
m_process_launch_info.AppendFileAction(file_action);
return SendOKResponse();
}
@@ -900,7 +909,7 @@ GDBRemoteCommunicationServerCommon::Handle_QSetSTDOUT(
packet.GetHexByteString(path);
const bool read = false;
const bool write = true;
- if (file_action.Open(STDOUT_FILENO, FileSpec{path, false}, read, write)) {
+ if (file_action.Open(STDOUT_FILENO, FileSpec(path), read, write)) {
m_process_launch_info.AppendFileAction(file_action);
return SendOKResponse();
}
@@ -916,7 +925,7 @@ GDBRemoteCommunicationServerCommon::Handle_QSetSTDERR(
packet.GetHexByteString(path);
const bool read = false;
const bool write = true;
- if (file_action.Open(STDERR_FILENO, FileSpec{path, false}, read, write)) {
+ if (file_action.Open(STDERR_FILENO, FileSpec(path), read, write)) {
m_process_launch_info.AppendFileAction(file_action);
return SendOKResponse();
}
@@ -1024,7 +1033,7 @@ GDBRemoteCommunicationServerCommon::Handle_A(StringExtractorGDBRemote &packet) {
if (success) {
if (arg_idx == 0)
m_process_launch_info.GetExecutableFile().SetFile(
- arg, false, FileSpec::Style::native);
+ arg, FileSpec::Style::native);
m_process_launch_info.GetArguments().AppendArgument(arg);
if (log)
log->Printf("LLGSPacketHandler::%s added arg %d: \"%s\"",
@@ -1263,7 +1272,9 @@ FileSpec GDBRemoteCommunicationServerCommon::FindModuleFile(
#ifdef __ANDROID__
return HostInfoAndroid::ResolveLibraryPath(module_path, arch);
#else
- return FileSpec(module_path, true);
+ FileSpec file_spec(module_path);
+ FileSystem::Instance().Resolve(file_spec);
+ return file_spec;
#endif
}
@@ -1272,7 +1283,9 @@ GDBRemoteCommunicationServerCommon::GetModuleInfo(llvm::StringRef module_path,
llvm::StringRef triple) {
ArchSpec arch(triple);
- const FileSpec req_module_path_spec(module_path, true);
+ FileSpec req_module_path_spec(module_path);
+ FileSystem::Instance().Resolve(req_module_path_spec);
+
const FileSpec module_path_spec =
FindModuleFile(req_module_path_spec.GetPath(), arch);
const ModuleSpec module_spec(module_path_spec, arch);
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 0585663..2cabe88 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1333,7 +1333,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QSetWorkingDir(
packet.SetFilePos(::strlen("QSetWorkingDir:"));
std::string path;
packet.GetHexByteString(path);
- m_process_launch_info.SetWorkingDirectory(FileSpec{path, true});
+ m_process_launch_info.SetWorkingDirectory(FileSpec(path));
return SendOKResponse();
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 26e28a9..45b2cdc 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -532,7 +532,7 @@ const FileSpec &GDBRemoteCommunicationServerPlatform::GetDomainSocketDir() {
const char *domainsocket_dir_env =
::getenv("LLDB_DEBUGSERVER_DOMAINSOCKET_DIR");
if (domainsocket_dir_env != nullptr)
- g_domainsocket_dir = FileSpec(domainsocket_dir_env, false);
+ g_domainsocket_dir = FileSpec(domainsocket_dir_env);
else
g_domainsocket_dir = HostInfo::GetProcessTempDir();
});
@@ -550,7 +550,7 @@ GDBRemoteCommunicationServerPlatform::GetDomainSocketPath(const char *prefix) {
socket_path_spec.AppendPathComponent(socket_name.c_str());
llvm::sys::fs::createUniqueFile(socket_path_spec.GetCString(), socket_path);
- return FileSpec(socket_path.c_str(), false);
+ return FileSpec(socket_path.c_str());
}
void GDBRemoteCommunicationServerPlatform::SetPortOffset(uint16_t port_offset) {
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 0f484a6..a57a735 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -442,7 +442,7 @@ void ProcessGDBRemote::BuildDynamicRegisterInfo(bool force) {
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();
+ FileSystem::Instance().Resolve(target_definition_fspec);
}
if (target_definition_fspec) {
// See if we can get register definitions from a python file
@@ -825,13 +825,13 @@ Status ProcessGDBRemote::DoLaunch(Module *exe_module,
if (disable_stdio) {
// set to /dev/null unless redirected to a file above
if (!stdin_file_spec)
- stdin_file_spec.SetFile(FileSystem::DEV_NULL, false,
+ stdin_file_spec.SetFile(FileSystem::DEV_NULL,
FileSpec::Style::native);
if (!stdout_file_spec)
- stdout_file_spec.SetFile(FileSystem::DEV_NULL, false,
+ stdout_file_spec.SetFile(FileSystem::DEV_NULL,
FileSpec::Style::native);
if (!stderr_file_spec)
- stderr_file_spec.SetFile(FileSystem::DEV_NULL, false,
+ stderr_file_spec.SetFile(FileSystem::DEV_NULL,
FileSpec::Style::native);
} else if (platform_sp && platform_sp->IsHost()) {
// If the debugserver is local and we aren't disabling STDIO, lets use
@@ -840,7 +840,7 @@ Status ProcessGDBRemote::DoLaunch(Module *exe_module,
// does a lot of output.
if ((!stdin_file_spec || !stdout_file_spec || !stderr_file_spec) &&
pty.OpenFirstAvailableMaster(O_RDWR | O_NOCTTY, NULL, 0)) {
- FileSpec slave_name{pty.GetSlaveName(NULL, 0), false};
+ FileSpec slave_name{pty.GetSlaveName(NULL, 0)};
if (!stdin_file_spec)
stdin_file_spec = slave_name;
@@ -4768,7 +4768,8 @@ size_t ProcessGDBRemote::LoadModules(LoadedModuleInfoList &module_list) {
if (!modInfo.get_link_map(link_map))
link_map = LLDB_INVALID_ADDRESS;
- FileSpec file(mod_name, true);
+ FileSpec file(mod_name);
+ FileSystem::Instance().Resolve(file);
lldb::ModuleSP module_sp =
LoadModuleAtAddress(file, link_map, mod_base, mod_base_is_offset);
diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
index 7f8c49c..f1691de 100644
--- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -346,8 +346,8 @@ void ProcessMinidump::ReadModuleList() {
}
const auto uuid = m_minidump_parser.GetModuleUUID(module);
- const auto file_spec =
- FileSpec(name.getValue(), true, GetArchitecture().GetTriple());
+ auto file_spec = FileSpec(name.getValue(), GetArchitecture().GetTriple());
+ FileSystem::Instance().Resolve(file_spec);
ModuleSpec module_spec(file_spec, uuid);
Status error;
lldb::ModuleSP module_sp = GetTarget().GetSharedModule(module_spec, &error);
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 621db714..7791366 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -2749,7 +2749,8 @@ bool ScriptInterpreterPython::LoadScriptingModule(
lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().shared_from_this();
{
- FileSpec target_file(pathname, true);
+ FileSpec target_file(pathname);
+ FileSystem::Instance().Resolve(target_file);
std::string basename(target_file.GetFilename().GetCString());
StreamString command_stream;
diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index df7872f..6e3792b 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -1677,7 +1677,7 @@ void StructuredDataDarwinLog::AddInitCompletionHook(Process &process) {
// Build up the module list.
FileSpecList module_spec_list;
auto module_file_spec =
- FileSpec(GetGlobalProperties()->GetLoggingModuleName(), false);
+ FileSpec(GetGlobalProperties()->GetLoggingModuleName());
module_spec_list.Append(module_file_spec);
// We aren't specifying a source file set.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
index 2ab3707..d9f5012 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
@@ -547,7 +547,7 @@ bool DWARFDebugLine::ParseSupportFiles(
for (uint32_t file_idx = 1;
prologue.GetFile(file_idx, cu_comp_dir, file_spec); ++file_idx) {
if (module_sp->RemapSourceFile(file_spec.GetPath(), remapped_file))
- file_spec.SetFile(remapped_file, false, FileSpec::Style::native);
+ file_spec.SetFile(remapped_file, FileSpec::Style::native);
support_files.Append(file_spec);
}
return true;
@@ -950,7 +950,7 @@ bool DWARFDebugLine::Prologue::GetFile(uint32_t file_idx,
const lldb_private::FileSpec &comp_dir, FileSpec &file) const {
uint32_t idx = file_idx - 1; // File indexes are 1 based...
if (idx < file_names.size()) {
- file.SetFile(file_names[idx].name, false, FileSpec::Style::native);
+ file.SetFile(file_names[idx].name, FileSpec::Style::native);
if (file.IsRelative()) {
if (file_names[idx].dir_idx > 0) {
const uint32_t dir_idx = file_names[idx].dir_idx - 1;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 1a852fc..b8eb482 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -197,7 +197,7 @@ static FileSpec resolveCompDir(const char *path_from_dwarf) {
bool is_symlink = false;
// Always normalize our compile unit directory to get rid of redundant
// slashes and other path anomalies before we use it for path prepending
- FileSpec local_spec(local_path, false);
+ FileSpec local_spec(local_path);
const auto &file_specs = GetGlobalPluginProperties()->GetSymLinkPaths();
for (size_t i = 0; i < file_specs.GetSize() && !is_symlink; ++i)
is_symlink = FileSpec::Equal(file_specs.GetFileSpecAtIndex(i),
@@ -811,7 +811,7 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFUnit *dwarf_cu,
if (module_sp) {
const DWARFDIE cu_die = dwarf_cu->DIE();
if (cu_die) {
- FileSpec cu_file_spec{cu_die.GetName(), false};
+ FileSpec cu_file_spec(cu_die.GetName());
if (cu_file_spec) {
// If we have a full path to the compile unit, we don't need to
// resolve the file. This can be expensive e.g. when the source
@@ -826,8 +826,7 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFUnit *dwarf_cu,
std::string remapped_file;
if (module_sp->RemapSourceFile(cu_file_spec.GetPath(),
remapped_file))
- cu_file_spec.SetFile(remapped_file, false,
- FileSpec::Style::native);
+ cu_file_spec.SetFile(remapped_file, FileSpec::Style::native);
}
LanguageType cu_language = DWARFUnit::LanguageTypeFromDWARF(
@@ -1629,14 +1628,16 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
return dwo_symfile;
}
- FileSpec dwo_file(dwo_name, true);
+ FileSpec dwo_file(dwo_name);
+ FileSystem::Instance().Resolve(dwo_file);
if (dwo_file.IsRelative()) {
const char *comp_dir = cu_die.GetAttributeValueAsString(
this, &dwarf_cu, DW_AT_comp_dir, nullptr);
if (!comp_dir)
return nullptr;
- dwo_file.SetFile(comp_dir, true, FileSpec::Style::native);
+ dwo_file.SetFile(comp_dir, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(dwo_file);
dwo_file.AppendPathComponent(dwo_name);
}
@@ -1680,14 +1681,15 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() {
die.GetAttributeValueAsString(DW_AT_GNU_dwo_name, nullptr);
if (dwo_path) {
ModuleSpec dwo_module_spec;
- dwo_module_spec.GetFileSpec().SetFile(dwo_path, false,
+ dwo_module_spec.GetFileSpec().SetFile(dwo_path,
FileSpec::Style::native);
if (dwo_module_spec.GetFileSpec().IsRelative()) {
const char *comp_dir =
die.GetAttributeValueAsString(DW_AT_comp_dir, nullptr);
if (comp_dir) {
- dwo_module_spec.GetFileSpec().SetFile(comp_dir, true,
+ dwo_module_spec.GetFileSpec().SetFile(comp_dir,
FileSpec::Style::native);
+ FileSystem::Instance().Resolve(dwo_module_spec.GetFileSpec());
dwo_module_spec.GetFileSpec().AppendPathComponent(dwo_path);
}
}
@@ -3877,7 +3879,7 @@ SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() {
ModuleSpec module_spec;
module_spec.GetFileSpec() = m_obj_file->GetFileSpec();
module_spec.GetSymbolFileSpec() =
- FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false);
+ FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp");
FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec);
if (FileSystem::Instance().Exists(dwp_filespec)) {
m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(),
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 150a6f7..7931201 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -351,7 +351,7 @@ void SymbolFileDWARFDebugMap::InitOSO() {
so_symbol->GetType() == eSymbolTypeSourceFile &&
oso_symbol->GetType() == eSymbolTypeObjectFile) {
m_compile_unit_infos[i].so_file.SetFile(
- so_symbol->GetName().AsCString(), false, FileSpec::Style::native);
+ so_symbol->GetName().AsCString(), FileSpec::Style::native);
m_compile_unit_infos[i].oso_path = oso_symbol->GetName();
m_compile_unit_infos[i].oso_mod_time =
llvm::sys::toTimePoint(oso_symbol->GetIntegerValue(0));
@@ -421,7 +421,7 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(
m_oso_map[{comp_unit_info->oso_path, comp_unit_info->oso_mod_time}] =
comp_unit_info->oso_sp;
const char *oso_path = comp_unit_info->oso_path.GetCString();
- FileSpec oso_file(oso_path, false);
+ FileSpec oso_file(oso_path);
ConstString oso_object;
if (FileSystem::Instance().Exists(oso_file)) {
auto oso_mod_time = FileSystem::Instance().GetModificationTime(oso_file);
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 0890c92f..fab43e9 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -594,7 +594,7 @@ SymbolFileNativePDB::CreateCompileUnit(const CompilandIndexItem &cci) {
llvm::StringRef source_file_name =
m_index->compilands().GetMainSourceFile(cci);
- FileSpec fs(source_file_name, false);
+ FileSpec fs(source_file_name);
CompUnitSP cu_sp =
std::make_shared<CompileUnit>(m_obj_file->GetModule(), nullptr, fs,
@@ -1373,7 +1373,7 @@ bool SymbolFileNativePDB::ParseCompileUnitSupportFiles(
for (llvm::StringRef f : cci->m_file_list) {
FileSpec::Style style =
f.startswith("/") ? FileSpec::Style::posix : FileSpec::Style::windows;
- FileSpec spec(f, false, style);
+ FileSpec spec(f, style);
support_files.Append(spec);
}
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index b97ac1b..7bddc15 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -200,7 +200,7 @@ static bool GetDeclarationForSymbol(const PDBSymbol &symbol,
if (!src_file_up)
return false;
- FileSpec spec(src_file_up->getFileName(), /*resolve_path*/ false);
+ FileSpec spec(src_file_up->getFileName());
decl.SetFile(spec);
decl.SetColumn(first_line_up->getColumnNumber());
decl.SetLine(first_line_up->getLineNumber());
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index cb1b66a..0b71f6c 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -363,7 +363,7 @@ bool SymbolFilePDB::ParseCompileUnitSupportFiles(
return false;
while (auto file = files->getNext()) {
- FileSpec spec(file->getFileName(), false, FileSpec::Style::windows);
+ FileSpec spec(file->getFileName(), FileSpec::Style::windows);
support_files.AppendIfUnique(spec);
}
@@ -768,7 +768,7 @@ uint32_t SymbolFilePDB::ResolveSymbolContext(
std::string source_file = compiland->getSourceFileFullPath();
if (source_file.empty())
continue;
- FileSpec this_spec(source_file, false, FileSpec::Style::windows);
+ FileSpec this_spec(source_file, FileSpec::Style::windows);
bool need_full_match = !file_spec.GetDirectory().IsEmpty();
if (FileSpec::Compare(file_spec, this_spec, need_full_match) != 0)
continue;
@@ -929,7 +929,7 @@ VariableSP SymbolFilePDB::ParseVariableForPDBData(
uint32_t src_file_id = first_line->getSourceFileId();
auto src_file = m_session_up->getSourceFileById(src_file_id);
if (src_file) {
- FileSpec spec(src_file->getFileName(), /*resolve_path*/ false);
+ FileSpec spec(src_file->getFileName());
decl.SetFile(spec);
decl.SetColumn(first_line->getColumnNumber());
decl.SetLine(first_line->getLineNumber());
diff --git a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
index a679f60..425b612 100644
--- a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
+++ b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
@@ -101,7 +101,7 @@ SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp,
const FileSpec fspec = file_spec_list.GetFileSpecAtIndex(idx);
module_spec.GetFileSpec() = obj_file->GetFileSpec();
- module_spec.GetFileSpec().ResolvePath();
+ FileSystem::Instance().Resolve(module_spec.GetFileSpec());
module_spec.GetSymbolFileSpec() = fspec;
module_spec.GetUUID() = uuid;
FileSpec dsym_fspec = Symbols::LocateExecutableSymbolFile(module_spec);
diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index a257edf..0d47dd1 100644
--- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -173,7 +173,7 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
resources[strlen("/Contents/Resources/")] = '\0';
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);
+ FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path);
if (FileSystem::Instance().Exists(dsym_uuid_plist_spec)) {
ApplePropertyList plist(dsym_uuid_plist_path);
if (plist) {
@@ -244,7 +244,9 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
}
if (DBGSourcePath[0] == '~') {
FileSpec resolved_source_path(
- DBGSourcePath.c_str(), true);
+ DBGSourcePath.c_str());
+ FileSystem::Instance().Resolve(
+ resolved_source_path);
DBGSourcePath =
resolved_source_path.GetPath();
}
@@ -257,8 +259,8 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
// Add this as another option in addition to
// the full source path remap.
if (do_truncate_remapping_names) {
- FileSpec build_path(key.AsCString(), false);
- FileSpec source_path(DBGSourcePath.c_str(), false);
+ FileSpec build_path(key.AsCString());
+ FileSpec source_path(DBGSourcePath.c_str());
build_path.RemoveLastPathComponent();
build_path.RemoveLastPathComponent();
source_path.RemoveLastPathComponent();
@@ -281,8 +283,8 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
if (!DBGBuildSourcePath.empty() &&
!DBGSourcePath.empty()) {
if (DBGSourcePath[0] == '~') {
- FileSpec resolved_source_path(DBGSourcePath.c_str(),
- true);
+ FileSpec resolved_source_path(DBGSourcePath.c_str());
+ FileSystem::Instance().Resolve(resolved_source_path);
DBGSourcePath = resolved_source_path.GetPath();
}
module_sp->GetSourceMappingList().Append(
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
index 24b6de2..e61f04e 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
@@ -277,7 +277,7 @@ void SystemRuntimeMacOSX::ReadLibdispatchOffsetsAddress() {
// libdispatch symbols were in libSystem.B.dylib up through Mac OS X 10.6
// ("Snow Leopard")
- ModuleSpec libSystem_module_spec(FileSpec("libSystem.B.dylib", false));
+ ModuleSpec libSystem_module_spec(FileSpec("libSystem.B.dylib"));
ModuleSP module_sp(m_process->GetTarget().GetImages().FindFirstModule(
libSystem_module_spec));
if (module_sp)
@@ -287,7 +287,7 @@ void SystemRuntimeMacOSX::ReadLibdispatchOffsetsAddress() {
// libdispatch symbols are in their own dylib as of Mac OS X 10.7 ("Lion")
// and later
if (dispatch_queue_offsets_symbol == NULL) {
- ModuleSpec libdispatch_module_spec(FileSpec("libdispatch.dylib", false));
+ ModuleSpec libdispatch_module_spec(FileSpec("libdispatch.dylib"));
module_sp = m_process->GetTarget().GetImages().FindFirstModule(
libdispatch_module_spec);
if (module_sp)
@@ -331,7 +331,7 @@ void SystemRuntimeMacOSX::ReadLibpthreadOffsetsAddress() {
"pthread_layout_offsets");
const Symbol *libpthread_layout_offsets_symbol = NULL;
- ModuleSpec libpthread_module_spec(FileSpec("libsystem_pthread.dylib", false));
+ ModuleSpec libpthread_module_spec(FileSpec("libsystem_pthread.dylib"));
ModuleSP module_sp(m_process->GetTarget().GetImages().FindFirstModule(
libpthread_module_spec));
if (module_sp) {
@@ -379,7 +379,7 @@ void SystemRuntimeMacOSX::ReadLibdispatchTSDIndexesAddress() {
"dispatch_tsd_indexes");
const Symbol *libdispatch_tsd_indexes_symbol = NULL;
- ModuleSpec libpthread_module_spec(FileSpec("libdispatch.dylib", false));
+ ModuleSpec libpthread_module_spec(FileSpec("libdispatch.dylib"));
ModuleSP module_sp(m_process->GetTarget().GetImages().FindFirstModule(
libpthread_module_spec));
if (module_sp) {
diff --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp
index 8f8a331..79cf018 100644
--- a/lldb/source/Symbol/CompileUnit.cpp
+++ b/lldb/source/Symbol/CompileUnit.cpp
@@ -21,7 +21,7 @@ CompileUnit::CompileUnit(const lldb::ModuleSP &module_sp, void *user_data,
const char *pathname, const lldb::user_id_t cu_sym_id,
lldb::LanguageType language,
lldb_private::LazyBool is_optimized)
- : ModuleChild(module_sp), FileSpec(pathname, false), UserID(cu_sym_id),
+ : ModuleChild(module_sp), FileSpec(pathname), UserID(cu_sym_id),
m_user_data(user_data), m_language(language), m_flags(0),
m_support_files(), m_line_table_ap(), m_variables(),
m_is_optimized(is_optimized) {
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index 846ac77..bd94ec0 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -582,7 +582,7 @@ bool ObjectFile::SplitArchivePathWithObject(const char *path_with_object,
std::string obj;
if (regex_match.GetMatchAtIndex(path_with_object, 1, path) &&
regex_match.GetMatchAtIndex(path_with_object, 2, obj)) {
- archive_file.SetFile(path, false, FileSpec::Style::native);
+ archive_file.SetFile(path, FileSpec::Style::native);
archive_object.SetCString(obj.c_str());
if (must_exist && !FileSystem::Instance().Exists(archive_file))
return false;
diff --git a/lldb/source/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp
index 69fd5424..8d055c1c 100644
--- a/lldb/source/Symbol/Symbol.cpp
+++ b/lldb/source/Symbol/Symbol.cpp
@@ -141,7 +141,7 @@ FileSpec Symbol::GetReExportedSymbolSharedLibrary() const {
// back into a string that is the re-exported name.
intptr_t str_ptr = m_addr_range.GetByteSize();
if (str_ptr != 0)
- return FileSpec((const char *)str_ptr, false);
+ return FileSpec((const char *)str_ptr);
}
return FileSpec();
}
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 8716f50..eac3ed4 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -999,7 +999,7 @@ bool SymbolContextSpecifier::AddSpecification(const char *spec_string,
break;
case eModuleSpecified: {
// See if we can find the Module, if so stick it in the SymbolContext.
- FileSpec module_file_spec(spec_string, false);
+ FileSpec module_file_spec(spec_string);
ModuleSpec module_spec(module_file_spec);
lldb::ModuleSP module_sp(
m_target_sp->GetImages().FindFirstModule(module_spec));
@@ -1013,7 +1013,7 @@ bool SymbolContextSpecifier::AddSpecification(const char *spec_string,
// CompUnits can't necessarily be resolved here, since an inlined function
// might show up in a number of CompUnits. Instead we just convert to a
// FileSpec and store it away.
- m_file_spec_ap.reset(new FileSpec(spec_string, false));
+ m_file_spec_ap.reset(new FileSpec(spec_string));
m_type |= eFileSpecified;
break;
case eLineStartSpecified:
@@ -1068,7 +1068,7 @@ bool SymbolContextSpecifier::SymbolContextMatches(SymbolContext &sc) {
if (m_module_sp.get() != sc.module_sp.get())
return false;
} else {
- FileSpec module_file_spec(m_module_spec, false);
+ FileSpec module_file_spec(m_module_spec);
if (!FileSpec::Equal(module_file_spec, sc.module_sp->GetFileSpec(),
false))
return false;
diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp
index b084c3a..7626fe6 100644
--- a/lldb/source/Target/ModuleCache.cpp
+++ b/lldb/source/Target/ModuleCache.cpp
@@ -76,7 +76,7 @@ FileSpec GetModuleDirectory(const FileSpec &root_dir_spec, const UUID &uuid) {
}
FileSpec GetSymbolFileSpec(const FileSpec &module_file_spec) {
- return FileSpec(module_file_spec.GetPath() + kSymFileExtension, false);
+ return FileSpec(module_file_spec.GetPath() + kSymFileExtension);
}
void DeleteExistingModule(const FileSpec &root_dir_spec,
@@ -141,7 +141,7 @@ Status CreateHostSysRootModuleLink(const FileSpec &root_dir_spec,
}
const auto error = MakeDirectory(
- FileSpec(sysroot_module_path_spec.GetDirectory().AsCString(), false));
+ FileSpec(sysroot_module_path_spec.GetDirectory().AsCString()));
if (error.Fail())
return error;
diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp
index 2b9ebf3..3bd3c34 100644
--- a/lldb/source/Target/PathMappingList.cpp
+++ b/lldb/source/Target/PathMappingList.cpp
@@ -38,7 +38,7 @@ namespace {
ConstString NormalizePath(const ConstString &path) {
// If we use "path" to construct a FileSpec, it will normalize the path for
// us. We then grab the string and turn it back into a ConstString.
- return ConstString(FileSpec(path.GetStringRef(), false).GetPath());
+ return ConstString(FileSpec(path.GetStringRef()).GetPath());
}
}
//----------------------------------------------------------------------
@@ -177,13 +177,13 @@ bool PathMappingList::RemapPath(llvm::StringRef path,
// We need to figure out if the "path" argument is relative. If it is,
// then we should remap, else skip this entry.
if (path_is_relative == eLazyBoolCalculate) {
- path_is_relative = FileSpec(path, false).IsRelative() ? eLazyBoolYes :
- eLazyBoolNo;
+ path_is_relative =
+ FileSpec(path).IsRelative() ? eLazyBoolYes : eLazyBoolNo;
}
if (!path_is_relative)
continue;
}
- FileSpec remapped(it.second.GetStringRef(), false);
+ FileSpec remapped(it.second.GetStringRef());
remapped.AppendPathComponent(path);
new_path = remapped.GetPath();
return true;
@@ -197,7 +197,7 @@ bool PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) co
for (const auto &it : m_pairs) {
if (!path_ref.consume_front(it.second.GetStringRef()))
continue;
- fixed.SetFile(it.first.GetStringRef(), false, FileSpec::Style::native);
+ fixed.SetFile(it.first.GetStringRef(), FileSpec::Style::native);
fixed.AppendPathComponent(path_ref);
return true;
}
@@ -217,8 +217,7 @@ bool PathMappingList::FindFile(const FileSpec &orig_spec,
if (orig_path_len >= prefix_len) {
if (::strncmp(pos->first.GetCString(), orig_path, prefix_len) == 0) {
- new_spec.SetFile(pos->second.GetCString(), false,
- FileSpec::Style::native);
+ new_spec.SetFile(pos->second.GetCString(), FileSpec::Style::native);
new_spec.AppendPathComponent(orig_path + prefix_len);
if (FileSystem::Instance().Exists(new_spec))
return true;
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 4360d82..0a28ae5 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -94,7 +94,7 @@ PlatformProperties::PlatformProperties() {
if (!llvm::sys::path::home_directory(user_home_dir))
return;
- module_cache_dir = FileSpec(user_home_dir.c_str(), false);
+ module_cache_dir = FileSpec(user_home_dir.c_str());
module_cache_dir.AppendPathComponent(".lldb");
module_cache_dir.AppendPathComponent("module_cache");
SetModuleCacheDirectory(module_cache_dir);
@@ -536,9 +536,12 @@ FileSpec Platform::GetWorkingDirectory() {
if (IsHost()) {
llvm::SmallString<64> cwd;
if (llvm::sys::fs::current_path(cwd))
- return FileSpec{};
- else
- return FileSpec(cwd, true);
+ return {};
+ else {
+ FileSpec file_spec(cwd);
+ FileSystem::Instance().Resolve(file_spec);
+ return file_spec;
+ }
} else {
if (!m_working_dir)
m_working_dir = GetRemoteWorkingDirectory();
@@ -556,7 +559,7 @@ static FileSystem::EnumerateDirectoryResult
RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft,
llvm::StringRef path) {
RecurseCopyBaton *rc_baton = (RecurseCopyBaton *)baton;
- FileSpec src(path, false);
+ FileSpec src(path);
namespace fs = llvm::sys::fs;
switch (ft) {
case fs::file_type::fifo_file:
@@ -931,7 +934,8 @@ Status Platform::ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec,
bool Platform::ResolveRemotePath(const FileSpec &platform_path,
FileSpec &resolved_platform_path) {
resolved_platform_path = platform_path;
- return resolved_platform_path.ResolvePath();
+ FileSystem::Instance().Resolve(resolved_platform_path);
+ return true;
}
const ArchSpec &Platform::GetSystemArchitecture() {
@@ -1799,9 +1803,9 @@ uint32_t Platform::LoadImageUsingPaths(lldb_private::Process *process,
{
FileSpec file_to_use;
if (remote_filename.IsAbsolute())
- file_to_use = FileSpec(remote_filename.GetFilename().GetStringRef(),
- false,
- remote_filename.GetPathStyle());
+ file_to_use = FileSpec(remote_filename.GetFilename().GetStringRef(),
+
+ remote_filename.GetPathStyle());
else
file_to_use = remote_filename;
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 9ba1011..622a02c 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -430,7 +430,7 @@ Status ProcessLaunchCommandOptions::SetOptionValue(
case 'i': // STDIN for read only
{
FileAction action;
- if (action.Open(STDIN_FILENO, FileSpec{option_arg, false}, true, false))
+ if (action.Open(STDIN_FILENO, FileSpec(option_arg), true, false))
launch_info.AppendFileAction(action);
break;
}
@@ -438,7 +438,7 @@ Status ProcessLaunchCommandOptions::SetOptionValue(
case 'o': // Open STDOUT for write only
{
FileAction action;
- if (action.Open(STDOUT_FILENO, FileSpec{option_arg, false}, false, true))
+ if (action.Open(STDOUT_FILENO, FileSpec(option_arg), false, true))
launch_info.AppendFileAction(action);
break;
}
@@ -446,7 +446,7 @@ Status ProcessLaunchCommandOptions::SetOptionValue(
case 'e': // STDERR for write only
{
FileAction action;
- if (action.Open(STDERR_FILENO, FileSpec{option_arg, false}, false, true))
+ if (action.Open(STDERR_FILENO, FileSpec(option_arg), false, true))
launch_info.AppendFileAction(action);
break;
}
@@ -458,7 +458,7 @@ Status ProcessLaunchCommandOptions::SetOptionValue(
case 'n': // Disable STDIO
{
FileAction action;
- const FileSpec dev_null{FileSystem::DEV_NULL, false};
+ const FileSpec dev_null(FileSystem::DEV_NULL);
if (action.Open(STDIN_FILENO, dev_null, true, false))
launch_info.AppendFileAction(action);
if (action.Open(STDOUT_FILENO, dev_null, false, true))
@@ -469,7 +469,7 @@ Status ProcessLaunchCommandOptions::SetOptionValue(
}
case 'w':
- launch_info.SetWorkingDirectory(FileSpec{option_arg, false});
+ launch_info.SetWorkingDirectory(FileSpec(option_arg));
break;
case 't': // Open process in new terminal window
@@ -515,7 +515,7 @@ Status ProcessLaunchCommandOptions::SetOptionValue(
case 'c':
if (!option_arg.empty())
- launch_info.SetShell(FileSpec(option_arg, false));
+ launch_info.SetShell(FileSpec(option_arg));
else
launch_info.SetShell(HostInfo::GetDefaultShell());
break;
diff --git a/lldb/source/Target/ProcessInfo.cpp b/lldb/source/Target/ProcessInfo.cpp
index ac03506..d19635f 100644
--- a/lldb/source/Target/ProcessInfo.cpp
+++ b/lldb/source/Target/ProcessInfo.cpp
@@ -29,8 +29,8 @@ ProcessInfo::ProcessInfo()
ProcessInfo::ProcessInfo(const char *name, const ArchSpec &arch,
lldb::pid_t pid)
- : m_executable(name, false), m_arguments(), m_environment(),
- m_uid(UINT32_MAX), m_gid(UINT32_MAX), m_arch(arch), m_pid(pid) {}
+ : m_executable(name), m_arguments(), m_environment(), m_uid(UINT32_MAX),
+ m_gid(UINT32_MAX), m_arch(arch), m_pid(pid) {}
void ProcessInfo::Clear() {
m_executable.Clear();
@@ -96,8 +96,7 @@ void ProcessInfo::SetArguments(char const **argv,
// Yes the first argument is an executable, set it as the executable in
// the launch options. Don't resolve the file path as the path could be a
// remote platform path
- const bool resolve = false;
- m_executable.SetFile(first_arg, resolve, FileSpec::Style::native);
+ m_executable.SetFile(first_arg, FileSpec::Style::native);
}
}
}
@@ -113,8 +112,7 @@ void ProcessInfo::SetArguments(const Args &args, bool first_arg_is_executable) {
// Yes the first argument is an executable, set it as the executable in
// the launch options. Don't resolve the file path as the path could be a
// remote platform path
- const bool resolve = false;
- m_executable.SetFile(first_arg, resolve, FileSpec::Style::native);
+ m_executable.SetFile(first_arg, FileSpec::Style::native);
}
}
}
diff --git a/lldb/source/Target/ProcessLaunchInfo.cpp b/lldb/source/Target/ProcessLaunchInfo.cpp
index b0153ec..9e23b4f 100644
--- a/lldb/source/Target/ProcessLaunchInfo.cpp
+++ b/lldb/source/Target/ProcessLaunchInfo.cpp
@@ -108,8 +108,7 @@ bool ProcessLaunchInfo::AppendOpenFileAction(int fd, const FileSpec &file_spec,
bool ProcessLaunchInfo::AppendSuppressFileAction(int fd, bool read,
bool write) {
FileAction file_action;
- if (file_action.Open(fd, FileSpec{FileSystem::DEV_NULL, false}, read,
- write)) {
+ if (file_action.Open(fd, FileSpec(FileSystem::DEV_NULL), read, write)) {
AppendFileAction(file_action);
return true;
}
@@ -306,8 +305,7 @@ void ProcessLaunchInfo::FinalizeFileActions(Target *target,
open_flags |= O_CLOEXEC;
#endif
if (m_pty->OpenFirstAvailableMaster(open_flags, nullptr, 0)) {
- const FileSpec slave_file_spec{m_pty->GetSlaveName(nullptr, 0),
- false};
+ const FileSpec slave_file_spec(m_pty->GetSlaveName(nullptr, 0));
// Only use the slave tty if we don't have anything specified for
// input and don't have an action for stdin
@@ -359,7 +357,7 @@ bool ProcessLaunchInfo::ConvertArgumentsForLaunchingInShell(
// Add a modified PATH environment variable in case argv[0] is a
// relative path.
const char *argv0 = argv[0];
- FileSpec arg_spec(argv0, false);
+ FileSpec arg_spec(argv0);
if (arg_spec.IsRelative()) {
// We have a relative path to our executable which may not work if we
// just try to run "a.out" (without it being converted to "./a.out")
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index 380ce00..84930b0 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -120,8 +120,8 @@ Status TargetList::CreateTargetInternal(
if (!user_exe_path.empty()) {
ModuleSpecList module_specs;
ModuleSpec module_spec;
- module_spec.GetFileSpec().SetFile(user_exe_path, true,
- FileSpec::Style::native);
+ module_spec.GetFileSpec().SetFile(user_exe_path, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(module_spec.GetFileSpec());
// Resolve the executable in case we are given a path to a application
// bundle like a .app bundle on MacOSX
@@ -346,7 +346,7 @@ Status TargetList::CreateTargetInternal(Debugger &debugger,
if (!arch.IsValid())
arch = specified_arch;
- FileSpec file(user_exe_path, false);
+ FileSpec file(user_exe_path);
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
@@ -355,9 +355,9 @@ Status TargetList::CreateTargetInternal(Debugger &debugger,
Resolver.ResolveFullPath(user_exe_path, unglobbed_path);
if (unglobbed_path.empty())
- file = FileSpec(user_exe_path, false);
+ file = FileSpec(user_exe_path);
else
- file = FileSpec(unglobbed_path.c_str(), false);
+ file = FileSpec(unglobbed_path.c_str());
}
bool user_exe_path_is_bundle = false;
@@ -370,7 +370,7 @@ Status TargetList::CreateTargetInternal(Debugger &debugger,
if (file.IsRelative() && !user_exe_path.empty()) {
llvm::SmallString<64> cwd;
if (! llvm::sys::fs::current_path(cwd)) {
- FileSpec cwd_file(cwd.c_str(), false);
+ FileSpec cwd_file(cwd.c_str());
cwd_file.AppendPathComponent(file);
if (FileSystem::Instance().Exists(cwd_file))
file = cwd_file;
diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp
index 8554f9c..b805fd8 100644
--- a/lldb/source/Utility/FileSpec.cpp
+++ b/lldb/source/Utility/FileSpec.cpp
@@ -10,7 +10,6 @@
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
-#include "lldb/Utility/TildeExpressionResolver.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
@@ -67,38 +66,17 @@ void Denormalize(llvm::SmallVectorImpl<char> &path, FileSpec::Style style) {
} // end anonymous namespace
-void FileSpec::Resolve(llvm::SmallVectorImpl<char> &path) {
- if (path.empty())
- return;
-
- llvm::SmallString<32> Source(path.begin(), path.end());
- StandardTildeExpressionResolver Resolver;
- Resolver.ResolveFullPath(Source, path);
-
- // Save a copy of the original path that's passed in
- llvm::SmallString<128> original_path(path.begin(), path.end());
-
- llvm::sys::fs::make_absolute(path);
- if (!llvm::sys::fs::exists(path)) {
- path.clear();
- path.append(original_path.begin(), original_path.end());
- }
-}
-
FileSpec::FileSpec() : m_style(GetNativeStyle()) {}
//------------------------------------------------------------------
// Default constructor that can take an optional full path to a file on disk.
//------------------------------------------------------------------
-FileSpec::FileSpec(llvm::StringRef path, bool resolve_path, Style style)
- : m_style(style) {
- SetFile(path, resolve_path, style);
+FileSpec::FileSpec(llvm::StringRef path, Style style) : m_style(style) {
+ SetFile(path, style);
}
-FileSpec::FileSpec(llvm::StringRef path, bool resolve_path,
- const llvm::Triple &Triple)
- : FileSpec{path, resolve_path,
- Triple.isOSWindows() ? Style::windows : Style::posix} {}
+FileSpec::FileSpec(llvm::StringRef path, const llvm::Triple &Triple)
+ : FileSpec{path, Triple.isOSWindows() ? Style::windows : Style::posix} {}
//------------------------------------------------------------------
// Copy constructor
@@ -227,16 +205,14 @@ const FileSpec &FileSpec::operator=(const FileSpec &rhs) {
return *this;
}
-void FileSpec::SetFile(llvm::StringRef pathname, bool resolve) {
- SetFile(pathname, resolve, m_style);
-}
+void FileSpec::SetFile(llvm::StringRef pathname) { SetFile(pathname, m_style); }
//------------------------------------------------------------------
// Update the contents of this object with a new path. The path will be split
// up into a directory and filename and stored as uniqued string values for
// quick comparison and efficient memory usage.
//------------------------------------------------------------------
-void FileSpec::SetFile(llvm::StringRef pathname, bool resolve, Style style) {
+void FileSpec::SetFile(llvm::StringRef pathname, Style style) {
m_filename.Clear();
m_directory.Clear();
m_is_resolved = false;
@@ -245,12 +221,7 @@ void FileSpec::SetFile(llvm::StringRef pathname, bool resolve, Style style) {
if (pathname.empty())
return;
- llvm::SmallString<64> resolved(pathname);
-
- if (resolve) {
- FileSpec::Resolve(resolved);
- m_is_resolved = true;
- }
+ llvm::SmallString<128> resolved(pathname);
// Normalize the path by removing ".", ".." and other redundant components.
if (needsNormalization(resolved))
@@ -273,15 +244,14 @@ void FileSpec::SetFile(llvm::StringRef pathname, bool resolve, Style style) {
llvm::StringRef filename = llvm::sys::path::filename(resolved, m_style);
if(!filename.empty())
m_filename.SetString(filename);
+
llvm::StringRef directory = llvm::sys::path::parent_path(resolved, m_style);
if(!directory.empty())
m_directory.SetString(directory);
}
-void FileSpec::SetFile(llvm::StringRef path, bool resolve,
- const llvm::Triple &Triple) {
- return SetFile(path, resolve,
- Triple.isOSWindows() ? Style::windows : Style::posix);
+void FileSpec::SetFile(llvm::StringRef path, const llvm::Triple &Triple) {
+ return SetFile(path, Triple.isOSWindows() ? Style::windows : Style::posix);
}
//----------------------------------------------------------------------
@@ -316,49 +286,7 @@ bool FileSpec::FileEquals(const FileSpec &rhs) const {
// Equal to operator
//------------------------------------------------------------------
bool FileSpec::operator==(const FileSpec &rhs) const {
- if (!FileEquals(rhs))
- return false;
- if (DirectoryEquals(rhs))
- return true;
-
- // TODO: determine if we want to keep this code in here.
- // The code below was added to handle a case where we were trying to set a
- // file and line breakpoint and one path was resolved, and the other not and
- // the directory was in a mount point that resolved to a more complete path:
- // "/tmp/a.c" == "/private/tmp/a.c". I might end up pulling this out...
- if (IsResolved() && rhs.IsResolved()) {
- // Both paths are resolved, no need to look further...
- return false;
- }
-
- FileSpec resolved_lhs(*this);
-
- // If "this" isn't resolved, resolve it
- if (!IsResolved()) {
- if (resolved_lhs.ResolvePath()) {
- // This path wasn't resolved but now it is. Check if the resolved
- // directory is the same as our unresolved directory, and if so, we can
- // mark this object as resolved to avoid more future resolves
- m_is_resolved = (m_directory == resolved_lhs.m_directory);
- } else
- return false;
- }
-
- FileSpec resolved_rhs(rhs);
- if (!rhs.IsResolved()) {
- if (resolved_rhs.ResolvePath()) {
- // rhs's path wasn't resolved but now it is. Check if the resolved
- // directory is the same as rhs's unresolved directory, and if so, we can
- // mark this object as resolved to avoid more future resolves
- rhs.m_is_resolved = (rhs.m_directory == resolved_rhs.m_directory);
- } else
- return false;
- }
-
- // If we reach this point in the code we were able to resolve both paths and
- // since we only resolve the paths if the basenames are equal, then we can
- // just check if both directories are equal...
- return DirectoryEquals(rhs);
+ return FileEquals(rhs) && DirectoryEquals(rhs);
}
//------------------------------------------------------------------
@@ -453,15 +381,6 @@ void FileSpec::Dump(Stream *s) const {
}
}
-bool FileSpec::ResolvePath() {
- if (m_is_resolved)
- return true; // We have already resolved this path
-
- // SetFile(...) will set m_is_resolved correctly if it can resolve the path
- SetFile(GetPath(false), true);
- return m_is_resolved;
-}
-
FileSpec::Style FileSpec::GetPathStyle() const { return m_style; }
//------------------------------------------------------------------
@@ -552,7 +471,7 @@ FileSpec FileSpec::CopyByRemovingLastPathComponent() const {
llvm::SmallString<64> current_path;
GetPath(current_path, false);
if (llvm::sys::path::has_parent_path(current_path, m_style))
- return FileSpec(llvm::sys::path::parent_path(current_path, m_style), false,
+ return FileSpec(llvm::sys::path::parent_path(current_path, m_style),
m_style);
return *this;
}
@@ -570,7 +489,7 @@ void FileSpec::PrependPathComponent(llvm::StringRef component) {
llvm::sys::path::append(new_path,
llvm::sys::path::begin(current_path, m_style),
llvm::sys::path::end(current_path), m_style);
- SetFile(new_path, false, m_style);
+ SetFile(new_path, m_style);
}
void FileSpec::PrependPathComponent(const FileSpec &new_path) {
@@ -581,7 +500,7 @@ void FileSpec::AppendPathComponent(llvm::StringRef component) {
llvm::SmallString<64> current_path;
GetPath(current_path, false);
llvm::sys::path::append(current_path, m_style, component);
- SetFile(current_path, false, m_style);
+ SetFile(current_path, m_style);
}
void FileSpec::AppendPathComponent(const FileSpec &new_path) {
@@ -592,7 +511,7 @@ bool FileSpec::RemoveLastPathComponent() {
llvm::SmallString<64> current_path;
GetPath(current_path, false);
if (llvm::sys::path::has_parent_path(current_path, m_style)) {
- SetFile(llvm::sys::path::parent_path(current_path, m_style), false);
+ SetFile(llvm::sys::path::parent_path(current_path, m_style));
return true;
}
return false;
diff --git a/lldb/tools/lldb-server/lldb-gdbserver.cpp b/lldb/tools/lldb-server/lldb-gdbserver.cpp
index c91a8a8..e7b771f8 100644
--- a/lldb/tools/lldb-server/lldb-gdbserver.cpp
+++ b/lldb/tools/lldb-server/lldb-gdbserver.cpp
@@ -21,13 +21,13 @@
// C++ Includes
-
#include "Acceptor.h"
#include "LLDBServerUtilities.h"
#include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
+#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostGetOpt.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Host/Pipe.h"
@@ -187,7 +187,9 @@ void handle_launch(GDBRemoteCommunicationServerLLGS &gdb_server, int argc,
llvm::errs() << "Error getting current directory: " << ec.message() << "\n";
exit(1);
}
- info.SetWorkingDirectory(FileSpec(cwd, true));
+ FileSpec cwd_spec(cwd);
+ FileSystem::Instance().Resolve(cwd_spec);
+ info.SetWorkingDirectory(cwd_spec);
info.GetEnvironment() = Host::GetEnvironment();
gdb_server.SetLaunchInfo(info);
diff --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp
index cfaf555..9ec3843 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -100,7 +100,7 @@ static void display_usage(const char *progname, const char *subcommand) {
static Status save_socket_id_to_file(const std::string &socket_id,
const FileSpec &file_spec) {
- FileSpec temp_file_spec(file_spec.GetDirectory().AsCString(), false);
+ FileSpec temp_file_spec(file_spec.GetDirectory().AsCString());
Status error(llvm::sys::fs::create_directory(temp_file_spec.GetPath()));
if (error.Fail())
return Status("Failed to create directory %s: %s",
@@ -193,7 +193,7 @@ int main_platform(int argc, char *argv[]) {
case 'f': // Socket file
if (optarg && optarg[0])
- socket_file.SetFile(optarg, false, FileSpec::Style::native);
+ socket_file.SetFile(optarg, FileSpec::Style::native);
break;
case 'p': {
diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp
index e8d3363..631e6a5 100644
--- a/lldb/tools/lldb-test/lldb-test.cpp
+++ b/lldb/tools/lldb-test/lldb-test.cpp
@@ -347,7 +347,7 @@ Error opts::symbols::findFunctions(lldb_private::Module &Module) {
if (!File.empty()) {
assert(Line != 0);
- FileSpec src_file(File, false);
+ FileSpec src_file(File);
size_t cu_count = Module.GetNumCompileUnits();
for (size_t i = 0; i < cu_count; i++) {
lldb::CompUnitSP cu_sp = Module.GetCompileUnitAtIndex(i);
@@ -397,7 +397,7 @@ Error opts::symbols::findBlocks(lldb_private::Module &Module) {
SymbolContextList List;
- FileSpec src_file(File, false);
+ FileSpec src_file(File);
size_t cu_count = Module.GetNumCompileUnits();
for (size_t i = 0; i < cu_count; i++) {
lldb::CompUnitSP cu_sp = Module.GetCompileUnitAtIndex(i);
@@ -695,8 +695,8 @@ int opts::symbols::dumpSymbols(Debugger &Dbg) {
int HadErrors = 0;
for (const auto &File : InputFilenames) {
outs() << "Module: " << File << "\n";
- ModuleSpec Spec{FileSpec(File, false)};
- Spec.GetSymbolFileSpec().SetFile(File, false, FileSpec::Style::native);
+ ModuleSpec Spec{FileSpec(File)};
+ Spec.GetSymbolFileSpec().SetFile(File, FileSpec::Style::native);
auto ModulePtr = std::make_shared<lldb_private::Module>(Spec);
SymbolVendor *Vendor = ModulePtr->GetSymbolVendor();
@@ -721,7 +721,7 @@ static int dumpObjectFiles(Debugger &Dbg) {
int HadErrors = 0;
for (const auto &File : opts::object::InputFilenames) {
- ModuleSpec Spec{FileSpec(File, false)};
+ ModuleSpec Spec{FileSpec(File)};
auto ModulePtr = std::make_shared<lldb_private::Module>(Spec);
// Fetch symbol vendor before we get the section list to give the symbol
diff --git a/lldb/unittests/Core/MangledTest.cpp b/lldb/unittests/Core/MangledTest.cpp
index b727e3b..2fb37b5 100644
--- a/lldb/unittests/Core/MangledTest.cpp
+++ b/lldb/unittests/Core/MangledTest.cpp
@@ -83,8 +83,8 @@ TEST(MangledTest, NameIndexes_FindFunctionSymbols) {
ASSERT_NO_ERROR(llvm::sys::fs::file_size(Obj, Size));
ASSERT_GT(Size, 0u);
- ModuleSpec Spec{FileSpec(Obj, false)};
- Spec.GetSymbolFileSpec().SetFile(Obj, false, FileSpec::Style::native);
+ ModuleSpec Spec{FileSpec(Obj)};
+ Spec.GetSymbolFileSpec().SetFile(Obj, FileSpec::Style::native);
auto M = std::make_shared<Module>(Spec);
auto Count = [M](const char *Name, FunctionNameType Type) -> int {
diff --git a/lldb/unittests/Editline/EditlineTest.cpp b/lldb/unittests/Editline/EditlineTest.cpp
index 963d904..ffa9556 100644
--- a/lldb/unittests/Editline/EditlineTest.cpp
+++ b/lldb/unittests/Editline/EditlineTest.cpp
@@ -20,6 +20,7 @@
#include "gtest/gtest.h"
#include "lldb/Host/Editline.h"
+#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Pipe.h"
#include "lldb/Host/PseudoTerminal.h"
#include "lldb/Utility/Status.h"
@@ -246,6 +247,8 @@ private:
public:
void SetUp() {
+ FileSystem::Initialize();
+
// We need a TERM set properly for editline to work as expected.
setenv("TERM", "vt100", 1);
@@ -263,6 +266,8 @@ public:
_el_adapter.CloseInput();
if (_sp_output_thread)
_sp_output_thread->join();
+
+ FileSystem::Terminate();
}
EditlineAdapter &GetEditlineAdapter() { return _el_adapter; }
diff --git a/lldb/unittests/Expression/ClangParserTest.cpp b/lldb/unittests/Expression/ClangParserTest.cpp
index f6a16cce..69ffb94 100644
--- a/lldb/unittests/Expression/ClangParserTest.cpp
+++ b/lldb/unittests/Expression/ClangParserTest.cpp
@@ -34,7 +34,7 @@ struct ClangHostTest : public testing::Test {
static std::string ComputeClangDir(std::string lldb_shlib_path,
bool verify = false) {
FileSpec clang_dir;
- FileSpec lldb_shlib_spec(lldb_shlib_path, false);
+ FileSpec lldb_shlib_spec(lldb_shlib_path);
ComputeClangDirectory(lldb_shlib_spec, clang_dir, verify);
return clang_dir.GetPath();
}
diff --git a/lldb/unittests/Host/FileSystemTest.cpp b/lldb/unittests/Host/FileSystemTest.cpp
index 142ad7b..76ac83f 100644
--- a/lldb/unittests/Host/FileSystemTest.cpp
+++ b/lldb/unittests/Host/FileSystemTest.cpp
@@ -158,16 +158,16 @@ public:
TEST(FileSystemTest, FileAndDirectoryComponents) {
using namespace std::chrono;
+ FileSystem fs;
- const bool resolve = true;
#ifdef _WIN32
- FileSpec fs1("C:\\FILE\\THAT\\DOES\\NOT\\EXIST.TXT", !resolve);
+ FileSpec fs1("C:\\FILE\\THAT\\DOES\\NOT\\EXIST.TXT");
#else
- FileSpec fs1("/file/that/does/not/exist.txt", !resolve);
+ FileSpec fs1("/file/that/does/not/exist.txt");
#endif
- FileSpec fs2(TestMainArgv0, resolve);
+ FileSpec fs2(TestMainArgv0);
- FileSystem fs;
+ fs.Resolve(fs2);
EXPECT_EQ(system_clock::time_point(), fs.GetModificationTime(fs1));
EXPECT_LT(system_clock::time_point() + hours(24 * 365 * 20),
@@ -188,17 +188,17 @@ TEST(FileSystemTest, Exists) {
FileSystem fs(GetSimpleDummyFS());
EXPECT_TRUE(fs.Exists("/foo"));
- EXPECT_TRUE(fs.Exists(FileSpec("/foo", false, FileSpec::Style::posix)));
+ EXPECT_TRUE(fs.Exists(FileSpec("/foo", FileSpec::Style::posix)));
}
TEST(FileSystemTest, Readable) {
FileSystem fs(GetSimpleDummyFS());
EXPECT_TRUE(fs.Readable("/foo"));
- EXPECT_TRUE(fs.Readable(FileSpec("/foo", false, FileSpec::Style::posix)));
+ EXPECT_TRUE(fs.Readable(FileSpec("/foo", FileSpec::Style::posix)));
EXPECT_FALSE(fs.Readable("/qux"));
- EXPECT_FALSE(fs.Readable(FileSpec("/qux", false, FileSpec::Style::posix)));
+ EXPECT_FALSE(fs.Readable(FileSpec("/qux", FileSpec::Style::posix)));
}
TEST(FileSystemTest, GetByteSize) {
@@ -206,7 +206,7 @@ TEST(FileSystemTest, GetByteSize) {
EXPECT_EQ((uint64_t)1024, fs.GetByteSize("/foo"));
EXPECT_EQ((uint64_t)1024,
- fs.GetByteSize(FileSpec("/foo", false, FileSpec::Style::posix)));
+ fs.GetByteSize(FileSpec("/foo", FileSpec::Style::posix)));
}
TEST(FileSystemTest, GetPermissions) {
@@ -214,7 +214,7 @@ TEST(FileSystemTest, GetPermissions) {
EXPECT_EQ(sys::fs::all_all, fs.GetPermissions("/foo"));
EXPECT_EQ(sys::fs::all_all,
- fs.GetPermissions(FileSpec("/foo", false, FileSpec::Style::posix)));
+ fs.GetPermissions(FileSpec("/foo", FileSpec::Style::posix)));
}
TEST(FileSystemTest, MakeAbsolute) {
@@ -229,7 +229,7 @@ TEST(FileSystemTest, MakeAbsolute) {
}
{
- FileSpec file_spec("foo", false);
+ FileSpec file_spec("foo");
auto EC = fs.MakeAbsolute(file_spec);
EXPECT_FALSE(EC);
EXPECT_EQ("/foo", file_spec.GetPath());
@@ -247,7 +247,7 @@ TEST(FileSystemTest, Resolve) {
}
{
- FileSpec file_spec("foo", false);
+ FileSpec file_spec("foo");
fs.Resolve(file_spec);
EXPECT_EQ("/foo", file_spec.GetPath());
}
@@ -260,7 +260,7 @@ TEST(FileSystemTest, Resolve) {
}
{
- FileSpec file_spec("bogus", false);
+ FileSpec file_spec("bogus");
fs.Resolve(file_spec);
EXPECT_EQ("bogus", file_spec.GetPath());
}
diff --git a/lldb/unittests/Host/SymbolsTest.cpp b/lldb/unittests/Host/SymbolsTest.cpp
index 7b5996b..e525f3d 100644
--- a/lldb/unittests/Host/SymbolsTest.cpp
+++ b/lldb/unittests/Host/SymbolsTest.cpp
@@ -43,8 +43,7 @@ TEST_F(SymbolsTest,
ModuleSpec module_spec;
// using a GUID here because the symbol file shouldn't actually exist on disk
module_spec.GetSymbolFileSpec().SetFile(
- "4A524676-B24B-4F4E-968A-551D465EBAF1.so", false,
- FileSpec::Style::native);
+ "4A524676-B24B-4F4E-968A-551D465EBAF1.so", FileSpec::Style::native);
FileSpec symbol_file_spec = Symbols::LocateExecutableSymbolFile(module_spec);
EXPECT_TRUE(symbol_file_spec.GetFilename().IsEmpty());
}
diff --git a/lldb/unittests/Host/linux/HostTest.cpp b/lldb/unittests/Host/linux/HostTest.cpp
index 7ea702d..d539dbc 100644
--- a/lldb/unittests/Host/linux/HostTest.cpp
+++ b/lldb/unittests/Host/linux/HostTest.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/Host/Host.h"
+#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "gtest/gtest.h"
@@ -17,8 +18,14 @@ using namespace lldb_private;
namespace {
class HostTest : public testing::Test {
public:
- static void SetUpTestCase() { HostInfo::Initialize(); }
- static void TearDownTestCase() { HostInfo::Terminate(); }
+ static void SetUpTestCase() {
+ FileSystem::Initialize();
+ HostInfo::Initialize();
+ }
+ static void TearDownTestCase() {
+ HostInfo::Terminate();
+ FileSystem::Terminate();
+ }
};
} // namespace
diff --git a/lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp b/lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
index f670b23..a28c49f 100644
--- a/lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
+++ b/lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
@@ -74,8 +74,8 @@ TEST_F(ObjectFileELFTest, SectionsResolveConsistently) {
ASSERT_NO_ERROR(llvm::sys::fs::file_size(obj, size));
ASSERT_GT(size, 0u);
- ModuleSpec spec{FileSpec(obj, false)};
- spec.GetSymbolFileSpec().SetFile(obj, false, FileSpec::Style::native);
+ ModuleSpec spec{FileSpec(obj)};
+ spec.GetSymbolFileSpec().SetFile(obj, FileSpec::Style::native);
auto module_sp = std::make_shared<Module>(spec);
SectionList *list = module_sp->GetSectionList();
ASSERT_NE(nullptr, list);
@@ -134,7 +134,7 @@ Sections:
TEST_F(ObjectFileELFTest, GetModuleSpecifications_EarlySectionHeaders) {
std::string SO = GetInputFilePath("early-section-headers.so");
ModuleSpecList Specs;
- ASSERT_EQ(1u, ObjectFile::GetModuleSpecifications(FileSpec(SO, false), 0, 0, Specs));
+ ASSERT_EQ(1u, ObjectFile::GetModuleSpecifications(FileSpec(SO), 0, 0, Specs));
ModuleSpec Spec;
ASSERT_TRUE(Specs.GetModuleSpecAtIndex(0, Spec)) ;
UUID Uuid;
diff --git a/lldb/unittests/Platform/PlatformDarwinTest.cpp b/lldb/unittests/Platform/PlatformDarwinTest.cpp
index c0a9aef..a388f41 100644
--- a/lldb/unittests/Platform/PlatformDarwinTest.cpp
+++ b/lldb/unittests/Platform/PlatformDarwinTest.cpp
@@ -55,19 +55,18 @@ TEST(PlatformDarwinTest, TestParseVersionBuildDir) {
std::string base = "/Applications/Xcode.app/Contents/Developer/Platforms/";
EXPECT_TRUE(PlatformDarwinTester::SDKSupportsModules(
PlatformDarwin::SDKType::iPhoneSimulator,
- FileSpec(base +
- "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk",
- false)));
+ FileSpec(
+ base +
+ "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk")));
EXPECT_FALSE(PlatformDarwinTester::SDKSupportsModules(
PlatformDarwin::SDKType::iPhoneSimulator,
- FileSpec(base +
- "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.2.sdk",
- false)));
+ FileSpec(
+ base +
+ "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.2.sdk")));
EXPECT_TRUE(PlatformDarwinTester::SDKSupportsModules(
PlatformDarwin::SDKType::MacOSX,
- FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk",
- false)));
+ FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk")));
EXPECT_FALSE(PlatformDarwinTester::SDKSupportsModules(
PlatformDarwin::SDKType::MacOSX,
- FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk", false)));
+ FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")));
}
diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index 41ca091..6742f1e 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -169,14 +169,14 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo) {
llvm::Triple triple("i386-pc-linux");
FileSpec file_specs[] = {
- FileSpec("/foo/bar.so", false, FileSpec::Style::posix),
- FileSpec("/foo/baz.so", false, FileSpec::Style::posix),
+ FileSpec("/foo/bar.so", FileSpec::Style::posix),
+ FileSpec("/foo/baz.so", FileSpec::Style::posix),
// This is a bit dodgy but we currently depend on GetModulesInfo not
// performing denormalization. It can go away once the users
// (DynamicLoaderPOSIXDYLD, at least) correctly set the path syntax for
// the FileSpecs they create.
- FileSpec("/foo/baw.so", false, FileSpec::Style::windows),
+ FileSpec("/foo/baw.so", FileSpec::Style::windows),
};
std::future<llvm::Optional<std::vector<ModuleSpec>>> async_result =
std::async(std::launch::async,
@@ -203,7 +203,7 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo) {
TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo_UUID20) {
llvm::Triple triple("i386-pc-linux");
- FileSpec file_spec("/foo/bar.so", false, FileSpec::Style::posix);
+ FileSpec file_spec("/foo/bar.so", FileSpec::Style::posix);
std::future<llvm::Optional<std::vector<ModuleSpec>>> async_result =
std::async(std::launch::async,
[&] { return client.GetModulesInfo(file_spec, triple); });
@@ -227,7 +227,7 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo_UUID20) {
TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfoInvalidResponse) {
llvm::Triple triple("i386-pc-linux");
- FileSpec file_spec("/foo/bar.so", false, FileSpec::Style::posix);
+ FileSpec file_spec("/foo/bar.so", FileSpec::Style::posix);
const char *invalid_responses[] = {
// no UUID
diff --git a/lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp b/lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp
index f2054f7..1c12778 100644
--- a/lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp
+++ b/lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp
@@ -113,7 +113,7 @@ void DWARFCallFrameInfoTest::TestBasic(DWARFCallFrameInfo::Type type,
ASSERT_NO_ERROR(llvm::sys::fs::file_size(obj, size));
ASSERT_GT(size, 0u);
- auto module_sp = std::make_shared<Module>(ModuleSpec(FileSpec(obj, false)));
+ auto module_sp = std::make_shared<Module>(ModuleSpec(FileSpec(obj)));
SectionList *list = module_sp->GetSectionList();
ASSERT_NE(nullptr, list);
diff --git a/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp b/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
index 9dd88d1..fc540ff 100644
--- a/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
@@ -64,7 +64,7 @@ protected:
TEST_F(SymbolFileDWARFTests, TestAbilitiesForDWARF) {
// Test that when we have Dwarf debug info, SymbolFileDWARF is used.
- FileSpec fspec(m_dwarf_test_exe, false);
+ FileSpec fspec(m_dwarf_test_exe);
ArchSpec aspec("i686-pc-windows");
lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
diff --git a/lldb/unittests/Target/ModuleCacheTest.cpp b/lldb/unittests/Target/ModuleCacheTest.cpp
index f1a5a91..9678bb0 100644
--- a/lldb/unittests/Target/ModuleCacheTest.cpp
+++ b/lldb/unittests/Target/ModuleCacheTest.cpp
@@ -45,7 +45,7 @@ static const uint32_t uuid_bytes = 20;
static const size_t module_size = 5602;
static FileSpec GetDummyRemotePath() {
- FileSpec fs("/", false, FileSpec::Style::posix);
+ FileSpec fs("/", FileSpec::Style::posix);
fs.AppendPathComponent(dummy_remote_dir);
fs.AppendPathComponent(module_name);
return fs;
diff --git a/lldb/unittests/Target/PathMappingListTest.cpp b/lldb/unittests/Target/PathMappingListTest.cpp
index cb807d0..42db27f 100644
--- a/lldb/unittests/Target/PathMappingListTest.cpp
+++ b/lldb/unittests/Target/PathMappingListTest.cpp
@@ -19,8 +19,7 @@ namespace {
struct Matches {
FileSpec original;
FileSpec remapped;
- Matches(const char *o, const char *r)
- : original(o, false), remapped(r, false) {}
+ Matches(const char *o, const char *r) : original(o), remapped(r) {}
};
} // namespace
@@ -38,7 +37,7 @@ static void TestPathMappings(const PathMappingList &map,
std::string orig_normalized = match.original.GetPath();
EXPECT_TRUE(
map.RemapPath(ConstString(match.original.GetPath()), actual_remapped));
- EXPECT_EQ(FileSpec(actual_remapped.GetStringRef(), false), match.remapped);
+ EXPECT_EQ(FileSpec(actual_remapped.GetStringRef()), match.remapped);
FileSpec unmapped_spec;
EXPECT_TRUE(map.ReverseRemapPath(match.remapped, unmapped_spec));
std::string unmapped_path = unmapped_spec.GetPath();
diff --git a/lldb/unittests/Utility/FileSpecTest.cpp b/lldb/unittests/Utility/FileSpecTest.cpp
index a271229..eae3a09 100644
--- a/lldb/unittests/Utility/FileSpecTest.cpp
+++ b/lldb/unittests/Utility/FileSpecTest.cpp
@@ -14,92 +14,91 @@
using namespace lldb_private;
TEST(FileSpecTest, FileAndDirectoryComponents) {
- FileSpec fs_posix("/foo/bar", false, FileSpec::Style::posix);
+ FileSpec fs_posix("/foo/bar", FileSpec::Style::posix);
EXPECT_STREQ("/foo/bar", fs_posix.GetCString());
EXPECT_STREQ("/foo", fs_posix.GetDirectory().GetCString());
EXPECT_STREQ("bar", fs_posix.GetFilename().GetCString());
- FileSpec fs_windows("F:\\bar", false, FileSpec::Style::windows);
+ FileSpec fs_windows("F:\\bar", FileSpec::Style::windows);
EXPECT_STREQ("F:\\bar", fs_windows.GetCString());
// EXPECT_STREQ("F:\\", fs_windows.GetDirectory().GetCString()); // It returns
// "F:/"
EXPECT_STREQ("bar", fs_windows.GetFilename().GetCString());
- FileSpec fs_posix_root("/", false, FileSpec::Style::posix);
+ FileSpec fs_posix_root("/", FileSpec::Style::posix);
EXPECT_STREQ("/", fs_posix_root.GetCString());
EXPECT_EQ(nullptr, fs_posix_root.GetDirectory().GetCString());
EXPECT_STREQ("/", fs_posix_root.GetFilename().GetCString());
- FileSpec fs_net_drive("//net", false, FileSpec::Style::posix);
+ FileSpec fs_net_drive("//net", FileSpec::Style::posix);
EXPECT_STREQ("//net", fs_net_drive.GetCString());
EXPECT_EQ(nullptr, fs_net_drive.GetDirectory().GetCString());
EXPECT_STREQ("//net", fs_net_drive.GetFilename().GetCString());
- FileSpec fs_net_root("//net/", false, FileSpec::Style::posix);
+ FileSpec fs_net_root("//net/", FileSpec::Style::posix);
EXPECT_STREQ("//net/", fs_net_root.GetCString());
EXPECT_STREQ("//net", fs_net_root.GetDirectory().GetCString());
EXPECT_STREQ("/", fs_net_root.GetFilename().GetCString());
- FileSpec fs_windows_drive("F:", false, FileSpec::Style::windows);
+ FileSpec fs_windows_drive("F:", FileSpec::Style::windows);
EXPECT_STREQ("F:", fs_windows_drive.GetCString());
EXPECT_EQ(nullptr, fs_windows_drive.GetDirectory().GetCString());
EXPECT_STREQ("F:", fs_windows_drive.GetFilename().GetCString());
- FileSpec fs_windows_root("F:\\", false, FileSpec::Style::windows);
+ FileSpec fs_windows_root("F:\\", FileSpec::Style::windows);
EXPECT_STREQ("F:\\", fs_windows_root.GetCString());
EXPECT_STREQ("F:", fs_windows_root.GetDirectory().GetCString());
// EXPECT_STREQ("\\", fs_windows_root.GetFilename().GetCString()); // It
// returns "/"
- FileSpec fs_posix_long("/foo/bar/baz", false, FileSpec::Style::posix);
+ FileSpec fs_posix_long("/foo/bar/baz", FileSpec::Style::posix);
EXPECT_STREQ("/foo/bar/baz", fs_posix_long.GetCString());
EXPECT_STREQ("/foo/bar", fs_posix_long.GetDirectory().GetCString());
EXPECT_STREQ("baz", fs_posix_long.GetFilename().GetCString());
- FileSpec fs_windows_long("F:\\bar\\baz", false, FileSpec::Style::windows);
+ FileSpec fs_windows_long("F:\\bar\\baz", FileSpec::Style::windows);
EXPECT_STREQ("F:\\bar\\baz", fs_windows_long.GetCString());
// EXPECT_STREQ("F:\\bar", fs_windows_long.GetDirectory().GetCString()); // It
// returns "F:/bar"
EXPECT_STREQ("baz", fs_windows_long.GetFilename().GetCString());
- FileSpec fs_posix_trailing_slash("/foo/bar/", false, FileSpec::Style::posix);
+ FileSpec fs_posix_trailing_slash("/foo/bar/", FileSpec::Style::posix);
EXPECT_STREQ("/foo/bar", fs_posix_trailing_slash.GetCString());
EXPECT_STREQ("/foo", fs_posix_trailing_slash.GetDirectory().GetCString());
EXPECT_STREQ("bar", fs_posix_trailing_slash.GetFilename().GetCString());
- FileSpec fs_windows_trailing_slash("F:\\bar\\", false,
- FileSpec::Style::windows);
+ FileSpec fs_windows_trailing_slash("F:\\bar\\", FileSpec::Style::windows);
EXPECT_STREQ("F:\\bar", fs_windows_trailing_slash.GetCString());
EXPECT_STREQ("bar", fs_windows_trailing_slash.GetFilename().GetCString());
}
TEST(FileSpecTest, AppendPathComponent) {
- FileSpec fs_posix("/foo", false, FileSpec::Style::posix);
+ FileSpec fs_posix("/foo", FileSpec::Style::posix);
fs_posix.AppendPathComponent("bar");
EXPECT_STREQ("/foo/bar", fs_posix.GetCString());
EXPECT_STREQ("/foo", fs_posix.GetDirectory().GetCString());
EXPECT_STREQ("bar", fs_posix.GetFilename().GetCString());
- FileSpec fs_posix_2("/foo", false, FileSpec::Style::posix);
+ FileSpec fs_posix_2("/foo", FileSpec::Style::posix);
fs_posix_2.AppendPathComponent("//bar/baz");
EXPECT_STREQ("/foo/bar/baz", fs_posix_2.GetCString());
EXPECT_STREQ("/foo/bar", fs_posix_2.GetDirectory().GetCString());
EXPECT_STREQ("baz", fs_posix_2.GetFilename().GetCString());
- FileSpec fs_windows("F:\\bar", false, FileSpec::Style::windows);
+ FileSpec fs_windows("F:\\bar", FileSpec::Style::windows);
fs_windows.AppendPathComponent("baz");
EXPECT_STREQ("F:\\bar\\baz", fs_windows.GetCString());
// EXPECT_STREQ("F:\\bar", fs_windows.GetDirectory().GetCString()); // It
// returns "F:/bar"
EXPECT_STREQ("baz", fs_windows.GetFilename().GetCString());
- FileSpec fs_posix_root("/", false, FileSpec::Style::posix);
+ FileSpec fs_posix_root("/", FileSpec::Style::posix);
fs_posix_root.AppendPathComponent("bar");
EXPECT_STREQ("/bar", fs_posix_root.GetCString());
EXPECT_STREQ("/", fs_posix_root.GetDirectory().GetCString());
EXPECT_STREQ("bar", fs_posix_root.GetFilename().GetCString());
- FileSpec fs_windows_root("F:\\", false, FileSpec::Style::windows);
+ FileSpec fs_windows_root("F:\\", FileSpec::Style::windows);
fs_windows_root.AppendPathComponent("bar");
EXPECT_STREQ("F:\\bar", fs_windows_root.GetCString());
// EXPECT_STREQ("F:\\", fs_windows_root.GetDirectory().GetCString()); // It
@@ -108,7 +107,7 @@ TEST(FileSpecTest, AppendPathComponent) {
}
TEST(FileSpecTest, CopyByAppendingPathComponent) {
- FileSpec fs = FileSpec("/foo", false, FileSpec::Style::posix)
+ FileSpec fs = FileSpec("/foo", FileSpec::Style::posix)
.CopyByAppendingPathComponent("bar");
EXPECT_STREQ("/foo/bar", fs.GetCString());
EXPECT_STREQ("/foo", fs.GetDirectory().GetCString());
@@ -116,30 +115,30 @@ TEST(FileSpecTest, CopyByAppendingPathComponent) {
}
TEST(FileSpecTest, PrependPathComponent) {
- FileSpec fs_posix("foo", false, FileSpec::Style::posix);
+ FileSpec fs_posix("foo", FileSpec::Style::posix);
fs_posix.PrependPathComponent("/bar");
EXPECT_STREQ("/bar/foo", fs_posix.GetCString());
- FileSpec fs_posix_2("foo/bar", false, FileSpec::Style::posix);
+ FileSpec fs_posix_2("foo/bar", FileSpec::Style::posix);
fs_posix_2.PrependPathComponent("/baz");
EXPECT_STREQ("/baz/foo/bar", fs_posix_2.GetCString());
- FileSpec fs_windows("baz", false, FileSpec::Style::windows);
+ FileSpec fs_windows("baz", FileSpec::Style::windows);
fs_windows.PrependPathComponent("F:\\bar");
EXPECT_STREQ("F:\\bar\\baz", fs_windows.GetCString());
- FileSpec fs_posix_root("bar", false, FileSpec::Style::posix);
+ FileSpec fs_posix_root("bar", FileSpec::Style::posix);
fs_posix_root.PrependPathComponent("/");
EXPECT_STREQ("/bar", fs_posix_root.GetCString());
- FileSpec fs_windows_root("bar", false, FileSpec::Style::windows);
+ FileSpec fs_windows_root("bar", FileSpec::Style::windows);
fs_windows_root.PrependPathComponent("F:\\");
EXPECT_STREQ("F:\\bar", fs_windows_root.GetCString());
}
TEST(FileSpecTest, EqualSeparator) {
- FileSpec backward("C:\\foo\\bar", false, FileSpec::Style::windows);
- FileSpec forward("C:/foo/bar", false, FileSpec::Style::windows);
+ FileSpec backward("C:\\foo\\bar", FileSpec::Style::windows);
+ FileSpec forward("C:/foo/bar", FileSpec::Style::windows);
EXPECT_EQ(forward, backward);
}
@@ -155,8 +154,8 @@ TEST(FileSpecTest, EqualDotsWindows) {
};
for (const auto &test : tests) {
- FileSpec one(test.first, false, FileSpec::Style::windows);
- FileSpec two(test.second, false, FileSpec::Style::windows);
+ FileSpec one(test.first, FileSpec::Style::windows);
+ FileSpec two(test.second, FileSpec::Style::windows);
EXPECT_EQ(one, two);
}
}
@@ -171,8 +170,8 @@ TEST(FileSpecTest, EqualDotsPosix) {
};
for (const auto &test : tests) {
- FileSpec one(test.first, false, FileSpec::Style::posix);
- FileSpec two(test.second, false, FileSpec::Style::posix);
+ FileSpec one(test.first, FileSpec::Style::posix);
+ FileSpec two(test.second, FileSpec::Style::posix);
EXPECT_EQ(one, two);
}
}
@@ -185,8 +184,8 @@ TEST(FileSpecTest, EqualDotsPosixRoot) {
};
for (const auto &test : tests) {
- FileSpec one(test.first, false, FileSpec::Style::posix);
- FileSpec two(test.second, false, FileSpec::Style::posix);
+ FileSpec one(test.first, FileSpec::Style::posix);
+ FileSpec two(test.second, FileSpec::Style::posix);
EXPECT_EQ(one, two);
}
}
@@ -222,7 +221,7 @@ TEST(FileSpecTest, GetNormalizedPath) {
for (auto test : posix_tests) {
SCOPED_TRACE(llvm::Twine("test.first = ") + test.first);
EXPECT_EQ(test.second,
- FileSpec(test.first, false, FileSpec::Style::posix).GetPath());
+ FileSpec(test.first, FileSpec::Style::posix).GetPath());
}
std::pair<const char *, const char *> windows_tests[] = {
@@ -254,7 +253,7 @@ TEST(FileSpecTest, GetNormalizedPath) {
};
for (auto test : windows_tests) {
EXPECT_EQ(test.second,
- FileSpec(test.first, false, FileSpec::Style::windows).GetPath())
+ FileSpec(test.first, FileSpec::Style::windows).GetPath())
<< "Original path: " << test.first;
}
}
@@ -267,17 +266,17 @@ TEST(FileSpecTest, FormatFileSpec) {
EXPECT_EQ("(empty)", llvm::formatv("{0:D}", F).str());
EXPECT_EQ("(empty)", llvm::formatv("{0:F}", F).str());
- F = FileSpec("C:\\foo\\bar.txt", false, win);
+ F = FileSpec("C:\\foo\\bar.txt", win);
EXPECT_EQ("C:\\foo\\bar.txt", llvm::formatv("{0}", F).str());
EXPECT_EQ("C:\\foo\\", llvm::formatv("{0:D}", F).str());
EXPECT_EQ("bar.txt", llvm::formatv("{0:F}", F).str());
- F = FileSpec("foo\\bar.txt", false, win);
+ F = FileSpec("foo\\bar.txt", win);
EXPECT_EQ("foo\\bar.txt", llvm::formatv("{0}", F).str());
EXPECT_EQ("foo\\", llvm::formatv("{0:D}", F).str());
EXPECT_EQ("bar.txt", llvm::formatv("{0:F}", F).str());
- F = FileSpec("foo", false, win);
+ F = FileSpec("foo", win);
EXPECT_EQ("foo", llvm::formatv("{0}", F).str());
EXPECT_EQ("foo", llvm::formatv("{0:F}", F).str());
EXPECT_EQ("(empty)", llvm::formatv("{0:D}", F).str());
@@ -306,7 +305,7 @@ TEST(FileSpecTest, IsRelative) {
"/foo/../.",
};
for (const auto &path: not_relative) {
- FileSpec spec(path, false, FileSpec::Style::posix);
+ FileSpec spec(path, FileSpec::Style::posix);
EXPECT_FALSE(spec.IsRelative());
}
llvm::StringRef is_relative[] = {
@@ -324,13 +323,13 @@ TEST(FileSpecTest, IsRelative) {
"./foo/bar.c"
};
for (const auto &path: is_relative) {
- FileSpec spec(path, false, FileSpec::Style::posix);
+ FileSpec spec(path, FileSpec::Style::posix);
EXPECT_TRUE(spec.IsRelative());
}
}
TEST(FileSpecTest, RemoveLastPathComponent) {
- FileSpec fs_posix("/foo/bar/baz", false, FileSpec::Style::posix);
+ FileSpec fs_posix("/foo/bar/baz", FileSpec::Style::posix);
EXPECT_STREQ("/foo/bar/baz", fs_posix.GetCString());
EXPECT_TRUE(fs_posix.RemoveLastPathComponent());
EXPECT_STREQ("/foo/bar", fs_posix.GetCString());
@@ -341,7 +340,7 @@ TEST(FileSpecTest, RemoveLastPathComponent) {
EXPECT_FALSE(fs_posix.RemoveLastPathComponent());
EXPECT_STREQ("/", fs_posix.GetCString());
- FileSpec fs_posix_relative("./foo/bar/baz", false, FileSpec::Style::posix);
+ FileSpec fs_posix_relative("./foo/bar/baz", FileSpec::Style::posix);
EXPECT_STREQ("foo/bar/baz", fs_posix_relative.GetCString());
EXPECT_TRUE(fs_posix_relative.RemoveLastPathComponent());
EXPECT_STREQ("foo/bar", fs_posix_relative.GetCString());
@@ -350,14 +349,14 @@ TEST(FileSpecTest, RemoveLastPathComponent) {
EXPECT_FALSE(fs_posix_relative.RemoveLastPathComponent());
EXPECT_STREQ("foo", fs_posix_relative.GetCString());
- FileSpec fs_posix_relative2("./", false, FileSpec::Style::posix);
+ FileSpec fs_posix_relative2("./", FileSpec::Style::posix);
EXPECT_STREQ(".", fs_posix_relative2.GetCString());
EXPECT_FALSE(fs_posix_relative2.RemoveLastPathComponent());
EXPECT_STREQ(".", fs_posix_relative2.GetCString());
EXPECT_FALSE(fs_posix_relative.RemoveLastPathComponent());
EXPECT_STREQ(".", fs_posix_relative2.GetCString());
- FileSpec fs_windows("C:\\foo\\bar\\baz", false, FileSpec::Style::windows);
+ FileSpec fs_windows("C:\\foo\\bar\\baz", FileSpec::Style::windows);
EXPECT_STREQ("C:\\foo\\bar\\baz", fs_windows.GetCString());
EXPECT_TRUE(fs_windows.RemoveLastPathComponent());
EXPECT_STREQ("C:\\foo\\bar", fs_windows.GetCString());
diff --git a/lldb/unittests/Utility/StructuredDataTest.cpp b/lldb/unittests/Utility/StructuredDataTest.cpp
index 15a2ca6..878b202 100644
--- a/lldb/unittests/Utility/StructuredDataTest.cpp
+++ b/lldb/unittests/Utility/StructuredDataTest.cpp
@@ -35,11 +35,11 @@ TEST(StructuredDataTest, StringDump) {
TEST(StructuredDataTest, ParseJSONFromFile) {
Status status;
auto object_sp = StructuredData::ParseJSONFromFile(
- FileSpec("non-existing-file.json", false), status);
+ FileSpec("non-existing-file.json"), status);
EXPECT_EQ(nullptr, object_sp);
std::string input = GetInputFilePath("StructuredData-basic.json");
- object_sp = StructuredData::ParseJSONFromFile(FileSpec(input, false), status);
+ object_sp = StructuredData::ParseJSONFromFile(FileSpec(input), status);
ASSERT_NE(nullptr, object_sp);
StreamString S;