@@ -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
}
@@ -4742,14 +4755,6 @@ DestructorDecl *NominalTypeDecl::getValueTypeDestructor() {
4742
4755
return cast<DestructorDecl>(found[0 ]);
4743
4756
}
4744
4757
4745
- static bool isOriginallyDefinedIn (const Decl *D, const ModuleDecl* MD) {
4746
- if (!MD)
4747
- return false ;
4748
- if (D->getAlternateModuleName ().empty ())
4749
- return false ;
4750
- return D->getAlternateModuleName () == MD->getName ().str ();
4751
- }
4752
-
4753
4758
bool NominalTypeDecl::isResilient (ModuleDecl *M,
4754
4759
ResilienceExpansion expansion) const {
4755
4760
switch (expansion) {
@@ -4759,8 +4764,9 @@ bool NominalTypeDecl::isResilient(ModuleDecl *M,
4759
4764
// We consider this decl belongs to the module either it's currently
4760
4765
// defined in this module or it's originally defined in this module, which
4761
4766
// is specified by @_originallyDefinedIn
4762
- return M != getModuleContext () && !isOriginallyDefinedIn (this , M) &&
4763
- isResilient ();
4767
+ return (M != getModuleContext () &&
4768
+ !isOriginallyDefinedIn (this , M) &&
4769
+ isResilient ());
4764
4770
}
4765
4771
llvm_unreachable (" bad resilience expansion" );
4766
4772
}
0 commit comments