[libcxx-commits] [PATCH] D80057: [libc++][NFCI] Optimization to std::~unique_ptr
Atmn Patel via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat May 16 07:53:53 PDT 2020
atmnpatel updated this revision to Diff 264430.
atmnpatel added a comment.
Aye aye.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80057/new/
https://reviews.llvm.org/D80057
Files:
libcxx/include/memory
Index: libcxx/include/memory
===================================================================
--- libcxx/include/memory
+++ libcxx/include/memory
@@ -2641,7 +2641,11 @@
_LIBCPP_INLINE_VISIBILITY
- ~unique_ptr() { reset(); }
+ ~unique_ptr() {
+ const pointer __ptr = __ptr_.first();
+ if (__ptr)
+ __ptr_.second()(__ptr);
+ }
_LIBCPP_INLINE_VISIBILITY
unique_ptr& operator=(nullptr_t) _NOEXCEPT {
@@ -2864,7 +2868,11 @@
public:
_LIBCPP_INLINE_VISIBILITY
- ~unique_ptr() { reset(); }
+ ~unique_ptr() {
+ const pointer __ptr = __ptr_.first();
+ if (__ptr)
+ __ptr_.second()(__ptr);
+ }
_LIBCPP_INLINE_VISIBILITY
unique_ptr& operator=(nullptr_t) _NOEXCEPT {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80057.264430.patch
Type: text/x-patch
Size: 718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200516/0c7d3b2f/attachment-0001.bin>
More information about the libcxx-commits
mailing list