[libc-commits] [PATCH] D119464: [libc][obvious] only include vector with malloc

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Feb 10 11:17:28 PST 2022


michaelrj created this revision.
Herald added subscribers: libc-commits, ecnelises, tschuett, cryptoad, mgorny.
Herald added a project: libc-project.
michaelrj requested review of this revision.

the vector class, due to being dynamically resized, needs malloc. This
fixes the build so that it only includes it when malloc should be
available.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119464

Files:
  libc/src/__support/CPP/CMakeLists.txt
  libc/test/utils/CPP/CMakeLists.txt


Index: libc/test/utils/CPP/CMakeLists.txt
===================================================================
--- libc/test/utils/CPP/CMakeLists.txt
+++ libc/test/utils/CPP/CMakeLists.txt
@@ -40,12 +40,14 @@
     libc.src.__support.CPP.standalone_cpp
 )
 
-add_libc_unittest(
-  vector_test
-  SUITE
-    libc_cpp_utils_unittests
-  SRCS
-    vector_test.cpp
-  DEPENDS
-    libc.src.__support.CPP.vector
-)
+if(LLVM_LIBC_INCLUDE_SCUDO OR NOT LLVM_LIBC_FULL_BUILD)
+  add_libc_unittest(
+    vector_test
+    SUITE
+      libc_cpp_utils_unittests
+    SRCS
+      vector_test.cpp
+    DEPENDS
+      libc.src.__support.CPP.vector
+  )
+endif()
Index: libc/src/__support/CPP/CMakeLists.txt
===================================================================
--- libc/src/__support/CPP/CMakeLists.txt
+++ libc/src/__support/CPP/CMakeLists.txt
@@ -12,10 +12,12 @@
     TypeTraits.h
 )
 
-add_header_library(
-  vector
-  HDRS
-    vector.h
-  DEPENDS
-    libc.include.stdlib
-)
+if(LLVM_LIBC_INCLUDE_SCUDO OR NOT LLVM_LIBC_FULL_BUILD)
+  add_header_library(
+    vector
+    HDRS
+      vector.h
+    DEPENDS
+      libc.include.stdlib
+  )
+endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119464.407614.patch
Type: text/x-patch
Size: 1148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220210/d94c9989/attachment-0001.bin>


More information about the libc-commits mailing list