[PATCH] D52401: Remove redundant null pointer check in operator delete

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 1 10:22:57 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL343503: Remove redundant null pointer check in operator delete (authored by MaskRay, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D52401

Files:
  libcxx/trunk/src/new.cpp


Index: libcxx/trunk/src/new.cpp
===================================================================
--- libcxx/trunk/src/new.cpp
+++ libcxx/trunk/src/new.cpp
@@ -135,8 +135,7 @@
 void
 operator delete(void* ptr) _NOEXCEPT
 {
-    if (ptr)
-        ::free(ptr);
+    ::free(ptr);
 }
 
 _LIBCPP_WEAK
@@ -257,11 +256,10 @@
 void
 operator delete(void* ptr, std::align_val_t) _NOEXCEPT
 {
-    if (ptr)
 #if defined(_LIBCPP_MSVCRT_LIKE)
-        ::_aligned_free(ptr);
+    ::_aligned_free(ptr);
 #else
-        ::free(ptr);
+    ::free(ptr);
 #endif
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52401.167768.patch
Type: text/x-patch
Size: 551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181001/d8f7b721/attachment.bin>


More information about the cfe-commits mailing list