[PATCH] D79279: Add overloaded versions of builtin mem* functions
Guillaume Chatelet via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 3 13:04:28 PDT 2020
gchatelet added inline comments.
================
Comment at: clang/include/clang/Basic/Builtins.def:489
BUILTIN(__builtin_memcpy_inline, "vv*vC*Iz", "nt")
+BUILTIN(__builtin_overloaded_memcpy, "v*v*vC*z", "nt")
BUILTIN(__builtin_memmove, "v*v*vC*z", "nF")
----------------
jfb wrote:
> gchatelet wrote:
> > `overloaded` doesn't bring much semantic (says the one who added `__builtin_memcpy_inline`...). Can you come up with something that describes more precisely what the intends are?
> >
> > Also `memset`, `memcmp`, `memcpy`, `memmove` will have their `inline` and `overloaded` versions. This is becoming a crowded space. It may be confusing in the long run. If we want to go in that direction maybe we should come up with a consistent pattern: `__builtin_<memfun>_<feature>`. WDYT?
> Flipping it around is fine with me, see update (done with `sed`).
>
> What's your approach on choosing what gets an `inline` variant and what doesn't? `memcmp` is easy to add, but I wonder how far it's useful to go... I can just wait for requests as well (as I imagine you're doing?).
I don't see `memmove_inline` being useful but memset and memcmp would make sense to add as building blocks for C++ implementations (e.g. [[ https://github.com/llvm/llvm-project/blob/master/libc/src/string/memcpy.cpp | libc memcpy ]])
As for this new addition, how about `__builtin_memcpy_honor_qualifiers`?
I fear that `__builtin_memcpy_overloaded` is too ambiguous.
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