[libc-commits] [PATCH] D114300: [libc] Make string entrypoints mutualy exclusive.

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Nov 22 01:04:28 PST 2021


gchatelet added inline comments.


================
Comment at: libc/src/string/mempcpy.cpp:20-21
                     size_t count)) {
-  void *result = __llvm_libc::memcpy(dest, src, count);
-  return result == nullptr
-             ? result
-             : static_cast<void *>(static_cast<char *>(result) + count);
+  if (dest == nullptr)
+    return nullptr;
+  char *result = reinterpret_cast<char *>(dest);
----------------
nit: Not sure this is part of the spec. It's probably fine to let it SIGSEGV.


================
Comment at: libc/src/string/mempcpy.cpp:24
+  inline_memcpy(result, reinterpret_cast<const char *>(src), count);
+  return static_cast<void *>(result + count);
 }
----------------
nit: Not strictly necessary since every pointer casts to `void*`


================
Comment at: libc/src/string/strcpy.cpp:30
   // break the sanitizers.
-  SANITIZER_MEMORY_INITIALIZED(result, size);
+  SANITIZER_MEMORY_INITIALIZED(dst, size);
 
----------------
that would be `dest`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114300



More information about the libc-commits mailing list