@@ -2796,13 +2796,26 @@ bool AbstractStorageDecl::isResilient() const {
27962796  return  getModuleContext ()->isResilient ();
27972797}
27982798
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+ 
27992807bool  AbstractStorageDecl::isResilient (ModuleDecl *M,
28002808                                      ResilienceExpansion expansion) const  {
28012809  switch  (expansion) {
28022810  case  ResilienceExpansion::Minimal:
28032811    return  isResilient ();
28042812  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 ());
28062819  }
28072820  llvm_unreachable (" bad resilience expansion" 
28082821}
@@ -4742,14 +4755,6 @@ DestructorDecl *NominalTypeDecl::getValueTypeDestructor() {
47424755  return  cast<DestructorDecl>(found[0 ]);
47434756}
47444757
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- 
47534758bool  NominalTypeDecl::isResilient (ModuleDecl *M,
47544759                                  ResilienceExpansion expansion) const  {
47554760  switch  (expansion) {
@@ -4759,8 +4764,9 @@ bool NominalTypeDecl::isResilient(ModuleDecl *M,
47594764    //  We consider this decl belongs to the module either it's currently
47604765    //  defined in this module or it's originally defined in this module, which
47614766    //  is specified by @_originallyDefinedIn
4762-     return  M != getModuleContext () && !isOriginallyDefinedIn (this , M) &&
4763-       isResilient ();
4767+     return  (M != getModuleContext () &&
4768+             !isOriginallyDefinedIn (this , M) &&
4769+             isResilient ());
47644770  }
47654771  llvm_unreachable (" bad resilience expansion" 
47664772}
0 commit comments