xref: /aosp_15_r20/external/clang/test/SemaObjC/ibaction.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -verify -Wno-objc-root-class %s
2*67e74705SXin Li
3*67e74705SXin Li@interface Foo
4*67e74705SXin Li{
5*67e74705SXin Li  __attribute__((iboutlet)) id myoutlet;
6*67e74705SXin Li}
7*67e74705SXin Li+ (void) __attribute__((ibaction)) myClassMethod:(id)msg; // expected-warning{{'ibaction' attribute only applies to Objective-C instance methods}}
8*67e74705SXin Li- (void) __attribute__((ibaction)) myMessage:(id)msg;
9*67e74705SXin Li@end
10*67e74705SXin Li
11*67e74705SXin Li@implementation Foo
12*67e74705SXin Li+ (void) __attribute__((ibaction)) myClassMethod:(id)msg {} // expected-warning{{'ibaction' attribute only applies to Objective-C instance methods}}
13*67e74705SXin Li// Normally attributes should not be attached to method definitions, but
14*67e74705SXin Li// we allow 'ibaction' to be attached because it can be expanded from
15*67e74705SXin Li// the IBAction macro.
16*67e74705SXin Li- (void) __attribute__((ibaction)) myMessage:(id)msg {} // no-warning
17*67e74705SXin Li@end
18