[PATCH] D57635: Add a new intrinsic and attribute to implement `__builtin_va_arg_pack{, _len}` in Clang

Erik Pilkington via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 3 11:25:11 PST 2019


erik.pilkington abandoned this revision.
erik.pilkington added a comment.

In D57635#1382249 <https://reviews.llvm.org/D57635#1382249>, @efriedma wrote:

> In terms of the general approach, what problem are we really trying to solve?  The ability to forward a variadic argument list on to another variadic function doesn't grant any semantic power if you control the implementation; you can always just use a va_list instead (e.g. convert printf to vprintf).  In C++, you can also just use a variadic template.  And if the goal is just to allow the compiler to emit fortified calls to known library functions, it would be more straightforward to add a flag to implicitly instrument code.
>
> I guess if you specifically want to add a feature to C which allows you to write, in C, a function (not a macro) which wraps an interface you don't control that takes a variadic argument list, you can't do much better than `__builtin_va_arg_pack()`.


Yeah, this is just about getting C++-compatible fortified wrappers for libc functions. I thought that delegating to a va_list variant was no good since it looks like we don't have the ability to inline a function that calls va_start, so any fortified stuff in the body would just be discarded. I think I'm convinced that handling this in the frontend would be a simpler way of solving this though, maybe with an attribute or something. I'm going to tentatively mark this as abandoned, I'll revive it if the frontend stuff doesn't pan out.

Thanks for your help!


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57635/new/

https://reviews.llvm.org/D57635





More information about the llvm-commits mailing list