[cfe-commits] [PATCH] Add support to alloc_size attribute

Xi Wang xi.wang at gmail.com
Wed Feb 29 19:13:14 PST 2012


Hi,

The first patch adds support to the alloc_size attribute.

http://llvm.org/bugs/show_bug.cgi?id=10516

Thanks to Eli Friedman for the earlier comments.

The second patch demonstrates one use of alloc_size.  It extends
the malloc overflow checker to support custom allocators:

void *my_malloc(size_t) __attribute__((alloc_size(1)));

void *foo(int n)
{
  return my_malloc(n * sizeof(int));  // warning
}

Please review.  Thanks.

- xi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc_size.patch
Type: application/octet-stream
Size: 7538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120229/ce4770eb/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: malloc-overflow.patch
Type: application/octet-stream
Size: 1771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120229/ce4770eb/attachment-0001.obj>


More information about the cfe-commits mailing list