[Lldb-commits] [lldb] r345857 - [FileSystem] Fix Exists call sites

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 1 10:35:31 PDT 2018


Author: jdevlieghere
Date: Thu Nov  1 10:35:31 2018
New Revision: 345857

URL: http://llvm.org/viewvc/llvm-project?rev=345857&view=rev
Log:
[FileSystem] Fix Exists call sites

There were some calls left to Exists() on non-darwin platforms (Windows,
Linux and FreeBSD) that weren't yet updated to use the FileSystem.

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

Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/android/HostInfoAndroid.cpp?rev=345857&r1=345856&r2=345857&view=diff
==============================================================================
--- lldb/trunk/source/Host/android/HostInfoAndroid.cpp (original)
+++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp Thu Nov  1 10:35:31 2018
@@ -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::ResolveLibrary
     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::ComputeTempFileBas
   // 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);
 }

Modified: lldb/trunk/source/Host/linux/HostInfoLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/HostInfoLinux.cpp?rev=345857&r1=345856&r2=345857&view=diff
==============================================================================
--- lldb/trunk/source/Host/linux/HostInfoLinux.cpp (original)
+++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp Thu Nov  1 10:35:31 2018
@@ -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::GetProgramFileSp
 
 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();

Modified: lldb/trunk/source/Host/windows/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=345857&r1=345856&r2=345857&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/Host.cpp (original)
+++ lldb/trunk/source/Host/windows/Host.cpp Thu Nov  1 10:35:31 2018
@@ -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(Proces
       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;
     }

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=345857&r1=345856&r2=345857&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Thu Nov  1 10:35:31 2018
@@ -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::Targ
   // 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;

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp?rev=345857&r1=345856&r2=345857&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Thu Nov  1 10:35:31 2018
@@ -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::Targ
   // 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;




More information about the lldb-commits mailing list