[llvm-commits] [ASan] remove <new> header (issue 5966077)
Kostya Serebryany
kcc at google.com
Wed Apr 4 07:57:47 PDT 2012
I'd prefer to move our custom new/delete into asan_new_delete.cc, and in
that file it would probably be ok to include <new>.
--kcc
On Wed, Apr 4, 2012 at 7:53 AM, <samsonov at google.com> wrote:
> 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/<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()
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120404/3705fd4a/attachment.html>
More information about the llvm-commits
mailing list