[cfe-dev] [PATCH RFC] add support to alloc_size attribute

Xi Wang xi.wang at gmail.com
Wed Feb 22 17:11:10 PST 2012


On Feb 22, 2012, at 7:56 PM, Richard Smith wrote:
> I've not looked at the patch in any detail, but I see that it doesn't affect the __builtin_object_size calculation. Do you intend to implement that part of it too? The code implementing that is in lib/AST/ExprConstant.cpp (search for TryEvaluateBuiltinObjectSize).

You are right.  This patch only recognizes the alloc_size attribute.  It was not intended to be used for __builtin_object_size.  Internally we use it to mark allocation sizes and generate code to prevent integer overflows (i.e., forcing malloc to return NULL if the allocation size calculation overflows).

> Future patches should be sent to cfe-commits@ for review, not cfe-dev at .

Thanks for letting me know. ;-)

- xi



More information about the cfe-dev mailing list