@@ -514,24 +514,19 @@ static llvm::StringRef GetXcodeSDKDir(std::string preferred,
514
514
return sdk;
515
515
}
516
516
517
- static unsigned g_ios_initialize_count = 0 ;
518
517
static const char *g_ios_plugin_name = " ios-simulator" ;
519
518
static const char *g_ios_description = " iPhone simulator platform plug-in." ;
520
519
521
520
// / IPhone Simulator Plugin.
522
521
struct PlatformiOSSimulator {
523
522
static void Initialize () {
524
- if (g_ios_initialize_count++ == 0 ) {
525
- PluginManager::RegisterPlugin (ConstString (g_ios_plugin_name),
526
- g_ios_description,
527
- PlatformiOSSimulator::CreateInstance);
528
- }
523
+ PluginManager::RegisterPlugin (ConstString (g_ios_plugin_name),
524
+ g_ios_description,
525
+ PlatformiOSSimulator::CreateInstance);
529
526
}
530
527
531
528
static void Terminate () {
532
- if (g_ios_initialize_count > 0 )
533
- if (--g_ios_initialize_count == 0 )
534
- PluginManager::UnregisterPlugin (PlatformiOSSimulator::CreateInstance);
529
+ PluginManager::UnregisterPlugin (PlatformiOSSimulator::CreateInstance);
535
530
}
536
531
537
532
static PlatformSP CreateInstance (bool force, const ArchSpec *arch) {
@@ -567,24 +562,19 @@ struct PlatformiOSSimulator {
567
562
}
568
563
};
569
564
570
- static unsigned g_tvos_initialize_count = 0 ;
571
565
static const char *g_tvos_plugin_name = " tvos-simulator" ;
572
566
static const char *g_tvos_description = " tvOS simulator platform plug-in." ;
573
567
574
568
// / Apple TV Simulator Plugin.
575
569
struct PlatformAppleTVSimulator {
576
570
static void Initialize () {
577
- if (g_tvos_initialize_count++ == 0 ) {
578
- PluginManager::RegisterPlugin (ConstString (g_tvos_plugin_name),
579
- g_tvos_description,
580
- PlatformAppleTVSimulator::CreateInstance);
581
- }
571
+ PluginManager::RegisterPlugin (ConstString (g_tvos_plugin_name),
572
+ g_tvos_description,
573
+ PlatformAppleTVSimulator::CreateInstance);
582
574
}
583
575
584
576
static void Terminate () {
585
- if (g_tvos_initialize_count > 0 )
586
- if (--g_tvos_initialize_count == 0 )
587
- PluginManager::UnregisterPlugin (PlatformAppleTVSimulator::CreateInstance);
577
+ PluginManager::UnregisterPlugin (PlatformAppleTVSimulator::CreateInstance);
588
578
}
589
579
590
580
static PlatformSP CreateInstance (bool force, const ArchSpec *arch) {
@@ -611,26 +601,21 @@ struct PlatformAppleTVSimulator {
611
601
};
612
602
613
603
614
- static unsigned g_watchos_initialize_count = 0 ;
615
604
static const char *g_watchos_plugin_name = " watchos-simulator" ;
616
605
static const char *g_watchos_description =
617
606
" Apple Watch simulator platform plug-in." ;
618
607
619
608
// / Apple Watch Simulator Plugin.
620
609
struct PlatformAppleWatchSimulator {
621
610
static void Initialize () {
622
- if (g_watchos_initialize_count++ == 0 ) {
623
- PluginManager::RegisterPlugin (
624
- ConstString (g_watchos_plugin_name), g_watchos_description,
625
- PlatformAppleWatchSimulator::CreateInstance);
626
- }
611
+ PluginManager::RegisterPlugin (ConstString (g_watchos_plugin_name),
612
+ g_watchos_description,
613
+ PlatformAppleWatchSimulator::CreateInstance);
627
614
}
628
615
629
616
static void Terminate () {
630
- if (g_watchos_initialize_count > 0 )
631
- if (--g_watchos_initialize_count == 0 )
632
- PluginManager::UnregisterPlugin (
633
- PlatformAppleWatchSimulator::CreateInstance);
617
+ PluginManager::UnregisterPlugin (
618
+ PlatformAppleWatchSimulator::CreateInstance);
634
619
}
635
620
636
621
static PlatformSP CreateInstance (bool force, const ArchSpec *arch) {
@@ -657,18 +642,25 @@ struct PlatformAppleWatchSimulator {
657
642
};
658
643
659
644
645
+ static unsigned g_initialize_count = 0 ;
646
+
660
647
// Static Functions
661
648
void PlatformAppleSimulator::Initialize () {
662
- PlatformDarwin::Initialize ();
663
- PlatformiOSSimulator::Initialize ();
664
- PlatformAppleTVSimulator::Initialize ();
665
- PlatformAppleWatchSimulator::Initialize ();
649
+ if (g_initialize_count++ == 0 ) {
650
+ PlatformDarwin::Initialize ();
651
+ PlatformiOSSimulator::Initialize ();
652
+ PlatformAppleTVSimulator::Initialize ();
653
+ PlatformAppleWatchSimulator::Initialize ();
654
+ }
666
655
}
667
656
668
657
void PlatformAppleSimulator::Terminate () {
669
- PlatformAppleWatchSimulator::Terminate ();
670
- PlatformAppleTVSimulator::Terminate ();
671
- PlatformiOSSimulator::Terminate ();
672
- PlatformDarwin::Terminate ();
658
+ if (g_initialize_count > 0 )
659
+ if (--g_initialize_count == 0 ) {
660
+ PlatformAppleWatchSimulator::Terminate ();
661
+ PlatformAppleTVSimulator::Terminate ();
662
+ PlatformiOSSimulator::Terminate ();
663
+ PlatformDarwin::Terminate ();
664
+ }
673
665
}
674
666
0 commit comments