[libc-commits] [PATCH] D77277: [libc] Fix memcpy to adhere to qualified calls.

Paula Toth via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Apr 3 14:39:08 PDT 2020


PaulkaToast updated this revision to Diff 254918.
PaulkaToast marked 7 inline comments as done.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77277

Files:
  libc/fuzzing/string/CMakeLists.txt
  libc/src/string/CMakeLists.txt
  libc/src/string/strcpy.cpp
  libc/test/src/string/CMakeLists.txt


Index: libc/test/src/string/CMakeLists.txt
===================================================================
--- libc/test/src/string/CMakeLists.txt
+++ libc/test/src/string/CMakeLists.txt
@@ -11,6 +11,8 @@
   DEPENDS
     strcat
     strcpy
+# TODO (sivachandra): remove redundant deps.
+    memcpy
 )
 
 add_libc_unittest(
@@ -21,6 +23,8 @@
     strcpy_test.cpp
   DEPENDS
     strcpy
+# TODO (sivachandra): remove redundant deps.
+    memcpy
 )
 
 # Tests all implementations of memcpy that can run on the host.
Index: libc/src/string/strcpy.cpp
===================================================================
--- libc/src/string/strcpy.cpp
+++ libc/src/string/strcpy.cpp
@@ -7,13 +7,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/string/strcpy.h"
+#include "src/string/memcpy.h"
 
 #include "src/__support/common.h"
 
 namespace __llvm_libc {
 
 char *LLVM_LIBC_ENTRYPOINT(strcpy)(char *dest, const char *src) {
-  return reinterpret_cast<char *>(::memcpy(dest, src, ::strlen(src) + 1));
+  return reinterpret_cast<char *>(
+      __llvm_libc::memcpy(dest, src, ::strlen(src) + 1));
 }
 
 } // namespace __llvm_libc
Index: libc/src/string/CMakeLists.txt
===================================================================
--- libc/src/string/CMakeLists.txt
+++ libc/src/string/CMakeLists.txt
@@ -19,6 +19,7 @@
     strcpy.h
   DEPENDS
     string_h
+    memcpy
 )
 
 # ------------------------------------------------------------------------------
Index: libc/fuzzing/string/CMakeLists.txt
===================================================================
--- libc/fuzzing/string/CMakeLists.txt
+++ libc/fuzzing/string/CMakeLists.txt
@@ -4,4 +4,5 @@
     strcpy_fuzz.cpp
   DEPENDS
     strcpy
+    memcpy
 )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77277.254918.patch
Type: text/x-patch
Size: 1779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200403/78d63cf1/attachment.bin>


More information about the libc-commits mailing list