Ryan Flynn | 1f1fdc0 | 2009-08-09 20:07:29 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -verify -fsyntax-only %s && |
| 2 | // RUN: clang-cc -emit-llvm -o %t %s && |
| 3 | |
| 4 | #include <stdlib.h> |
| 5 | |
| 6 | int no_vars __attribute((malloc)); // expected-warning {{only applies to function types}} |
| 7 | |
| 8 | __attribute((malloc)) |
| 9 | void * xalloc(unsigned n) { return malloc(n); } |
| 10 | // RUN: grep 'define noalias .* @xalloc(' %t && |
| 11 | |
| 12 | #define __malloc_like __attribute((__malloc__)) |
| 13 | void * xalloc2(unsigned) __malloc_like; |
| 14 | void * xalloc2(unsigned n) { return malloc(n); } |
| 15 | // RUN: grep 'define noalias .* @xalloc2(' %t |
| 16 | |