File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -956,14 +956,21 @@ bool Lowering::usesObjCAllocator(ClassDecl *theClass) {
956
956
return theClass->getObjectModel () == ReferenceCounting::ObjC;
957
957
}
958
958
959
+ static bool isUnconditionallyUnavailable (const Decl *D) {
960
+ if (auto unavailableAttrAndDecl = D->getSemanticUnavailableAttr ())
961
+ return unavailableAttrAndDecl->first ->isUnconditionallyUnavailable ();
962
+
963
+ return false ;
964
+ }
965
+
959
966
bool Lowering::shouldSkipLowering (const Decl *D) {
960
967
if (D->getASTContext ().LangOpts .UnavailableDeclOptimizationMode !=
961
968
UnavailableDeclOptimization::Complete)
962
969
return false ;
963
970
964
971
// Unavailable declarations should be skipped if
965
972
// -unavailable-decl-optimization=complete is specified.
966
- return D-> getSemanticUnavailableAttr () != None ;
973
+ return isUnconditionallyUnavailable (D) ;
967
974
}
968
975
969
976
bool Lowering::shouldLowerToUnavailableCodeStub (const Decl *D) {
@@ -973,5 +980,5 @@ bool Lowering::shouldLowerToUnavailableCodeStub(const Decl *D) {
973
980
974
981
// Unavailable declarations should trap at runtime if
975
982
// -unavailable-decl-optimization=stub is specified.
976
- return D-> getSemanticUnavailableAttr () != None ;
983
+ return isUnconditionallyUnavailable (D) ;
977
984
}
Original file line number Diff line number Diff line change 1
- // RUN: %target-swift-emit-silgen -module-name Test -parse-as-library %s -verify | %FileCheck %s --check-prefixes=CHECK,CHECK-NO-STRIP
2
- // RUN: %target-swift-emit-silgen -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=none | %FileCheck %s --check-prefixes=CHECK,CHECK-NO-STRIP
1
+ // RUN: %target-swift-emit-silgen -swift-version 5 - module-name Test -parse-as-library %s -verify | %FileCheck %s --check-prefixes=CHECK,CHECK-NO-STRIP
2
+ // RUN: %target-swift-emit-silgen -swift-version 5 - module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=none | %FileCheck %s --check-prefixes=CHECK,CHECK-NO-STRIP
3
3
// RUN: %target-swift-emit-silgen -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=complete | %FileCheck %s --check-prefixes=CHECK,CHECK-STRIP
4
4
5
5
// CHECK-NO-STRIP: s4Test14globalConstant_Wz
@@ -18,6 +18,10 @@ public let globalConstant = true
18
18
@available ( * , unavailable)
19
19
public func unavailableFunc( ) { }
20
20
21
+ // CHECK: s4Test21funcObsoletedInSwift5yyF
22
+ @available ( swift, introduced: 4.2 , obsoleted: 5 )
23
+ public func funcObsoletedInSwift5( ) { }
24
+
21
25
@available ( * , unavailable)
22
26
public struct UnavailableStruct < T> {
23
27
// CHECK-NO-STRIP: s4Test17UnavailableStructV8propertyxvg
You can’t perform that action at this time.
0 commit comments