Drop the dependency on <algorithm>, add placement new inline
We haven't eliminated C++ library dependency altogether in D57251,
UnwindCursor.hpp had an unused dependency on <algorithm> which was
pulling in other C++ headers. Removing that dependency also revealed
(correctly) that we need our own global placement new declaration. Now
libunwind should be independent of the C++ library.
Differential Revision: https://reviews.llvm.org/D57262
llvm-svn: 352553
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 7fac51724f8875fb063a5ec7079b0172b3387717
diff --git a/src/libunwind.cpp b/src/libunwind.cpp
index a2496a0..cfa9112 100644
--- a/src/libunwind.cpp
+++ b/src/libunwind.cpp
@@ -11,10 +11,6 @@
#include <libunwind.h>
-#ifndef NDEBUG
-#include <cstdlib> // getenv
-#endif
-
#include "libunwind_ext.h"
#include "config.h"
@@ -27,6 +23,10 @@
using namespace libunwind;
+// libunwind does not and should not depend on C++ library which means that we
+// need our own declaration of global placement new.
+void *operator new(size_t, void*);
+
/// internal object to represent this processes address space
LocalAddressSpace LocalAddressSpace::sThisAddressSpace;