[FileSystem] Fix Exists call sites
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 1 Nov 2018 17:35:31 +0000 (17:35 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 1 Nov 2018 17:35:31 +0000 (17:35 +0000)
There were some calls left to Exists() on non-darwin platforms (Windows,
Linux and FreeBSD) that weren't yet updated to use the FileSystem.

llvm-svn: 345857

lldb/source/Host/android/HostInfoAndroid.cpp
lldb/source/Host/linux/HostInfoLinux.cpp
lldb/source/Host/windows/Host.cpp
lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp

index a960332832126d91f68a0fb41793ea0be978bd17..fb23878a1dd659fb827056d739ab443dd2b3a8b4 100644 (file)
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/Host/android/HostInfoAndroid.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/linux/HostInfoLinux.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
@@ -68,7 +69,7 @@ FileSpec HostInfoAndroid::ResolveLibraryPath(const std::string &module_path,
     FileSpec file_candidate(path.str().c_str(), true);
     file_candidate.AppendPathComponent(module_path.c_str());
 
-    if (file_candidate.Exists())
+    if (FileSystem::Instance().Exists(file_candidate))
       return file_candidate;
   }
 
@@ -83,8 +84,8 @@ bool HostInfoAndroid::ComputeTempFileBaseDirectory(FileSpec &file_spec) {
   // algorithm will deduce /tmp, which is plain wrong. In that case we have an
   // invalid directory, we substitute the path with /data/local/tmp, which is
   // correct at least in some cases (i.e., when running as shell user).
-  if (!success || !file_spec.Exists())
+  if (!success || !FileSystem::Instance().Exists(file_spec))
     file_spec = FileSpec("/data/local/tmp", false);
 
-  return file_spec.Exists();
+  return FileSystem::Instance().Exists(file_spec);
 }
index 1d95010e2f736f3b3cb98b2793200f45383c68a0..12885756e2b2346146aa8d729d1fb4bf8b5f7655 100644 (file)
@@ -7,8 +7,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lldb/Host/Config.h"
 #include "lldb/Host/linux/HostInfoLinux.h"
+#include "lldb/Host/Config.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Utility/Log.h"
 
 #include "llvm/Support/Threading.h"
@@ -179,7 +180,7 @@ FileSpec HostInfoLinux::GetProgramFileSpec() {
 
 bool HostInfoLinux::ComputeSupportExeDirectory(FileSpec &file_spec) {
   if (HostInfoPosix::ComputeSupportExeDirectory(file_spec) &&
-      file_spec.IsAbsolute() && file_spec.Exists())
+      file_spec.IsAbsolute() && FileSystem::Instance().Exists(file_spec))
     return true;
   file_spec.GetDirectory() = GetProgramFileSpec().GetDirectory();
   return !file_spec.GetDirectory().IsEmpty();
index cc6c454d36b11b156da83275319e97669b95fdd2..452502d3372a548f55169ba2247524e89eec74f7 100644 (file)
@@ -15,6 +15,7 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Target/Process.h"
@@ -189,7 +190,7 @@ Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) {
       return error;
     }
     expand_tool_spec.AppendPathComponent("lldb-argdumper.exe");
-    if (!expand_tool_spec.Exists()) {
+    if (!FileSystem::Instance().Exists(expand_tool_spec)) {
       error.SetErrorString("could not find the lldb-argdumper tool");
       return error;
     }
index d21adc2b6918c5e41ec74f54c11b2ce942d0622c..6f96ae66a1b884585f947ee5a6ad65afea015561 100644 (file)
@@ -24,6 +24,7 @@
 
 // Other libraries and framework includes
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/DynamicLoader.h"
@@ -287,7 +288,7 @@ bool ProcessFreeBSD::CanDebug(lldb::TargetSP target_sp,
   // For now we are just making sure the file exists for a given module
   ModuleSP exe_module_sp(target_sp->GetExecutableModule());
   if (exe_module_sp.get())
-    return exe_module_sp->GetFileSpec().Exists();
+    return FileSystem::Instance()::Exists(exe_module_sp->GetFileSpec());
   // If there is no executable module, we return true since we might be
   // preparing to attach.
   return true;
index 33f4bc38e2732e96e37b1bd2905d73e5560d3a40..93f441137371e46349c2e610d95a3d89b9398f5d 100644 (file)
@@ -18,6 +18,7 @@
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostNativeProcessBase.h"
 #include "lldb/Host/HostProcess.h"
 #include "lldb/Host/windows/HostThreadWindows.h"
@@ -591,7 +592,7 @@ bool ProcessWindows::CanDebug(lldb::TargetSP target_sp,
   // For now we are just making sure the file exists for a given module
   ModuleSP exe_module_sp(target_sp->GetExecutableModule());
   if (exe_module_sp.get())
-    return exe_module_sp->GetFileSpec().Exists();
+    return FileSystem::Instance().Exists(exe_module_sp->GetFileSpec());
   // However, if there is no executable module, we return true since we might
   // be preparing to attach.
   return true;