[Lldb-commits] [lldb] r297096 - Remove dependency from FileSpec to ArchSpec.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 6 15:42:44 PST 2017


Author: zturner
Date: Mon Mar  6 17:42:44 2017
New Revision: 297096

URL: http://llvm.org/viewvc/llvm-project?rev=297096&view=rev
Log:
Remove dependency from FileSpec to ArchSpec.

All it really needs is the llvm::Triple, so make FileSpec take
the Triple directly instead of the ArchSpec.

Modified:
    lldb/trunk/include/lldb/Host/FileSpec.h
    lldb/trunk/source/Host/common/FileSpec.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Modified: lldb/trunk/include/lldb/Host/FileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=297096&r1=297095&r2=297096&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Mon Mar  6 17:42:44 2017
@@ -21,6 +21,7 @@
 #include "lldb/Utility/ConstString.h"
 #include "lldb/lldb-private.h"
 
+#include "llvm/ADT/Triple.h"
 #include "llvm/Support/FormatVariadic.h"
 
 namespace lldb_private {
@@ -84,7 +85,8 @@ public:
   explicit FileSpec(llvm::StringRef path, bool resolve_path,
                     PathSyntax syntax = ePathSyntaxHostNative);
 
-  explicit FileSpec(llvm::StringRef path, bool resolve_path, ArchSpec arch);
+  explicit FileSpec(llvm::StringRef path, bool resolve_path,
+                    const llvm::Triple &Triple);
 
   //------------------------------------------------------------------
   /// Copy constructor
@@ -520,7 +522,8 @@ public:
   void SetFile(llvm::StringRef path, bool resolve_path,
                PathSyntax syntax = ePathSyntaxHostNative);
 
-  void SetFile(llvm::StringRef path, bool resolve_path, ArchSpec arch);
+  void SetFile(llvm::StringRef path, bool resolve_path,
+               const llvm::Triple &Triple);
 
   bool IsResolved() const { return m_is_resolved; }
 

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=297096&r1=297095&r2=297096&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Mar  6 17:42:44 2017
@@ -25,7 +25,6 @@
 #include <pwd.h>
 #endif
 
-#include "lldb/Core/ArchSpec.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Utility/CleanUp.h"
@@ -284,10 +283,10 @@ FileSpec::FileSpec(llvm::StringRef path,
   SetFile(path, resolve_path, syntax);
 }
 
-FileSpec::FileSpec(llvm::StringRef path, bool resolve_path, ArchSpec arch)
-    : FileSpec{path, resolve_path, arch.GetTriple().isOSWindows()
-                                       ? ePathSyntaxWindows
-                                       : ePathSyntaxPosix} {}
+FileSpec::FileSpec(llvm::StringRef path, bool resolve_path,
+                   const llvm::Triple &Triple)
+    : FileSpec{path, resolve_path,
+               Triple.isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix} {}
 
 //------------------------------------------------------------------
 // Copy constructor
@@ -374,10 +373,10 @@ void FileSpec::SetFile(llvm::StringRef p
                            : resolve_path_ref.substr(filename_begin));
 }
 
-void FileSpec::SetFile(llvm::StringRef path, bool resolve, ArchSpec arch) {
-  return SetFile(path, resolve, arch.GetTriple().isOSWindows()
-                                    ? ePathSyntaxWindows
-                                    : ePathSyntaxPosix);
+void FileSpec::SetFile(llvm::StringRef path, bool resolve,
+                       const llvm::Triple &Triple) {
+  return SetFile(path, resolve,
+                 Triple.isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix);
 }
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=297096&r1=297095&r2=297096&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Mon Mar  6 17:42:44 2017
@@ -1660,7 +1660,7 @@ bool GDBRemoteCommunicationClient::GetWo
       return false;
     std::string cwd;
     response.GetHexByteString(cwd);
-    working_dir.SetFile(cwd, false, GetHostArchitecture());
+    working_dir.SetFile(cwd, false, GetHostArchitecture().GetTriple());
     return !cwd.empty();
   }
   return false;
@@ -3191,7 +3191,7 @@ bool GDBRemoteCommunicationClient::GetMo
       StringExtractor extractor(value);
       std::string path;
       extractor.GetHexByteString(path);
-      module_spec.GetFileSpec() = FileSpec(path, false, arch_spec);
+      module_spec.GetFileSpec() = FileSpec(path, false, arch_spec.GetTriple());
     }
   }
 
@@ -3225,7 +3225,8 @@ ParseModuleSpec(StructuredData::Dictiona
 
   if (!dict->GetValueForKeyAsString("file_path", string))
     return llvm::None;
-  result.GetFileSpec() = FileSpec(string, false, result.GetArchitecture());
+  result.GetFileSpec() =
+      FileSpec(string, false, result.GetArchitecture().GetTriple());
 
   return result;
 }




More information about the lldb-commits mailing list