@@ -261,7 +261,7 @@ struct SynthesizedExtensionAnalyzer::Implementation {
261
261
bool IncludeUnconditional;
262
262
PrintOptions Options;
263
263
MergeGroupVector AllGroups;
264
- std::unique_ptr< ExtensionInfoMap> InfoMap;
264
+ ExtensionInfoMap InfoMap;
265
265
266
266
Implementation (NominalTypeDecl *Target,
267
267
bool IncludeUnconditional,
@@ -416,9 +416,9 @@ struct SynthesizedExtensionAnalyzer::Implementation {
416
416
}
417
417
}
418
418
419
- std::unique_ptr< ExtensionInfoMap>
419
+ ExtensionInfoMap
420
420
collectSynthesizedExtensionInfoForProtocol (MergeGroupVector &AllGroups) {
421
- std::unique_ptr< ExtensionInfoMap> InfoMap ( new ExtensionInfoMap ()) ;
421
+ ExtensionInfoMap InfoMap;
422
422
ExtensionMergeInfoMap MergeInfoMap;
423
423
for (auto *E : Target->getExtensions ()) {
424
424
if (!Options.shouldPrint (E))
@@ -427,12 +427,12 @@ struct SynthesizedExtensionAnalyzer::Implementation {
427
427
/* EnablingExt*/ nullptr ,
428
428
/* Conf*/ nullptr );
429
429
if (Pair.first ) {
430
- InfoMap-> insert ({E, Pair.first });
430
+ InfoMap. insert ({E, Pair.first });
431
431
MergeInfoMap.insert ({E, Pair.second });
432
432
}
433
433
}
434
- populateMergeGroup (* InfoMap, MergeInfoMap, AllGroups,
435
- /* AllowMergeWithDefBody*/ false );
434
+ populateMergeGroup (InfoMap, MergeInfoMap, AllGroups,
435
+ /* AllowMergeWithDefBody= */ false );
436
436
std::sort (AllGroups.begin (), AllGroups.end ());
437
437
for (auto &Group : AllGroups) {
438
438
Group.sortMembers ();
@@ -448,12 +448,13 @@ struct SynthesizedExtensionAnalyzer::Implementation {
448
448
return false ;
449
449
}
450
450
451
- std::unique_ptr< ExtensionInfoMap>
451
+ ExtensionInfoMap
452
452
collectSynthesizedExtensionInfo (MergeGroupVector &AllGroups) {
453
453
if (isa<ProtocolDecl>(Target)) {
454
454
return collectSynthesizedExtensionInfoForProtocol (AllGroups);
455
455
}
456
- std::unique_ptr<ExtensionInfoMap> InfoMap (new ExtensionInfoMap ());
456
+
457
+ ExtensionInfoMap InfoMap;
457
458
ExtensionMergeInfoMap MergeInfoMap;
458
459
std::vector<NominalTypeDecl*> Unhandled;
459
460
@@ -470,7 +471,7 @@ struct SynthesizedExtensionAnalyzer::Implementation {
470
471
if (AdjustedOpts.shouldPrint (E)) {
471
472
auto Pair = isApplicable (E, Synthesized, EnablingE, Conf);
472
473
if (Pair.first ) {
473
- InfoMap-> insert ({E, Pair.first });
474
+ InfoMap. insert ({E, Pair.first });
474
475
MergeInfoMap.insert ({E, Pair.second });
475
476
}
476
477
}
@@ -515,8 +516,8 @@ struct SynthesizedExtensionAnalyzer::Implementation {
515
516
}
516
517
}
517
518
518
- populateMergeGroup (* InfoMap, MergeInfoMap, AllGroups,
519
- /* AllowMergeWithDefBody*/ true );
519
+ populateMergeGroup (InfoMap, MergeInfoMap, AllGroups,
520
+ /* AllowMergeWithDefBody= */ true );
520
521
521
522
std::sort (AllGroups.begin (), AllGroups.end ());
522
523
for (auto &Group : AllGroups) {
@@ -531,20 +532,18 @@ struct SynthesizedExtensionAnalyzer::Implementation {
531
532
}
532
533
};
533
534
534
- SynthesizedExtensionAnalyzer::
535
- SynthesizedExtensionAnalyzer (NominalTypeDecl *Target,
536
- PrintOptions Options,
537
- bool IncludeUnconditional):
538
- Impl(*(new Implementation(Target, IncludeUnconditional, Options))) {}
535
+ SynthesizedExtensionAnalyzer::SynthesizedExtensionAnalyzer (
536
+ NominalTypeDecl *Target, PrintOptions Options, bool IncludeUnconditional)
537
+ : Impl(*(new Implementation(Target, IncludeUnconditional, Options))) {}
539
538
540
539
SynthesizedExtensionAnalyzer::~SynthesizedExtensionAnalyzer () {delete &Impl;}
541
540
542
541
bool SynthesizedExtensionAnalyzer::
543
542
isInSynthesizedExtension (const ValueDecl *VD) {
544
543
if (auto Ext = dyn_cast_or_null<ExtensionDecl>(VD->getDeclContext ()->
545
544
getInnermostTypeContext ())) {
546
- return Impl.InfoMap -> count (Ext) != 0 &&
547
- Impl.InfoMap -> find (Ext)->second .IsSynthesized ;
545
+ return Impl.InfoMap . count (Ext) != 0 &&
546
+ Impl.InfoMap . find (Ext)->second .IsSynthesized ;
548
547
}
549
548
return false ;
550
549
}
@@ -565,8 +564,7 @@ forEachExtensionMergeGroup(MergeGroupKind Kind, ExtensionGroupOperation Fn) {
565
564
}
566
565
}
567
566
568
- bool SynthesizedExtensionAnalyzer::
569
- hasMergeGroup (MergeGroupKind Kind) {
567
+ bool SynthesizedExtensionAnalyzer::hasMergeGroup (MergeGroupKind Kind) {
570
568
for (auto &Group : Impl.AllGroups ) {
571
569
if (Kind == MergeGroupKind::All)
572
570
return true ;
0 commit comments