[cfe-dev] Addition of function parameter attribute to help __builtin_object_size
George Burgess IV via cfe-dev
cfe-dev at lists.llvm.org
Mon Sep 14 10:54:05 PDT 2015
Hello friends,
I plan to add a function parameter attribute called carry_size (name
suggestions welcome). The goal of this attribute is to help Clang/LLVM
answer `__builtin_object_size(Ptr, Type)` calls when the object pointed to
by Ptr isn't visible in the caller of __builtin_object_size.
An example of its use:
#define CS(N) __attribute__((carry_size(N)))
void __attribute__((noinline)) Func(void *const p CS(0)) {
printf("%d\n", __builtin_object_size(p, 0));
}
int main() {
char c[10];
Func(c); // prints "10\n"
}
For more info, please see the doc here:
https://docs.google.com/document/d/14TwNLxFL_jhiYn7_kppNUDiaTopRAIY5bc-B8NcnKMM/edit?usp=sharing
Thanks!
George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150914/ea966b57/attachment.html>
More information about the cfe-dev
mailing list