[lldb/Platform] Return a std::string from GetSDKPath
Nothing guarantees that the objects in the StringMap remains at the same address when the StringMap grows. Therefore we shouldn't return a reference into the StringMap but return a copy of the string instead.
This commit is contained in:
parent
329ebb85a9
commit
b14c37a29a
|
|
@ -435,7 +435,7 @@ public:
|
|||
return lldb_private::ConstString();
|
||||
}
|
||||
|
||||
virtual llvm::StringRef GetSDKPath(lldb_private::XcodeSDK sdk) {
|
||||
virtual std::string GetSDKPath(lldb_private::XcodeSDK sdk) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1761,11 +1761,11 @@ PlatformDarwin::FindXcodeContentsDirectoryInPath(llvm::StringRef path) {
|
|||
return {};
|
||||
}
|
||||
|
||||
llvm::StringRef PlatformDarwin::GetSDKPath(XcodeSDK sdk) {
|
||||
std::string PlatformDarwin::GetSDKPath(XcodeSDK sdk) {
|
||||
std::string &path = m_sdk_path[sdk.GetString()];
|
||||
if (path.empty())
|
||||
path = HostInfo::GetXcodeSDK(sdk);
|
||||
return path;
|
||||
if (!path.empty())
|
||||
return path;
|
||||
return HostInfo::GetXcodeSDK(sdk);
|
||||
}
|
||||
|
||||
FileSpec PlatformDarwin::GetXcodeContentsDirectory() {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public:
|
|||
llvm::Expected<lldb_private::StructuredData::DictionarySP>
|
||||
FetchExtendedCrashInformation(lldb_private::Process &process) override;
|
||||
|
||||
llvm::StringRef GetSDKPath(lldb_private::XcodeSDK sdk) override;
|
||||
std::string GetSDKPath(lldb_private::XcodeSDK sdk) override;
|
||||
|
||||
static lldb_private::FileSpec GetXcodeContentsDirectory();
|
||||
static lldb_private::FileSpec GetXcodeDeveloperDirectory();
|
||||
|
|
|
|||
Loading…
Reference in New Issue