From bb7bde5bba579a0521ed5b9a7b8a69465928986e Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 29 Apr 2020 01:23:49 -0700 Subject: [PATCH] Revert "[lldb/Platform] Return a std::string from GetSDKPath" This reverts commit b14c37a29a5455853419f5fe0605f6023c51de89. --- lldb/include/lldb/Target/Platform.h | 4 +--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp | 8 ++++---- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h index 6402610..1b130cd 100644 --- a/lldb/include/lldb/Target/Platform.h +++ b/lldb/include/lldb/Target/Platform.h @@ -435,9 +435,7 @@ public: return lldb_private::ConstString(); } - virtual std::string GetSDKPath(lldb_private::XcodeSDK sdk) { - return {}; - } + virtual llvm::StringRef GetSDKPath(lldb_private::XcodeSDK sdk) { return {}; } const std::string &GetRemoteURL() const { return m_remote_url; } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 6a00afb..436f93d 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -1761,12 +1761,12 @@ PlatformDarwin::FindXcodeContentsDirectoryInPath(llvm::StringRef path) { return {}; } -std::string PlatformDarwin::GetSDKPath(XcodeSDK sdk) { +llvm::StringRef PlatformDarwin::GetSDKPath(XcodeSDK sdk) { std::lock_guard guard(m_sdk_path_mutex); std::string &path = m_sdk_path[sdk.GetString()]; - if (!path.empty()) - return path; - return HostInfo::GetXcodeSDK(sdk); + if (path.empty()) + path = HostInfo::GetXcodeSDK(sdk); + return path; } FileSpec PlatformDarwin::GetXcodeContentsDirectory() { diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h index e4f7173..0252b09 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h @@ -89,7 +89,7 @@ public: llvm::Expected FetchExtendedCrashInformation(lldb_private::Process &process) override; - std::string GetSDKPath(lldb_private::XcodeSDK sdk) override; + llvm::StringRef GetSDKPath(lldb_private::XcodeSDK sdk) override; static lldb_private::FileSpec GetXcodeContentsDirectory(); static lldb_private::FileSpec GetXcodeDeveloperDirectory(); -- 2.7.4