Shih-wei Liao | ea28516 | 2010-06-04 12:34:56 -0700 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fsyntax-only -fblocks %s |
| 2 | |
| 3 | @interface TestAttrMallocOnMethods {} |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame] | 4 | - (id) test1 __attribute((malloc)); // expected-warning {{attribute only applies to functions}} |
| 5 | - (int) test2 __attribute((malloc)); // expected-warning {{attribute only applies to functions}} |
Shih-wei Liao | ea28516 | 2010-06-04 12:34:56 -0700 | [diff] [blame] | 6 | @end |
| 7 | |
| 8 | id bar(void) __attribute((malloc)); // no-warning |
| 9 | |
| 10 | typedef void (^bptr)(void); |
| 11 | bptr baz(void) __attribute((malloc)); // no-warning |
| 12 | |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame] | 13 | __attribute((malloc)) id (*f)(); // expected-warning {{attribute only applies to functions}} |
| 14 | __attribute((malloc)) bptr (*g)(); // expected-warning {{attribute only applies to functions}} |
| 15 | __attribute((malloc)) void *(^h)(); // expected-warning {{attribute only applies to functions}} |
Shih-wei Liao | ea28516 | 2010-06-04 12:34:56 -0700 | [diff] [blame] | 16 | |