[libc++] Move the definition of aligned allocation helpers outside of <new>

They are not needed in <new> -- in fact they are only needed in .cpp files.
Getting those out of the way makes the headers smaller and also makes it
easier to use the library on platforms where aligned allocation is not

Differential Revision: https://reviews.llvm.org/D139231

GitOrigin-RevId: 36080434a8858c33f2af2382be748caed131385f
diff --git a/src/fallback_malloc.cpp b/src/fallback_malloc.cpp
index 591efbe..f9fb1bc 100644
--- a/src/fallback_malloc.cpp
+++ b/src/fallback_malloc.cpp
@@ -15,10 +15,10 @@
+#include <__memory/aligned_alloc.h>
 #include <assert.h>
 #include <stdlib.h> // for malloc, calloc, free
 #include <string.h> // for memset
-#include <new> // for std::__libcpp_aligned_{alloc,free}
 //  A small, simple heap manager based (loosely) on
 //  the startup heap manager from FreeBSD, optimized for space.
diff --git a/src/stdlib_new_delete.cpp b/src/stdlib_new_delete.cpp
index 4a664e1..483b9f1 100644
--- a/src/stdlib_new_delete.cpp
+++ b/src/stdlib_new_delete.cpp
@@ -9,8 +9,9 @@
 #include "__cxxabi_config.h"
-#include <new>
+#include <__memory/aligned_alloc.h>
 #include <cstdlib>
+#include <new>
 #if !defined(_THROW_BAD_ALLOC) || !defined(_LIBCXXABI_WEAK)
 #error The _THROW_BAD_ALLOC and _LIBCXXABI_WEAK libc++ macros must \
diff --git a/test/test_fallback_malloc.pass.cpp b/test/test_fallback_malloc.pass.cpp
index d7decd9..e7d22a5 100644
--- a/test/test_fallback_malloc.pass.cpp
+++ b/test/test_fallback_malloc.pass.cpp
@@ -24,9 +24,12 @@
 typedef std::deque<void *> container;
 #include "../src/fallback_malloc.cpp"
 void assertAlignment(void* ptr) { assert(reinterpret_cast<size_t>(ptr) % alignof(FallbackMaxAlignType) == 0); }