File tree Expand file tree Collapse file tree 2 files changed +37
-3
lines changed Expand file tree Collapse file tree 2 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -1525,12 +1525,15 @@ bool Decl::isAlwaysWeakImported() const {
15251525    return  clangDecl->isWeakImported (
15261526        getASTContext ().LangOpts .getMinPlatformVersion ());
15271527
1528+   //  FIXME: Weak linking on Windows is not yet supported
1529+   //  https://github.com/apple/swift/issues/53303
1530+   if  (getASTContext ().LangOpts .Target .isOSWindows ())
1531+     return  false ;
1532+ 
15281533  if  (getAttrs ().hasAttribute <WeakLinkedAttr>())
15291534    return  true ;
15301535
1531-   //  FIXME: Weak linking on Windows is not yet supported
1532-   //  https://github.com/apple/swift/issues/53303
1533-   if  (isUnavailable () && !getASTContext ().LangOpts .Target .isOSWindows ())
1536+   if  (isUnavailable ())
15341537    return  true ;
15351538
15361539  if  (auto  *accessor = dyn_cast<AccessorDecl>(this ))
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-emit-silgen %s -target %target-cpu-unknown-windows-msvc | %FileCheck %s
2+ // REQUIRES: OS=windows-msvc
3+ 
4+ @_silgen_name ( " windows10 " )  
5+ @available ( Windows 10 ,  * )  
6+ public  func  windows10( ) 
7+ 
8+ @_silgen_name ( " unavailable " )  
9+ @available ( Windows,  unavailable)  
10+ public  func  unavailable( ) 
11+ 
12+ 
13+ // CHECK-LABEL: sil [ossa] @$s20availability_windows15testIfAvailableyyF : $@convention(thin) () -> ()
14+ // CHECK: cond_br
15+ // CHECK: function_ref @windows10
16+ public  func  testIfAvailable( )  { 
17+   if  #available( Windows 10 ,  * )  { 
18+     windows10 ( ) 
19+   } 
20+ } 
21+ // CHECK: sil [available 10] @windows10 : $@convention(thin) () -> ()
22+ 
23+ // CHECK-LABEL: sil [ossa] @$s20availability_windows15testUnavailableyyF : $@convention(thin) () -> ()
24+ // CHECK: function_ref @unavailable
25+ @available ( * ,  unavailable)  
26+ public  func  testUnavailable( )  { 
27+   unavailable ( ) 
28+ } 
29+ 
30+ // FIXME: Mark [weak_imported] when weak linking is supported on Windows (https://github.com/apple/swift/issues/53303)
31+ // CHECK: sil @unavailable : $@convention(thin) () -> ()
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments