Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fsyntax-only -fblocks %s |
Ted Kremenek | a18d7d8 | 2009-08-14 20:49:40 +0000 | [diff] [blame] | 2 | |
Ted Kremenek | a18d7d8 | 2009-08-14 20:49:40 +0000 | [diff] [blame] | 3 | @interface TestAttrMallocOnMethods {} |
Ted Kremenek | 2cff7d1 | 2009-08-15 00:51:46 +0000 | [diff] [blame] | 4 | - (id) test1 __attribute((malloc)); // expected-warning {{functions returning a pointer type}} |
| 5 | - (int) test2 __attribute((malloc)); // expected-warning {{functions returning a pointer type}} |
Ted Kremenek | a18d7d8 | 2009-08-14 20:49:40 +0000 | [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 | |
Ted Kremenek | 2cff7d1 | 2009-08-15 00:51:46 +0000 | [diff] [blame] | 13 | __attribute((malloc)) id (*f)(); // expected-warning {{functions returning a pointer type}} |
| 14 | __attribute((malloc)) bptr (*g)(); // expected-warning {{functions returning a pointer type}} |
| 15 | __attribute((malloc)) void *(^h)(); // expected-warning {{functions returning a pointer type}} |
Ted Kremenek | 2733b66 | 2009-08-14 22:06:01 +0000 | [diff] [blame] | 16 | |