[libc-commits] [libc] 43de233 - [libc][NFC] Remove allocator definition in the api-test.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Sat Mar 4 16:26:55 PST 2023


Author: Siva Chandra Reddy
Date: 2023-03-05T00:25:02Z
New Revision: 43de233e294530eef37cc185b5699ad60289803e

URL: https://github.com/llvm/llvm-project/commit/43de233e294530eef37cc185b5699ad60289803e
DIFF: https://github.com/llvm/llvm-project/commit/43de233e294530eef37cc185b5699ad60289803e.diff

LOG: [libc][NFC] Remove allocator definition in the api-test.

The integration tests already have allocators so we will get all of them
from there.

Added: 
    

Modified: 
    libc/test/IntegrationTest/test.cpp
    libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp

Removed: 
    


################################################################################
diff  --git a/libc/test/IntegrationTest/test.cpp b/libc/test/IntegrationTest/test.cpp
index 3de4fa7525cc..53f9c9542301 100644
--- a/libc/test/IntegrationTest/test.cpp
+++ b/libc/test/IntegrationTest/test.cpp
@@ -29,4 +29,9 @@ void *malloc(size_t s) {
 
 void free(void *) {}
 
+void *realloc(void *ptr, size_t s) {
+  free(ptr);
+  return malloc(s);
+}
+
 } // extern "C"

diff  --git a/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp b/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp
index 667d4eb1d72e..86f0220a510a 100644
--- a/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp
+++ b/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp
@@ -95,12 +95,6 @@ bool TestGeneratorMain(llvm::raw_ostream &OS, llvm::RecordKeeper &records) {
   OS << "  return 0;\n";
   OS << "}\n\n";
 
-  // We provide dummy malloc and free implementations to support the case
-  // when LLVM libc does to include them.
-  OS << "void *malloc(size_t) __NOEXCEPT { return nullptr; }\n";
-  OS << "void *realloc(void *, size_t) __NOEXCEPT { return nullptr; }\n";
-  OS << "void free(void *) __NOEXCEPT {}\n";
-
   return false;
 }
 


        


More information about the libc-commits mailing list