File tree Expand file tree Collapse file tree 6 files changed +68
-3
lines changed Expand file tree Collapse file tree 6 files changed +68
-3
lines changed Original file line number Diff line number Diff line change @@ -7174,7 +7174,8 @@ void ClangImporter::Implementation::importAttributes(
7174
7174
7175
7175
StringRef message = avail->getMessage ();
7176
7176
7177
- const auto &deprecated = avail->getDeprecated ();
7177
+ clang::VersionTuple deprecated = avail->getDeprecated ();
7178
+
7178
7179
if (!deprecated.empty ()) {
7179
7180
if (platformAvailability.deprecatedAsUnavailableFilter &&
7180
7181
platformAvailability.deprecatedAsUnavailableFilter (
@@ -7186,8 +7187,14 @@ void ClangImporter::Implementation::importAttributes(
7186
7187
}
7187
7188
}
7188
7189
7189
- const auto &obsoleted = avail->getObsoleted ();
7190
- const auto &introduced = avail->getIntroduced ();
7190
+ clang::VersionTuple obsoleted = avail->getObsoleted ();
7191
+ clang::VersionTuple introduced = avail->getIntroduced ();
7192
+
7193
+ // Swift only allows "." separators.
7194
+ obsoleted.UseDotAsSeparator ();
7195
+ introduced.UseDotAsSeparator ();
7196
+ deprecated.UseDotAsSeparator ();
7197
+
7191
7198
const auto &replacement = avail->getReplacement ();
7192
7199
7193
7200
StringRef swiftReplacement = " " ;
Original file line number Diff line number Diff line change
1
+ @interface MaybeAvailable
2
+ -(void )method1 __attribute__((availability(macosx, introduced=10.1 )));
3
+ -(void )method2 __attribute__((availability(macosx, introduced=10_1)));
4
+ -(void )method3 __attribute__((availability(macosx, deprecated=10_10)));
5
+ -(void )method4 __attribute__((availability(macosx, introduced=10_1, deprecated=10_10, obsoleted=10_11)));
6
+ @end
Original file line number Diff line number Diff line change
1
+ class MaybeAvailable {
2
+ @available(OSX 10.1, *)
3
+ class func method1()
4
+ @available(OSX 10.1, *)
5
+ func method1()
6
+ @available(OSX 10.1, *)
7
+ class func method2()
8
+ @available(OSX 10.1, *)
9
+ func method2()
10
+ @available(OSX, deprecated: 10.10)
11
+ class func method3()
12
+ @available(OSX, deprecated: 10.10)
13
+ func method3()
14
+ @available(OSX, introduced: 10.1, deprecated: 10.10, obsoleted: 10.11)
15
+ class func method4()
16
+ @available(OSX, introduced: 10.1, deprecated: 10.10, obsoleted: 10.11)
17
+ func method4()
18
+ }
Original file line number Diff line number Diff line change
1
+ class MaybeAvailable {
2
+ @available(OSX 10.1, *)
3
+ class func method1()
4
+ @available(OSX 10.1, *)
5
+ func method1()
6
+ @available(OSX 10.1, *)
7
+ class func method2()
8
+ @available(OSX 10.1, *)
9
+ func method2()
10
+ @available(OSX, deprecated: 10.10)
11
+ class func method3()
12
+ @available(OSX, deprecated: 10.10)
13
+ func method3()
14
+ @available(OSX, introduced: 10.1, deprecated: 10.10, obsoleted: 10.11)
15
+ class func method4()
16
+ @available(OSX, introduced: 10.1, deprecated: 10.10, obsoleted: 10.11)
17
+ func method4()
18
+ }
Original file line number Diff line number Diff line change
1
+ module HeaderToPrintAvailability {
2
+ header "header-to-print-availability.h"
3
+ }
Original file line number Diff line number Diff line change
1
+ // REQUIRES: OS=macosx
2
+
3
+ // RUN: %empty-directory(%t)
4
+
5
+ // RUN: echo '#include "header-to-print-availability.h"' > %t.m
6
+ // RUN: cp %S/Inputs/print_clang_header/header-to-print-availability.h %t/
7
+ // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -source-filename %s -print-header -header-to-print %t/header-to-print-availability.h -print-regular-comments --cc-args %target-cc-options -isysroot %clang-importer-sdk-path -fsyntax-only %t.m -I %t > %t.txt
8
+ // RUN: diff -u %S/Inputs/print_clang_header/header-to-print-availability.h.printed.txt %t.txt
9
+
10
+ // RUN: echo '@import HeaderToPrintAvailability;' > %t.module.m
11
+ // Test header interface printing from a clang module.
12
+ // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -source-filename %s -print-header -header-to-print %S/Inputs/print_clang_header/header-to-print-availability.h -print-regular-comments --cc-args %target-cc-options -isysroot %clang-importer-sdk-path -fsyntax-only %t.module.m -I %S/Inputs/print_clang_header > %t.module.txt
13
+ // RUN: diff -u %S/Inputs/print_clang_header/header-to-print-availability.h.module.printed.txt %t.module.txt
You can’t perform that action at this time.
0 commit comments