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

Paula Toth via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Apr 1 17:27:07 PDT 2020


PaulkaToast created this revision.
PaulkaToast added a project: libc-project.
Herald added subscribers: libc-commits, tschuett, MaskRay, mgorny.
PaulkaToast added a child revision: D77281: [libc] Add libc-tidy..
PaulkaToast added a child revision: D77279: [libc] Add strlen implementation..
PaulkaToast removed a child revision: D77281: [libc] Add libc-tidy..
PaulkaToast added reviewers: sivachandra, abrachet.
PaulkaToast added a reviewer: gchatelet.
PaulkaToast added a child revision: D77281: [libc] Add libc-tidy..

Switched to using the new memcpy implementation and the `LIBC-NOLINT` going to be used a future review.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77277

Files:
  libc/fuzzing/string/CMakeLists.txt
  libc/src/math/round_redirector.cpp
  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,7 @@
   DEPENDS
     strcat
     strcpy
+    memcpy
 )
 
 add_libc_unittest(
@@ -21,6 +22,7 @@
     strcpy_test.cpp
   DEPENDS
     strcpy
+    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/src/math/round_redirector.cpp
===================================================================
--- libc/src/math/round_redirector.cpp
+++ libc/src/math/round_redirector.cpp
@@ -13,7 +13,8 @@
 namespace __llvm_libc {
 
 double __round_redirector(double x) {
-  return ::round(x);
+  // Call system round since llvm-libc round is yet to be implemented.
+  return ::round(x); // LIBC-NOLINT
 }
 
 } // namespace __llvm_libc
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.254361.patch
Type: text/x-patch
Size: 2123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200402/ec1dd643/attachment-0001.bin>


More information about the libc-commits mailing list