Try 2 - Remove <cstdlib> include from `<exception>`

This patch removes the `<cstdlib>` include from exception where it is no longer
needed. Unlike my previous attempt this patch also adds <cstdlib> where needed
in other headers like <new> and <typeinfo>.

This won't fix the Firefox build issues discussed on IRC but it is more correct
for libc++.

llvm-svn: 280754
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: b683ec20e4e1abc63778a7fff3506f4be8b15f37
diff --git a/include/exception b/include/exception
index a130bca..686e4ec 100644
--- a/include/exception
+++ b/include/exception
@@ -80,10 +80,6 @@
 #include <__config>
 #include <cstddef>
 #include <type_traits>
-#if defined(_LIBCPP_NO_EXCEPTIONS)
-#include <cstdio>
-#include <cstdlib>
-#endif
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/new b/include/new
index 9520867..936f9ee 100644
--- a/include/new
+++ b/include/new
@@ -69,6 +69,9 @@
 #include <__config>
 #include <exception>
 #include <cstddef>
+#ifdef _LIBCPP_NO_EXCEPTIONS
+#include <cstdlib>
+#endif
 
 #include <__undef___deallocate>
 
diff --git a/include/stdexcept b/include/stdexcept
index 684578f..b78d5d6 100644
--- a/include/stdexcept
+++ b/include/stdexcept
@@ -45,6 +45,9 @@
 #include <__config>
 #include <exception>
 #include <iosfwd>  // for string forward decl
+#ifdef _LIBCPP_NO_EXCEPTIONS
+#include <cstdlib>
+#endif
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/typeinfo b/include/typeinfo
index d3155e4..ace6609 100644
--- a/include/typeinfo
+++ b/include/typeinfo
@@ -61,6 +61,9 @@
 #include <exception>
 #include <cstddef>
 #include <cstdint>
+#ifdef _LIBCPP_NO_EXCEPTIONS
+#include <cstdlib>
+#endif
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header