[Lldb-commits] [lldb] bb7bde5 - Revert "[lldb/Platform] Return a std::string from GetSDKPath"
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 29 01:26:48 PDT 2020
Author: Jonas Devlieghere
Date: 2020-04-29T01:26:24-07:00
New Revision: bb7bde5bba579a0521ed5b9a7b8a69465928986e
URL: https://github.com/llvm/llvm-project/commit/bb7bde5bba579a0521ed5b9a7b8a69465928986e
DIFF: https://github.com/llvm/llvm-project/commit/bb7bde5bba579a0521ed5b9a7b8a69465928986e.diff
LOG: Revert "[lldb/Platform] Return a std::string from GetSDKPath"
This reverts commit b14c37a29a5455853419f5fe0605f6023c51de89.
Added:
Modified:
lldb/include/lldb/Target/Platform.h
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
Removed:
################################################################################
diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index 640261033c4b..1b130cd02c3d 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -435,9 +435,7 @@ class Platform : public PluginInterface {
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 6a00afba68ca..436f93d9d8d6 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<std::mutex> 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 e4f717380e8b..0252b093d6be 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -89,7 +89,7 @@ class PlatformDarwin : public PlatformPOSIX {
llvm::Expected<lldb_private::StructuredData::DictionarySP>
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();
More information about the lldb-commits
mailing list