[libcxx-commits] [PATCH] D93473: [libc++/abi] Re-remove unnecessary null pointer checks from operator delete

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 8 14:04:16 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGbc556e5685c0: [libc++/abi] Re-remove unnecessary null pointer checks from operator delete (authored by ldionne).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93473/new/

https://reviews.llvm.org/D93473

Files:
  libcxx/src/new.cpp
  libcxxabi/src/stdlib_new_delete.cpp


Index: libcxxabi/src/stdlib_new_delete.cpp
===================================================================
--- libcxxabi/src/stdlib_new_delete.cpp
+++ libcxxabi/src/stdlib_new_delete.cpp
@@ -214,9 +214,7 @@
 void
 operator delete(void* ptr, std::align_val_t) _NOEXCEPT
 {
-    if (ptr) {
-        std::__libcpp_aligned_free(ptr);
-    }
+    std::__libcpp_aligned_free(ptr);
 }
 
 _LIBCXXABI_WEAK
Index: libcxx/src/new.cpp
===================================================================
--- libcxx/src/new.cpp
+++ libcxx/src/new.cpp
@@ -130,8 +130,7 @@
 void
 operator delete(void* ptr) _NOEXCEPT
 {
-    if (ptr)
-        ::free(ptr);
+    ::free(ptr);
 }
 
 _LIBCPP_WEAK
@@ -252,9 +251,7 @@
 void
 operator delete(void* ptr, std::align_val_t) _NOEXCEPT
 {
-    if (ptr) {
-        std::__libcpp_aligned_free(ptr);
-    }
+    std::__libcpp_aligned_free(ptr);
 }
 
 _LIBCPP_WEAK


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93473.315515.patch
Type: text/x-patch
Size: 888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210108/fb4e58ec/attachment.bin>


More information about the libcxx-commits mailing list