[Lldb-commits] [lldb] r355329 - Fix Windows build after UserIDResolver patch.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 4 11:57:04 PST 2019


Author: zturner
Date: Mon Mar  4 11:57:04 2019
New Revision: 355329

URL: http://llvm.org/viewvc/llvm-project?rev=355329&view=rev
Log:
Fix Windows build after UserIDResolver patch.

That patch added a function to HostInfo that returns an instance
of UserIDResolver, but this function was unimplemented on Windows,
leading to linker errors.  For now, just return a dummy implementation
that doesn't resolve user ids to get the build green.

Modified:
    lldb/trunk/include/lldb/Host/HostInfoBase.h
    lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h
    lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h
    lldb/trunk/source/Host/windows/HostInfoWindows.cpp

Modified: lldb/trunk/include/lldb/Host/HostInfoBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostInfoBase.h?rev=355329&r1=355328&r2=355329&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostInfoBase.h (original)
+++ lldb/trunk/include/lldb/Host/HostInfoBase.h Mon Mar  4 11:57:04 2019
@@ -11,7 +11,6 @@
 
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/FileSpec.h"
-#include "lldb/Utility/UserIDResolver.h"
 #include "lldb/lldb-enumerations.h"
 #include "llvm/ADT/StringRef.h"
 
@@ -99,8 +98,6 @@ public:
   //---------------------------------------------------------------------------
   static ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);
 
-  static UserIDResolver &GetUserIDResolver();
-
 protected:
   static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
   static bool ComputeSupportExeDirectory(FileSpec &file_spec);

Modified: lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h?rev=355329&r1=355328&r2=355329&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h Mon Mar  4 11:57:04 2019
@@ -14,6 +14,8 @@
 
 namespace lldb_private {
 
+class UserIDResolver;
+
 class HostInfoPosix : public HostInfoBase {
   friend class HostInfoBase;
 

Modified: lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h?rev=355329&r1=355328&r2=355329&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h Mon Mar  4 11:57:04 2019
@@ -14,6 +14,7 @@
 #include "llvm/Support/VersionTuple.h"
 
 namespace lldb_private {
+class UserIDResolver;
 
 class HostInfoWindows : public HostInfoBase {
   friend class HostInfoBase;
@@ -28,6 +29,7 @@ public:
   static void Terminate();
 
   static size_t GetPageSize();
+  static UserIDResolver &GetUserIDResolver();
 
   static llvm::VersionTuple GetOSVersion();
   static bool GetOSBuildString(std::string &s);

Modified: lldb/trunk/source/Host/windows/HostInfoWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostInfoWindows.cpp?rev=355329&r1=355328&r2=355329&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/HostInfoWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostInfoWindows.cpp Mon Mar  4 11:57:04 2019
@@ -14,15 +14,29 @@
 
 #include "lldb/Host/windows/HostInfoWindows.h"
 #include "lldb/Host/windows/PosixApi.h"
+#include "lldb/Utility/UserIDResolver.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/raw_ostream.h"
 
 using namespace lldb_private;
 
+namespace {
+class WindowsUserIDResolver : public UserIDResolver {
+protected:
+  llvm::Optional<std::string> DoGetUserName(id_t uid) override {
+    return llvm::None;
+  }
+  llvm::Optional<std::string> DoGetGroupName(id_t gid) override {
+    return llvm::None;
+  }
+};
+} // namespace
+
 FileSpec HostInfoWindows::m_program_filespec;
 
 void HostInfoWindows::Initialize() {
@@ -117,3 +131,9 @@ bool HostInfoWindows::GetEnvironmentVar(
     return llvm::convertWideToUTF8(wvar, var);
   return false;
 }
+
+static llvm::ManagedStatic<WindowsUserIDResolver> g_user_id_resolver;
+
+UserIDResolver &HostInfoWindows::GetUserIDResolver() {
+  return *g_user_id_resolver;
+}




More information about the lldb-commits mailing list