[PATCH] D68377: [Builtins] Teach Clang about memccpy

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 11:37:08 PDT 2019


aaron.ballman added inline comments.


================
Comment at: include/clang/Basic/Builtins.def:483
 BUILTIN(__builtin_memcpy, "v*v*vC*z", "nF")
+BUILTIN(__builtin_memccpy, "v*v*vC*iz", "nF")
 BUILTIN(__builtin_memmove, "v*v*vC*z", "nF")
----------------
xbolva00 wrote:
> aaron.ballman wrote:
> > xbolva00 wrote:
> > > aaron.ballman wrote:
> > > > GCC doesn't seem to have `__builtin_memccpy`? https://godbolt.org/z/jbthQ3
> > > Ok, I will drop it.
> > If you drop it, won't that lose the builtin? I was mostly thinking it's in the wrong part of the list of builtins.
> Rebuilding LLVM + Clang in progress so I just checked it in godbolt with "strtol" - defined only as LIBBUILTIN, no __builtin version.
> 
> nobuiltin attribute is correctly handled, so I think it will work. 
> https://godbolt.org/z/Olfv-w
Ah, I see the issue better now. The description for this review was very terse and it wasn't immediately clear what problem you were trying to solve.

Yeah, I think this declaration can go away.


================
Comment at: include/clang/Basic/Builtins.def:983
 // POSIX string.h
+LIBBUILTIN(memccpy, "v*v*vC*iz",  "f",     "string.h", ALL_GNU_LANGUAGES)
 LIBBUILTIN(stpcpy, "c*c*cC*",     "f",     "string.h", ALL_GNU_LANGUAGES)
----------------
Isn't `memccpy` supported by Visual Studio? What should happen there?


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

https://reviews.llvm.org/D68377





More information about the cfe-commits mailing list