xref: /aosp_15_r20/external/clang/test/SemaObjC/attr-malloc.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -verify -fsyntax-only -fblocks %s
2*67e74705SXin Li
3*67e74705SXin Li@interface TestAttrMallocOnMethods {}
4*67e74705SXin Li- (id) test1 __attribute((malloc)); //  expected-warning {{attribute only applies to functions}}
5*67e74705SXin Li- (int) test2 __attribute((malloc)); //  expected-warning {{attribute only applies to functions}}
6*67e74705SXin Li@end
7*67e74705SXin Li
8*67e74705SXin Liid bar(void) __attribute((malloc)); // no-warning
9*67e74705SXin Li
10*67e74705SXin Litypedef void (^bptr)(void);
11*67e74705SXin Libptr baz(void) __attribute((malloc)); // no-warning
12*67e74705SXin Li
13*67e74705SXin Li__attribute((malloc)) id (*f)(); //  expected-warning {{attribute only applies to functions}}
14*67e74705SXin Li__attribute((malloc)) bptr (*g)(); //  expected-warning {{attribute only applies to functions}}
15*67e74705SXin Li__attribute((malloc)) void *(^h)(); //  expected-warning {{attribute only applies to functions}}
16*67e74705SXin Li
17