now works with -fno-exceptions and -fno-rtti

llvm-svn: 110828
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 54b409fdb9489b305bf95f4d4f52b49c7926c429
diff --git a/src/new.cpp b/src/new.cpp
index 964d87b..f751f17 100644
--- a/src/new.cpp
+++ b/src/new.cpp
@@ -42,7 +42,11 @@
         if (__new_handler)
             __new_handler();
         else
+#ifndef _LIBCPP_NO_EXCEPTIONS
             throw std::bad_alloc();
+#else
+            break;
+#endif
     }
     return p;
 }
@@ -52,13 +56,17 @@
 operator new(size_t size, const std::nothrow_t&) throw()
 {
     void* p = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
     try
     {
+#endif
         p = ::operator new(size);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
     {
     }
+#endif
     return p;
 }
 
@@ -74,13 +82,17 @@
 operator new[](size_t size, const std::nothrow_t& nothrow) throw()
 {
     void* p = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
     try
     {
+#endif
         p = ::operator new[](size);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
     {
     }
+#endif
     return p;
 }
 
@@ -162,7 +174,9 @@
 void
 __throw_bad_alloc()
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     throw bad_alloc();
+#endif
 }
 
 }  // std