54 lines · plain
1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.14.0 -fsyntax-only -Wno-objc-root-class -verify %s2 3@interface I1 @end4 5// expected-warning@+1 {{'always_inline' attribute only applies to functions and statements}}6__attribute__((always_inline))7@implementation I1 @end8 9// expected-warning@+1 {{'always_inline' attribute only applies to functions and statements}}10__attribute__((always_inline))11@implementation I1 (MyCat) @end12 13// expected-warning@+1 {{'always_inline' attribute only applies to functions and statements}}14__attribute__((always_inline))15// expected-warning@+1 {{cannot find interface declaration for 'I2'}}16@implementation I2 @end17 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 @end22 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@end32 33@interface I5 @end34 35#pragma clang attribute push (AVAIL_ATTR, apply_to=objc_implementation)36@implementation I5 {37 unavail_int x;38}39@end40#pragma clang attribute pop41 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 @end47@interface I6 (MyCat) @end48@interface I6 () @end49 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 pop54