[LLVMdev] setting parameter attributes on function returns
Bill Wendling
wendling at apple.com
Fri Mar 12 15:00:28 PST 2010
On Mar 12, 2010, at 1:49 PM, james woodyatt wrote:
> On Mar 10, 2010, at 21:33, james woodyatt wrote:
>>
>> Maybe I'm missing it, but I don't see how to apply parameter attributes to function return types in either the C-language or OCaml bindings. Can anybody help clue me in? Thanks.
>
> I hope I can assume from the lack of response to my question that the answer is No, I'm not missing anything: the functionality is missing from both the C-language and OCaml bindings. Should I also assume that this is an oversight and that a patch would be welcome?
>
I'll respond. :-)
What is it you want? You say "parameter attributes", but a return type isn't a parameter (as far as I know). And I don't believe that C allows you to specify an attribute on a return type itself.
Let's hypothesize, though. If you want to apply an attribute to a type, then you may do so in the GCC way with the __attribute__(()) syntax:
struct A {
int f[3];
} __attribute__((aligned(8)));
or:
typedef int foo __attribute__((aligned(13)));
and then use that in with your functions:
foo func() {
foo f = 37;
/* ... */
return f;
}
If that's what you want, then we will place the attribute on the type itself (assuming it's an attribute we support and haven't forgotten to implement, etc.).
-bw
More information about the llvm-dev
mailing list