[llvm-branch-commits] [libcxxabi] ef74f0f - [libc++abi] Remove redundant null pointer check in operator delete
Fangrui Song via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Dec 16 13:33:56 PST 2020
Author: Fangrui Song
Date: 2020-12-16T13:29:40-08:00
New Revision: ef74f0fdc33909d0e29a8206debd73d7673791c6
URL: https://github.com/llvm/llvm-project/commit/ef74f0fdc33909d0e29a8206debd73d7673791c6
DIFF: https://github.com/llvm/llvm-project/commit/ef74f0fdc33909d0e29a8206debd73d7673791c6.diff
LOG: [libc++abi] Remove redundant null pointer check in operator delete
Similar to D52401. Normally operator delete is defined in libc++abi
(LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS is off by default).
C89 4.10.3.2 The free function
C99 7.20.3.2 The free function
C11 7.22.3.3 The free function
If ptr is a null pointer, no action shall occur.
free on MSDN:
If memblock is NULL, the pointer is ignored and free immediately returns.
Reviewed By: #libc_abi, ldionne
Differential Revision: https://reviews.llvm.org/D93339
Added:
Modified:
libcxxabi/src/stdlib_new_delete.cpp
Removed:
################################################################################
diff --git a/libcxxabi/src/stdlib_new_delete.cpp b/libcxxabi/src/stdlib_new_delete.cpp
index 9df84548ea3e..a3e028be0fd2 100644
--- a/libcxxabi/src/stdlib_new_delete.cpp
+++ b/libcxxabi/src/stdlib_new_delete.cpp
@@ -93,8 +93,7 @@ _LIBCXXABI_WEAK
void
operator delete(void* ptr) _NOEXCEPT
{
- if (ptr)
- ::free(ptr);
+ ::free(ptr);
}
_LIBCXXABI_WEAK
More information about the llvm-branch-commits
mailing list