Author: Alex Langford
Date: 2023-06-14T15:46:00-07:00
New Revision: 623ad8a8ddc96e9dee4f354ee4e7b3e7c11b119f

URL: 
https://github.com/llvm/llvm-project/commit/623ad8a8ddc96e9dee4f354ee4e7b3e7c11b119f
DIFF: 
https://github.com/llvm/llvm-project/commit/623ad8a8ddc96e9dee4f354ee4e7b3e7c11b119f.diff

LOG: [lldb] Fix SBPlatform after f4be9ff6458f

If you pass `nullptr` (or `None` from python) to SBPlatform::SetSDKRoot,
LLDB crashes. Let's be more resilient to `nullptr` here.

Differential Revision: https://reviews.llvm.org/D152962

Added: 
    

Modified: 
    lldb/source/API/SBPlatform.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp
index 12461f3713eca..ed55e93ffc9de 100644
--- a/lldb/source/API/SBPlatform.cpp
+++ b/lldb/source/API/SBPlatform.cpp
@@ -488,7 +488,7 @@ uint32_t SBPlatform::GetOSUpdateVersion() {
 void SBPlatform::SetSDKRoot(const char *sysroot) {
   LLDB_INSTRUMENT_VA(this, sysroot);
   if (PlatformSP platform_sp = GetSP())
-    platform_sp->SetSDKRootDirectory(sysroot);
+    platform_sp->SetSDKRootDirectory(llvm::StringRef(sysroot).str());
 }
 
 SBError SBPlatform::Get(SBFileSpec &src, SBFileSpec &dst) {


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to