@@ -274,13 +274,23 @@ std::vector<ArchSpec> PlatformAppleSimulator::GetSupportedArchitectures(
274
274
return result;
275
275
}
276
276
277
+ static llvm::StringRef GetXcodeSDKDir (std::string preferred,
278
+ std::string secondary) {
279
+ llvm::StringRef sdk;
280
+ sdk = HostInfo::GetXcodeSDKPath (XcodeSDK (std::move (preferred)));
281
+ if (sdk.empty ())
282
+ sdk = HostInfo::GetXcodeSDKPath (XcodeSDK (std::move (secondary)));
283
+ return sdk;
284
+ }
285
+
277
286
PlatformSP PlatformAppleSimulator::CreateInstance (
278
287
const char *class_name, const char *description, ConstString plugin_name,
279
288
llvm::SmallVector<llvm::Triple::ArchType, 4 > supported_arch,
280
289
llvm::Triple::OSType preferred_os,
281
290
llvm::SmallVector<llvm::Triple::OSType , 4 > supported_os,
282
291
llvm::SmallVector<llvm::StringRef, 4 > supported_triples,
283
- llvm::StringRef sdk, lldb_private::XcodeSDK::Type sdk_type,
292
+ std::string sdk_name_preferred, std::string sdk_name_secondary,
293
+ lldb_private::XcodeSDK::Type sdk_type,
284
294
CoreSimulatorSupport::DeviceType::ProductFamilyID kind, bool force,
285
295
const ArchSpec *arch) {
286
296
Log *log = GetLog (LLDBLog::Platform);
@@ -338,6 +348,8 @@ PlatformSP PlatformAppleSimulator::CreateInstance(
338
348
if (create) {
339
349
LLDB_LOGF (log , " %s::%s() creating platform" , class_name, __FUNCTION__);
340
350
351
+ llvm::StringRef sdk =
352
+ GetXcodeSDKDir (sdk_name_preferred, sdk_name_secondary);
341
353
return PlatformSP (new PlatformAppleSimulator (
342
354
class_name, description, plugin_name, preferred_os, supported_triples,
343
355
sdk, sdk_type, kind));
@@ -514,15 +526,6 @@ static bool shouldSkipSimulatorPlatform(bool force, const ArchSpec *arch) {
514
526
!arch->TripleEnvironmentWasSpecified ();
515
527
}
516
528
517
- static llvm::StringRef GetXcodeSDKDir (std::string preferred,
518
- std::string secondary) {
519
- llvm::StringRef sdk;
520
- sdk = HostInfo::GetXcodeSDKPath (XcodeSDK (std::move (preferred)));
521
- if (sdk.empty ())
522
- sdk = HostInfo::GetXcodeSDKPath (XcodeSDK (std::move (secondary)));
523
- return sdk;
524
- }
525
-
526
529
static const char *g_ios_plugin_name = " ios-simulator" ;
527
530
static const char *g_ios_description = " iPhone simulator platform plug-in." ;
528
531
@@ -540,10 +543,6 @@ struct PlatformiOSSimulator {
540
543
static PlatformSP CreateInstance (bool force, const ArchSpec *arch) {
541
544
if (shouldSkipSimulatorPlatform (force, arch))
542
545
return nullptr ;
543
- llvm::StringRef sdk;
544
- sdk = HostInfo::GetXcodeSDKPath (XcodeSDK (" iPhoneSimulator.Internal.sdk" ));
545
- if (sdk.empty ())
546
- sdk = HostInfo::GetXcodeSDKPath (XcodeSDK (" iPhoneSimulator.sdk" ));
547
546
548
547
return PlatformAppleSimulator::CreateInstance (
549
548
" PlatformiOSSimulator" , g_ios_description,
@@ -566,7 +565,7 @@ struct PlatformiOSSimulator {
566
565
#endif
567
566
#endif
568
567
},
569
- GetXcodeSDKDir ( " iPhoneSimulator.Internal.sdk" , " iPhoneSimulator.sdk" ) ,
568
+ " iPhoneSimulator.Internal.sdk" , " iPhoneSimulator.sdk" ,
570
569
XcodeSDK::Type::iPhoneSimulator,
571
570
CoreSimulatorSupport::DeviceType::ProductFamilyID::iPhone, force, arch);
572
571
}
@@ -604,7 +603,7 @@ struct PlatformAppleTVSimulator {
604
603
#endif
605
604
#endif
606
605
},
607
- GetXcodeSDKDir ( " AppleTVSimulator.Internal.sdk" , " AppleTVSimulator.sdk" ) ,
606
+ " AppleTVSimulator.Internal.sdk" , " AppleTVSimulator.sdk" ,
608
607
XcodeSDK::Type::AppleTVSimulator,
609
608
CoreSimulatorSupport::DeviceType::ProductFamilyID::appleTV, force,
610
609
arch);
@@ -646,7 +645,7 @@ struct PlatformAppleWatchSimulator {
646
645
#endif
647
646
#endif
648
647
},
649
- GetXcodeSDKDir ( " WatchSimulator.Internal.sdk" , " WatchSimulator.sdk" ) ,
648
+ " WatchSimulator.Internal.sdk" , " WatchSimulator.sdk" ,
650
649
XcodeSDK::Type::WatchSimulator,
651
650
CoreSimulatorSupport::DeviceType::ProductFamilyID::appleWatch, force,
652
651
arch);
0 commit comments