[PATCH] D79279: Add overloaded versions of builtin mem* functions

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 11:17:16 PDT 2020


jfb added a comment.

In D79279#2201484 <https://reviews.llvm.org/D79279#2201484>, @rsmith wrote:

> I think it would be reasonable in general to guarantee that our `__builtin_` functions have contracts at least as wide as the underlying C function, but allow them to have extensions, and to keep the plain C functions unextended. I had actually thought we already did that in more cases than we do (but perhaps I was thinking about the LLVM math intrinsics that guarantee to not set `errno`). That would mean that a C standard library implementation is still free to `#define foo(x,y,z) __builtin_foo(x,y,z)`, but if they do, they may pick up extensions.

Alright, how about I go with what you say here, and instead of adding `__builtin_*_overloaded` versions I just overload the `__builtin_*` variants? This includes having an optional 4th parameter for access size.
Alternatively, I could overload  `__builtin_*`, but have a separate set of functions (say  `__builtin_*_sized`) for the atomic access size variants.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79279



More information about the cfe-commits mailing list