[llvm-commits] [ASan] remove <new> header (issue 5966077)
samsonov at google.com
samsonov at google.com
Wed Apr 4 07:53:14 PDT 2012
Reviewers: kcc1, timurrrr_at_google_com,
Message:
#include <new> brings a number of system libraries (e.g. <string.h> on
Windows), which is probably unwanted. We (hopefully) can replace
std::nothrow_t and std::bad_alloc by custom stubs, so that our overload
of new would still work in a user program.
Please review this at http://codereview.appspot.com/5966077/
Affected files:
M asan_interceptors.cc
Index: asan_interceptors.cc
===================================================================
--- asan_interceptors.cc (revision 154006)
+++ asan_interceptors.cc (working copy)
@@ -22,8 +22,6 @@
#include "asan_thread_registry.h"
#include "interception/interception.h"
-#include <new>
-
// Use macro to describe if specific function should be
// intercepted on a given platform.
#if !defined(_WIN32)
@@ -331,6 +329,10 @@
void *operator new(size_t size) { OPERATOR_NEW_BODY; }
void *operator new[](size_t size) { OPERATOR_NEW_BODY; }
#else
+namespace std {
+class bad_alloc {};
+class nothrow_t;
+} // namespace std
void *operator new(size_t size) throw(std::bad_alloc) { OPERATOR_NEW_BODY;
}
void *operator new[](size_t size) throw(std::bad_alloc) {
OPERATOR_NEW_BODY; }
void *operator new(size_t size, std::nothrow_t const&) throw()
More information about the llvm-commits
mailing list