1 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -fblocks -verify %s
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -ast-dump %s | FileCheck %s
3 //
4 
5 #if !__has_feature(attribute_availability_with_message)
6 # error "Missing __has_feature"
7 #endif
8 
9 #if __has_feature(attribute_availability_swift)
10 # warning "okay"
11 // expected-warning@-1{{okay}}
12 #else
13 # error "Missing __has_feature"
14 #endif
15 
16 extern int noSwiftGlobal1 __attribute__((availability(swift, unavailable)));
17 // CHECK: AvailabilityAttr {{.*}}swift 0 0 0 Unavailable "" ""
18 extern int noSwiftGlobal1 __attribute__((availability(macosx, introduced=10.1))); // okay
19 // CHECK: AvailabilityAttr {{.*}}Inherited swift 0 0 0 Unavailable "" ""
20 // CHECK: AvailabilityAttr {{.*}}macos 10.1 0 0 "" ""
21 extern int noSwiftGlobal1 __attribute__((availability(swift, unavailable, message="and this one has a message"))); // okay
22 // CHECK: AvailabilityAttr {{.*}}Inherited macos 10.1 0 0 "" ""
23 // CHECK: AvailabilityAttr {{.*}}swift 0 0 0 Unavailable "and this one has a message" ""
24 extern int noSwiftGlobal2 __attribute__((availability(swift, introduced=5))); // expected-warning{{only 'unavailable' and 'deprecated' are supported for Swift availability}}
25 // CHECK: VarDecl
26 // CHECK-NOT: AvailabilityAttr
27 extern int noSwiftGlobal3 __attribute__((availability(swift, deprecated, message="t")));
28 // CHECK: VarDecl
29 // CHECK: AvailabilityAttr {{.*}}swift 0 1 0 "t" ""
30