@@ -2796,13 +2796,26 @@ bool AbstractStorageDecl::isResilient() const {
2796
2796
return getModuleContext ()->isResilient ();
2797
2797
}
2798
2798
2799
+ static bool isOriginallyDefinedIn (const Decl *D, const ModuleDecl* MD) {
2800
+ if (!MD)
2801
+ return false ;
2802
+ if (D->getAlternateModuleName ().empty ())
2803
+ return false ;
2804
+ return D->getAlternateModuleName () == MD->getName ().str ();
2805
+ }
2806
+
2799
2807
bool AbstractStorageDecl::isResilient (ModuleDecl *M,
2800
2808
ResilienceExpansion expansion) const {
2801
2809
switch (expansion) {
2802
2810
case ResilienceExpansion::Minimal:
2803
2811
return isResilient ();
2804
2812
case ResilienceExpansion::Maximal:
2805
- return M != getModuleContext () && isResilient ();
2813
+ // We consider this decl belongs to the module either it's currently
2814
+ // defined in this module or it's originally defined in this module, which
2815
+ // is specified by @_originallyDefinedIn
2816
+ return (M != getModuleContext () &&
2817
+ !isOriginallyDefinedIn (this , M) &&
2818
+ isResilient ());
2806
2819
}
2807
2820
llvm_unreachable (" bad resilience expansion" );
2808
2821
}
@@ -4736,14 +4749,6 @@ DestructorDecl *NominalTypeDecl::getValueTypeDestructor() {
4736
4749
return cast<DestructorDecl>(found[0 ]);
4737
4750
}
4738
4751
4739
- static bool isOriginallyDefinedIn (const Decl *D, const ModuleDecl* MD) {
4740
- if (!MD)
4741
- return false ;
4742
- if (D->getAlternateModuleName ().empty ())
4743
- return false ;
4744
- return D->getAlternateModuleName () == MD->getName ().str ();
4745
- }
4746
-
4747
4752
bool NominalTypeDecl::isResilient (ModuleDecl *M,
4748
4753
ResilienceExpansion expansion) const {
4749
4754
switch (expansion) {
@@ -4753,8 +4758,9 @@ bool NominalTypeDecl::isResilient(ModuleDecl *M,
4753
4758
// We consider this decl belongs to the module either it's currently
4754
4759
// defined in this module or it's originally defined in this module, which
4755
4760
// is specified by @_originallyDefinedIn
4756
- return M != getModuleContext () && !isOriginallyDefinedIn (this , M) &&
4757
- isResilient ();
4761
+ return (M != getModuleContext () &&
4762
+ !isOriginallyDefinedIn (this , M) &&
4763
+ isResilient ());
4758
4764
}
4759
4765
llvm_unreachable (" bad resilience expansion" );
4760
4766
}
0 commit comments