This revision was automatically updated to reflect the committed changes.
Closed by commit rG334552150770: Also cache negative results in GetXcodeSDKPath
(NFC) (authored by aprantl).
Herald added a project: LLDB.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80595/new/
https://reviews.llvm.org/D80595
Files:
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
Index: lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
===================================================================
--- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -367,8 +367,10 @@
static std::mutex g_sdk_path_mutex;
std::lock_guard<std::mutex> guard(g_sdk_path_mutex);
- std::string &path = g_sdk_path[sdk.GetString()];
- if (path.empty())
- path = GetXcodeSDK(sdk);
+ auto it = g_sdk_path.find(sdk.GetString());
+ if (it != g_sdk_path.end())
+ return it->second;
+ std::string path = GetXcodeSDK(sdk);
+ g_sdk_path.insert({sdk.GetString(), path});
return path;
}
Index: lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
===================================================================
--- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -367,8 +367,10 @@
static std::mutex g_sdk_path_mutex;
std::lock_guard<std::mutex> guard(g_sdk_path_mutex);
- std::string &path = g_sdk_path[sdk.GetString()];
- if (path.empty())
- path = GetXcodeSDK(sdk);
+ auto it = g_sdk_path.find(sdk.GetString());
+ if (it != g_sdk_path.end())
+ return it->second;
+ std::string path = GetXcodeSDK(sdk);
+ g_sdk_path.insert({sdk.GetString(), path});
return path;
}
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits