• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.14.0 -fsyntax-only -Wno-objc-root-class -verify %s
2
3@interface I1 @end
4
5// expected-warning@+1 {{'always_inline' attribute only applies to functions}}
6__attribute__((always_inline))
7@implementation I1 @end
8
9// expected-warning@+1 {{'always_inline' attribute only applies to functions}}
10__attribute__((always_inline))
11@implementation I1 (MyCat) @end
12
13// expected-warning@+1 {{'always_inline' attribute only applies to functions}}
14__attribute__((always_inline))
15// expected-warning@+1 {{cannot find interface declaration for 'I2'}}
16@implementation I2 @end
17
18// expected-error@+1 {{only applies to Objective-C interfaces}}
19__attribute__((objc_root_class))
20// expected-warning@+1 {{cannot find interface declaration for 'I3'}}
21@implementation I3 @end
22
23#define AVAIL_ATTR __attribute__((availability(macos, introduced=1000)))
24
25typedef int AVAIL_ATTR unavail_int; // expected-note {{marked as being introduced}}
26
27@interface I4 @end // expected-note {{annotate}}
28@implementation I4 {
29  unavail_int x; // expected-warning {{'unavail_int' is only available on macOS 1000 or newer}}
30}
31@end
32
33@interface I5 @end
34
35#pragma clang attribute push (AVAIL_ATTR, apply_to=objc_implementation)
36@implementation I5 {
37  unavail_int x;
38}
39@end
40#pragma clang attribute pop
41
42I5 *i5;
43
44// expected-error@+1 2 {{'annotate' attribute takes at least 1 argument}}
45#pragma clang attribute push (__attribute__((annotate)), apply_to=objc_implementation)
46@interface I6 @end
47@interface I6 (MyCat) @end
48@interface I6 () @end
49
50@implementation I6 @end // expected-note {{when applied to this declaration}}
51@implementation I6 (MyCat) @end // expected-note {{when applied to this declaration}}
52
53#pragma clang attribute pop
54