[Lldb-commits] [PATCH] D98272: [lldb/Platform] Skip very slow xcrun queries for simulator platforms, NFC
Vedant Kumar via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 10 13:57:25 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGac29c35207a5: [lldb/Platform] Skip very slow xcrun queries for simulator platforms, NFC (authored by vsk).
Changed prior to commit:
https://reviews.llvm.org/D98272?vs=329733&id=329767#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98272/new/
https://reviews.llvm.org/D98272
Files:
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
Index: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
@@ -505,6 +505,16 @@
return process_infos.size();
}
+/// Whether to skip creating a simulator platform.
+static bool shouldSkipSimulatorPlatform(bool force, const ArchSpec *arch) {
+ // If the arch is known not to specify a simulator environment, skip creating
+ // the simulator platform (we can create it later if there's a matching arch).
+ // This avoids very slow xcrun queries for non-simulator archs (the slowness
+ // is due to xcrun not caching negative queries (rdar://74882205)).
+ return !force && arch && arch->IsValid() &&
+ !arch->TripleEnvironmentWasSpecified();
+}
+
static llvm::StringRef GetXcodeSDKDir(std::string preferred,
std::string secondary) {
llvm::StringRef sdk;
@@ -530,6 +540,8 @@
}
static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ if (shouldSkipSimulatorPlatform(force, arch))
+ return nullptr;
llvm::StringRef sdk;
sdk = HostInfo::GetXcodeSDKPath(XcodeSDK("iPhoneSimulator.Internal.sdk"));
if (sdk.empty())
@@ -578,6 +590,8 @@
}
static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ if (shouldSkipSimulatorPlatform(force, arch))
+ return nullptr;
return PlatformAppleSimulator::CreateInstance(
"PlatformAppleTVSimulator", g_tvos_description,
ConstString(g_tvos_plugin_name),
@@ -619,6 +633,8 @@
}
static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ if (shouldSkipSimulatorPlatform(force, arch))
+ return nullptr;
return PlatformAppleSimulator::CreateInstance(
"PlatformAppleWatchSimulator", g_watchos_description,
ConstString(g_watchos_plugin_name),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98272.329767.patch
Type: text/x-patch
Size: 1983 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210310/f3054a73/attachment.bin>
More information about the lldb-commits
mailing list