[FileSystem] Move path resolution logic out of FileSpec
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 1 Nov 2018 21:05:36 +0000 (21:05 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 1 Nov 2018 21:05:36 +0000 (21:05 +0000)
This patch removes the logic for resolving paths out of FileSpec and
updates call sites to rely on the FileSystem class instead.

Differential revision: https://reviews.llvm.org/D53915

llvm-svn: 345890

128 files changed:
lldb/include/lldb/Target/Process.h
lldb/include/lldb/Utility/FileSpec.h
lldb/source/API/SBAttachInfo.cpp
lldb/source/API/SBDebugger.cpp
lldb/source/API/SBFileSpec.cpp
lldb/source/API/SBHostOS.cpp
lldb/source/API/SBLaunchInfo.cpp
lldb/source/API/SBModuleSpec.cpp
lldb/source/API/SBPlatform.cpp
lldb/source/API/SBProcess.cpp
lldb/source/API/SBTarget.cpp
lldb/source/Breakpoint/BreakpointResolverAddress.cpp
lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/source/Commands/CommandCompletions.cpp
lldb/source/Commands/CommandObjectBreakpoint.cpp
lldb/source/Commands/CommandObjectCommands.cpp
lldb/source/Commands/CommandObjectLog.cpp
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Commands/CommandObjectPlatform.cpp
lldb/source/Commands/CommandObjectPlugin.cpp
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Commands/CommandObjectSettings.cpp
lldb/source/Commands/CommandObjectSource.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Core/Debugger.cpp
lldb/source/Core/DynamicLoader.cpp
lldb/source/Core/Module.cpp
lldb/source/Core/ModuleList.cpp
lldb/source/Core/PluginManager.cpp
lldb/source/Core/SearchFilter.cpp
lldb/source/Expression/REPL.cpp
lldb/source/Host/common/Editline.cpp
lldb/source/Host/common/File.cpp
lldb/source/Host/common/FileSystem.cpp
lldb/source/Host/common/Host.cpp
lldb/source/Host/common/HostInfoBase.cpp
lldb/source/Host/common/MonitoringProcessLauncher.cpp
lldb/source/Host/common/Symbols.cpp
lldb/source/Host/linux/Host.cpp
lldb/source/Host/linux/HostInfoLinux.cpp
lldb/source/Host/macosx/Symbols.cpp
lldb/source/Host/macosx/objcxx/Host.mm
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
lldb/source/Host/posix/FileSystem.cpp
lldb/source/Host/posix/HostInfoPosix.cpp
lldb/source/Host/posix/HostProcessPosix.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Interpreter/OptionValueFileSpec.cpp
lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
lldb/source/Interpreter/Options.cpp
lldb/source/Interpreter/Property.cpp
lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
lldb/source/Symbol/CompileUnit.cpp
lldb/source/Symbol/ObjectFile.cpp
lldb/source/Symbol/Symbol.cpp
lldb/source/Symbol/SymbolContext.cpp
lldb/source/Target/ModuleCache.cpp
lldb/source/Target/PathMappingList.cpp
lldb/source/Target/Platform.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/ProcessInfo.cpp
lldb/source/Target/ProcessLaunchInfo.cpp
lldb/source/Target/TargetList.cpp
lldb/source/Utility/FileSpec.cpp
lldb/tools/lldb-server/lldb-gdbserver.cpp
lldb/tools/lldb-server/lldb-platform.cpp
lldb/tools/lldb-test/lldb-test.cpp
lldb/unittests/Core/MangledTest.cpp
lldb/unittests/Editline/EditlineTest.cpp
lldb/unittests/Expression/ClangParserTest.cpp
lldb/unittests/Host/FileSystemTest.cpp
lldb/unittests/Host/SymbolsTest.cpp
lldb/unittests/Host/linux/HostTest.cpp
lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
lldb/unittests/Platform/PlatformDarwinTest.cpp
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp
lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
lldb/unittests/Target/ModuleCacheTest.cpp
lldb/unittests/Target/PathMappingListTest.cpp
lldb/unittests/Utility/FileSpecTest.cpp
lldb/unittests/Utility/StructuredDataTest.cpp

index d669f56287c5e21fef7dddd68793e51e3881f53a..b16fabe4992dfc5989c416fac72b2e0b317cd63d 100644 (file)
@@ -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);
   }
 
index 206753582f5580f02aca0489c3556efad208c806..232ecda5edb204188c9a1229087c6ae99720f712 100644 (file)
@@ -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
index d6cb212dedf8339e2c18b47684a47cff17293100..a74487a70fe3a82a2806ebae2dfc8c5927a1af34 100644 (file)
@@ -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();
 }
index ad6147d261fae34c8611ea737a5114770c01176a..c7dc4785daab24f9a065017ef37d7d738b12e0c5 100644 (file)
@@ -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;
index 067db0d625564e541f2fdc4a5b03669a5c3fdc33..0a8a281c1a215a83874ad71be866720a9dec26a1 100644 (file)
@@ -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());
 }
index e56951df43be7b9d0f8632552e8b74a3d058a6c9..ac6ab40bda4169f89919ce295837feb1c4bbcb76 100644 (file)
@@ -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;
index aa1759ab3d0023411afffadd4f6aa1ba5b0077c3..b1bbfa55d5c18e3008a318968b6c3da5df2b6a14 100644 (file)
@@ -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) {
index afabd9ace2b95d1bb7c968f4723650bcea19adb1..65492f58b01581cdcb1cc7ff30e3afd6f21e6d74 100644 (file)
@@ -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;
index bce3fd7cb1b984714a5a827b0c168802faf9664c..2c254b2d946f698eb79d880efd060f9af5f50fc3 100644 (file)
@@ -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");
   }
index e79231d3723d1488df272a00e61af4435d9cd7bf..c8b29437b6665a2441bc2c2291fd822db7434aff 100644 (file)
@@ -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;
 }
index 8b559270805969ae844b6f2892c486f1046d5a06..e25fa3135fb045fa2b5ce93a9e945adca0789844 100644 (file)
@@ -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));
   }
index 194a7d1c7da66012e4d0951ede612602dfd782fc..811b8230ff135e48126612e1aae29466bed24e0f 100644 (file)
@@ -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);
 }
index 476da412edb9d6753efa26f7bfcbdf1a56bcb3d0..138af78d34edcdd9651f3255cae77132ee009f67 100644 (file)
@@ -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,
index fbc9a33f5013f305f9063f886b485894a4d618db..af699a543d4882c19ac7014d385551bbdfacdf94 100644 (file)
@@ -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();
 }
index 1f324c7db170570d455a59d7061d6f1175913254..0002b7f3497ff0e39b15fc586963666e6b191617 100644 (file)
@@ -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());
index 7f50025ba21ed8d0f9047ff72d7697d881a9ea47..1759beff36fb902f34854c3a506ce22641f79cfd 100644 (file)
@@ -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
index 8cc21ecb795a02847dd72ba700d8c587f7b85482..6fca265c823b385e71a039e7d7bb765b9d69c66c 100644 (file)
@@ -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;
index 5fbc6221dfb46823dd83289e6fec6a1424a8caf8..95001e08d29b8c94aac921d5a65c5fc4346d6125 100644 (file)
@@ -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'",
index b800174106bd32005afa234d32eb992813243533..6cbbf421f55b5f87db2388839f32fa37f8a328fe 100644 (file)
@@ -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);
index 13ef6b227c5b92cbacef27bf210c14e074e29b2a..af450ae95ab78e1716a19a2e72ea92c9647f1ccf 100644 (file)
@@ -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);
index 73af71f760e6614504f59b821fbcab3c44c9e94b..2bd98b245567c5d6742352ceaab7367c97bd3cde 100644 (file)
@@ -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);
index 48ce3753fc29bc0f6556d08d2d0932f2647e16b2..cceb4201bc503676363f1cd609f79f5064c9c3e9 100644 (file)
@@ -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);
index d321afd51d6bdef5180ce10e6ddc2489ad80079c..c484a2ce562071c763ba36789733c7ca72aec09b 100644 (file)
@@ -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();
index de9526d94d4493234804091be1f862e62dc5ff36..d89779940c5e7815454344f9f87cd3ea577dfe1a 100644 (file)
@@ -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();
index 53b5b7a494e6f3b0bd64a61215ca271c8327a775..44ed39c530a43c88bde4b5f6f8078f500478b6c4 100644 (file)
@@ -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;
index 5b88246017a04e95ad8182be3c2556c7f82d784e..16924d5a14e36a903b241d9e43560fb752bce250 100644 (file)
@@ -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) {
index f1bc6ddbea41705e4d453f732908afce4beb1abc..51f34ef94c11fa44dbcbc527d9de1361c0655aa4 100644 (file)
@@ -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);
index 914e34e36120d5d5473bfe9f1cf0cd003d51f832..7fdca8a86262ac0bdbfdc0707aa38864a4cecd83 100644 (file)
@@ -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);
 }
index 01d5da7cb3bbf3627c8366e921df9e4769d0073a..baa5ff58501fbd2d9322e33fef18e0ab93a7ffd5 100644 (file)
@@ -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;
index f0a81117293bf678d5a8d1ba75387c1670eda50d..de1a64e62c21b53fd26e1ffacb640baca2e83bbb 100644 (file)
@@ -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;
index baef7b0837c73ecbf2a1cbdbf06f79a32c92cefd..a858a21fc8ddfed3d85515308f0d1fe1698d8e1f 100644 (file)
@@ -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>(
index 50d4a09b636852a7d4ab5c5ed9ad04106ca2aa99..afd1b5b26d02986d53a8a2bc1158c6c5bf492aa7 100644 (file)
@@ -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);
index 71b0332458e014523cd861d02c1a50ab223b8758..a330eca85821b2e30c7d0a015568c4221f97ff47 100644 (file)
@@ -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;
index c26225c92e8cdeca5ccf9570345acd743a80648d..fb9549522bcae54a70222424f8a8722c226de629 100644 (file)
@@ -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
index c5f4db6128ca7019b73bb37f9cf31941d641b698..664f794fcc28bf04c04079af0f10c42d7ed0b73f 100644 (file)
@@ -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;
 
index 609168055cff638cb5374e3c6cf0538ce1e785dd..65534b9b5518f06b8b4721ddfc61f07ce4af31ea 100644 (file)
@@ -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) {
index 07058d3879d4c45a6553a020b086f527fced0cc7..34c362efc9e0bce30ac86c63c310b62bad1f8ef4 100644 (file)
@@ -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;
 }
 
index bdded150e7b31b4cd91805f39c3c8db1ef0217ed..6b7b18bf8df2bb8b91d4fe7919a5be9b96351fb5 100644 (file)
@@ -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)) {
index bfa3ea39d764a32875788a121c7ee37518c880a9..0a1eb8fd18f3608078203e9166b2c23ff373b634 100644 (file)
@@ -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()))
index 1a0eb767eb34ba598ddc6a3ff8dc4150b34282da..35a03f4b161beb9d9ff1fc43df863851f90ce858 100644 (file)
@@ -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()) {
index 12885756e2b2346146aa8d729d1fb4bf8b5f7655..e0bf49f430ada729aa9c76a0bc4096a9f0009036 100644 (file)
@@ -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;
 }
index 7193a7ebc56c8b0c31007d12fdfd66c1c55b3c8b..6c09014c801955949f4e45ee8045163d3c2911a7 100644 (file)
@@ -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);
       }
index 0e39a58602b94e18523ba506ca86ba52916bcb2b..6d6cf6a3199681728b636c0f7a880905b6d98ff2 100644 (file)
@@ -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);
       }
index 1bfe78bd2617d4f02996ef6e8686b8babbd6dc11..e9f84778b82fecf7e30ae873350e64681f671f41 100644 (file)
@@ -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;
 }
index 60be642df6087287da2272da29abc5be764e1751..c4b203bf4b371b01e7a904292c0eed5983db1959 100644 (file)
@@ -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();
 }
index 62c70fa3edc1238ecbd2090fa07e7c11fbc6e93b..4763ebc9b9d468a9d76f85102ea26f73fbc6b1e6 100644 (file)
@@ -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;
 }
index 7cdea250795a15e2d93037071cbff5654984f192..f431e0c72de163e98178b08810810183bfcdcb53 100644 (file)
@@ -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;
 
index 8f38517f629616c38b37402e3133591be0f8a2b4..564e6e917400806df76a59ba1a9856dd006303ae 100644 (file)
@@ -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
index 7d6ad93a2904a32ef35aefb23bbd486ce8f5779c..92b49002387e30322d3f0601b8f40fe43958e4de 100644 (file)
@@ -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();
index 94dc9b61949a6712d3d7342c4553eaf94f8b1a43..d390fc7020a3e28b8866b4fbe388ff705566176d 100644 (file)
@@ -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();
index bdea5b4180e6baf5cced8a432e1987318ca13f4d..47b101525c9a3c93e53deb8109a5eca4a821adf6 100644 (file)
@@ -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...
index 2c3e3728a37f8ae17e3719ebf18c26124065be7f..c38a69623c1584f718539f78330375a82ca0ee45 100644 (file)
@@ -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;
   }
 
index 65bc051e03c33b7c6de8323a45c71322c294ee8d..862e48950220326ffd71080eb2d5dc29ad11dd28 100644 (file)
@@ -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,
index 648c16941b52c5ac3c7bc728529137a5d2772df5..d97bd05e0703d612dc4da783b54d466198d0305e 100644 (file)
@@ -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()) {
index 1ee091ceca89e72cc4ca9716fd71662bff8eca7c..595e8484d20d5d0eb0e15af3712b0b6b7217f4d9 100644 (file)
@@ -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 =
index 556cc39e3728b696600357b885e5e12099bc74c1..50ed1eff8ca3b50106191779d0650035c55c3933 100644 (file)
@@ -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;
 
index b1513b51a90a33fc21395733391c6c72bedfae88..68eb3389e91838a414b73d7d7e9e732284ebb087 100644 (file)
@@ -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);
 
index 6edc05d99f32bee7aa722f283aa8ef55b1ab5efa..5892e977d5abafe7d295c18bf805d15809e4c7eb 100644 (file)
@@ -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)) {
index 4251d2ee75b9c8fb6fbf4fcb2730f78017e19719..5f827817ef1ef225266a754fcdc72835870ef3f5 100644 (file)
@@ -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;
 }
 
index 48189d249840e4ffc2d0e4a2b0f383a94d221723..fcaf05fdbd6509187d9b585235f3193ec876e1ec 100644 (file)
@@ -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
index 1682398d63c21f95b7adc4cd916b98a340b7d736..062ae2818b55229b2551c1ae2bf4cf2505b300f3 100644 (file)
@@ -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();
index c3ed8a82db9a391b98d893875142603f1f79a078..bc574808415eb264e3003d02270935f447968371 100644 (file)
@@ -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();
index 8302a45166b7d256c19a63015ae5fcbcb81d6b60..7e6a950cea4ec07b99727b5422abe99845d1ee08 100644 (file)
@@ -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'",
index 0f056329e49e09e7bef2ad7175d1bb61cc954378..ba8216527f3b1c0558cc5e47708969744b3a2930 100644 (file)
@@ -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);
     }
   }
 
index b15094e0769b35fecb5b29bc19a2e0ee91e6551f..d92f6bc3176333e6f1cd9f3bf173d5c9033ae376 100644 (file)
@@ -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++;
index b1252bb94f7798e512d339be1357652bef891a16..dc27641da40601c9e4e4f211b3632a1a8b780b15 100644 (file)
@@ -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
index 6852097117a11fc7f7de601703ff998768c4db53..127895ab251f52bac16db2608f870c92007c81c7 100644 (file)
@@ -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);
     }
   }
 
index f447e14d29ecd248fad286c2cb6423f28aa2ee4a..b2102df879400597899bf1f7a2ac39bbf0b8a2ea 100644 (file)
@@ -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;
     }
index 9f8aea1e32fd62f2feb598b8a24a8bc2b1e48780..ddc09766ec2c24a10bec72f4e1d025158cdf4c35 100644 (file)
@@ -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;
     }
index 1038eef57bc00bf5a94e19742f2fb67a668e7c01..9e33896f0b21a2202872aafa1dce85d713e262f7 100644 (file)
@@ -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;
index 3a049765624d5f4b81d5bd376337d7141eaf53d7..c567db2e75a9d1f967d10aa04f913cb6c5a4f9b9 100644 (file)
@@ -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;
 }
index f2f95af340ebac1ac63565b8dd92ee6ac4de2142..b065c91ebdff9cdb5aa1f1c34b412469c842bbda 100644 (file)
@@ -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();
index 2dd0a2566a1642a6d65584dd1810416d6f8df472..e44c5b9bdedc6b4b04c30ad2701c99243831761b 100644 (file)
@@ -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",
index 212edded0df688de988dc463c822c5b5076f330e..9419dc703870a9e079ec738df72b22a9cbf2f68d 100644 (file)
@@ -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;
     }
index 4516a66ee8cafe99b02a3b6e7d5301203fa93a51..8964906f3a3670559e6e433f0f2b452b0d979f2f 100644 (file)
@@ -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)
index 78761f53d4f4fb13c1e76f6494d18c657e3dd69e..e3f043d099d61587324ad88f04b249f168713600 100644 (file)
@@ -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);
   }
index 9eb24ba180c712c469ed980a2a3aafc6fd8f505c..878c0a3ccd82bb4c5ef19aa94a2bd3097ca5a15d 100644 (file)
@@ -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()))
index 2ba3ea7e1e65996dd2f5b587981f1cdaadc9af48..a1ee5314d4ceea6df1524170f702ff10ac289186 100644 (file)
@@ -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 =
index 4f36fba5fc97a16c88ab7872b3a7579aa7365db4..45736b51db4a24313152379f41b7967d20ebbe71 100644 (file)
@@ -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();
index 0f0febaa8428412e631962f622eb1c3933f9dd7b..70a1e55628e3afde46b3bb389851991e6f957a0f 100644 (file)
@@ -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)
index c4f0a673b3af65e8679107e32afc58c5b0f6b4a5..390bfa0a16777358c2bd820271201ce33d175344 100644 (file)
@@ -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 "
index 942447c090f70eadd6f46c9d32e9a21bcda82108..f7551f342f61bd9ad1a26087024837dcef0d9d1f 100644 (file)
@@ -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;
 }
index dfff7ec380ecf469d6f2a132d171f29765ebe91b..60b56b01882fd1e224da41865edf920dea2757f0 100644 (file)
@@ -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);
index 0585663a5e500ef15c7c5c5d944d509dfcc625b1..2cabe88a4befaee6252435443f1412c2e80ed991 100644 (file)
@@ -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();
 }
 
index 26e28a900320adce7c43f8322b3dae8993c5f88d..45b2cdc9b92987b8fa449598e7946d634b6ee0de 100644 (file)
@@ -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) {
index 0f484a62f9783ec93f76d2470ca8300cda208945..a57a735eb169f94e092e290059c40f0c0d4fec17 100644 (file)
@@ -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);
 
index 7f8c49ca96f9ee229ead1b1bb9e60859f72b76db..f1691de7fe8d54029f7368046fffa0442c48aec3 100644 (file)
@@ -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);
index 621db71458f7c920aa6cf9e800a3f9939998d2cc..7791366e2e11c95bd49bd9fd7dd173e2515257fe 100644 (file)
@@ -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;
index df7872f16b75ad9a0e709d689feea0b7609d1cc8..6e3792bff9c4900ea5b82dddf67c2b9937ccc97e 100644 (file)
@@ -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.
index 2ab37079f750d41af217709b1b16f18036f67e53..d9f50122bd6f2814079e1818e06b05c405585b5e 100644 (file)
@@ -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;
index 1a852fcd220e2259983d4ec4f95814b37a8388e4..b8eb48249c4fc98bf7e52f1fe4775a3cec7f90a2 100644 (file)
@@ -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(),
index 150a6f76c11d81dbbd8c6e796b1069fde3edba34..7931201f51062e62a813521d43c3fa469e8ea781 100644 (file)
@@ -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);
index 0890c92f77a042c55334a452d8ddc14a8b682b28..fab43e928ca3fb2f4b3e50810b39af129eb59de2 100644 (file)
@@ -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);
   }
 
index b97ac1b498c38aeab6f47cd5c471af068ca5d772..7bddc152cd4fd403c40269aa0eb5f4c48db846a1 100644 (file)
@@ -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());
index cb1b66abde3ab6c37221e580b848c8c761d115e1..0b71f6c6829725b9298583fba0813abc89188e8f 100644 (file)
@@ -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());
index a679f609c5858521ac5ff5e39665f123d35fac5e..425b612d786f018ce5ad2906cdf45ec97f8fa7dd 100644 (file)
@@ -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);
index a257edf3818ce1668c728055d604964fd981086b..0d47dd11de1d6df5d53698b8dbf44ed7977902b4 100644 (file)
@@ -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(
index 24b6de2167a575e0200c40c106e65b4ae6b8f566..e61f04e489e8466ce5271e94f0176f7392ffa5d3 100644 (file)
@@ -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) {
index 8f8a331e1d37412724ae96116bf881e1153a5b3d..79cf0180c154a092ffc63e487cb603c87a0c902f 100644 (file)
@@ -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) {
index 846ac779369193c346bf3d2f172766897bed93bd..bd94ec0ad8c1ba4475cd90cf517a856f5809cacc 100644 (file)
@@ -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;
index 69fd5424bd9a1310678454d2292de4d19d6955a0..8d055c1c6712b4a0157f9affddbf867c1e9d1e29 100644 (file)
@@ -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();
 }
index 8716f50a384d4c7ee0f4e7a05a3dacc1a9b734f3..eac3ed48eeed82afe843d4f33b6828ab659b4ace 100644 (file)
@@ -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;
index b084c3aa0a17fdb10307c7148ccf27c91ac6b62f..7626fe654763d61a4a91ae47d1c59dde7774b37b 100644 (file)
@@ -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;
 
index 2b9ebf305c1d12f6c5e2062d0f2c99774cc9f75c..3bd3c3458e3b4b474c0a1260c2862cf9086a319e 100644 (file)
@@ -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;
index 4360d82ddd1074862e35f846aa6956331ecf4515..0a28ae5d4b8558fd04cf298a008bcec83290db51 100644 (file)
@@ -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;
     
index 9ba10118b4c78d049c3d6f1900e4334d3418e96a..622a02c7afecc36f2618f1e7fe2866a30544644a 100644 (file)
@@ -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;
index ac035068670683c977f9a64c8669156f05f0bf00..d19635f3c5c3c24d4bab652fcce82deb37cd3705 100644 (file)
@@ -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);
     }
   }
 }
index b0153ece80d852fee75009f87a06bb9f82d93975..9e23b4f849555b771aef7b6f499045da558f400b 100644 (file)
@@ -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")
index 380ce0012d11a9ef5af3fcf999bf4d5f2f706615..84930b05cf0a1ef3ac6e90b36588d3f541de6404 100644 (file)
@@ -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;
index 8554f9cff06d2bfc2768b24662284b8dc857f936..b805fd8323cff5ac15af8ec597d079c3d8d9eb33 100644 (file)
@@ -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;
index c91a8a89e46af3a507a662f798f81cf9083222b7..e7b771f807e792a371510cb56d88303371f44f68 100644 (file)
 
 // 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);
index cfaf5550d0964245f09c182af4a7fca7f31ed9e8..9ec3843744a9b57f2d3f0efea0fbf7f37d8355dc 100644 (file)
@@ -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': {
index e8d3363b52f8643a0ce93449cb6b83d1f5a9f7ad..631e6a5dd1e3f4c6be020d74337842e20a6eaf18 100644 (file)
@@ -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
index b727e3bb93975c65204e7062c617cc456a5aaa99..2fb37b57ffe105bb791c45ed4023dcdc74f05f84 100644 (file)
@@ -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 {
index 963d9043e994c30dac6aa795b9408a07aca4e048..ffa95560d3e324fc9957f0312dcc775fd1e60c62 100644 (file)
@@ -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; }
index f6a16cce287f34d341074ed166dbc76fee0421f5..69ffb94c45c3fbc7cbaa26a16b0c3ef2df0cee72 100644 (file)
@@ -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();
 }
index 142ad7bb9ce0f041ddc0fae4832ed3630e834348..76ac83fe18b6ec58d53fb809d93db868472470f3 100644 (file)
@@ -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());
   }
index 7b5996b25546ab2b9e786090656797420460e540..e525f3d368015404ae681be74db279295e4da5db 100644 (file)
@@ -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());
 }
index 7ea702d8b18a5566c6f64294856257fdef285c28..d539dbca6eae2b7610f0daf794d82fd918f18cbe 100644 (file)
@@ -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
 
index f670b2390f9d3e5ed42c1ea38c1f57ca2ff0bd45..a28c49f55139ada1e5191908b87aef7b94d60fa2 100644 (file)
@@ -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;
index c0a9aef99ef3b72a3b5aae918bfe4b339dccd07f..a388f413ff5e676304632c3e75c9ed9a74528121 100644 (file)
@@ -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")));
 }
index 41ca091c8f10199816bf4254cbe5034ddd419788..6742f1e0828377d72fcf8c023f646a53aa30219e 100644 (file)
@@ -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
index f2054f768e12c9d6ba218e3f5c602576b2adea87..1c127789fd47d884f3be38fc2c04688e92c34f72 100644 (file)
@@ -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);
 
index 9dd88d1b1f6968d21d493e284d0833aa38b72986..fc540ff06831f20b589ee06a10ddffd8e17d9b3a 100644 (file)
@@ -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);
 
index f1a5a9169339dcaf9e26aa5b640849958ba9bf38..9678bb078cef44eb5920e4d3afb283d0ec6ad53a 100644 (file)
@@ -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;
index cb807d0ca20d74341ea8ca2b33aef82d087c30dc..42db27fdb5046ec903c0bec07aa380b85d1e506b 100644 (file)
@@ -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();
index a271229b2e034bd4fab29c08622aa3051e622766..eae3a09b140d087b0f30573daa15ed00b69a4f31 100644 (file)
 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());
index 15a2ca6bf70af192018171755400093fa0be050b..878b2022c256bc972de1fa766c3fde1220d83371 100644 (file)
@@ -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;