[PATCH] D43159: [libc++] Replace several uses of 0 by nullptr
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rG527a7fdfbd74: [libc++] Replace several uses of 0 by nullptr (authored by brucem, committed by ldionne). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D43159/new/ https://reviews.llvm.org/D43159 Files: libcxx/include/__locale libcxx/include/__sso_allocator libcxx/include/__string libcxx/include/__threading_support libcxx/include/algorithm libcxx/include/bitset libcxx/include/chrono libcxx/include/fstream libcxx/include/functional libcxx/include/ios libcxx/include/istream libcxx/include/iterator libcxx/include/locale libcxx/include/memory libcxx/include/regex libcxx/include/sstream libcxx/include/streambuf libcxx/include/string libcxx/include/strstream libcxx/include/system_error libcxx/include/valarray 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 @@ -27,7 +27,7 @@ if (size == 0) size = 1; void* p; -while ((p = ::malloc(size)) == 0) +while ((p = ::malloc(size)) == nullptr) { // If malloc fails and there is a new_handler, // call it to try free up memory. @@ -48,7 +48,7 @@ void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { @@ -74,7 +74,7 @@ void* operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { @@ -170,7 +170,7 @@ void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { @@ -196,7 +196,7 @@ void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { Index: libcxx/src/new.cpp === --- libcxx/src/new.cpp +++ libcxx/src/new.cpp @@ -64,7 +64,7 @@ if (size == 0) size = 1; void* p; -while ((p = ::malloc(size)) == 0) +while ((p = ::malloc(size)) == nullptr) { // If malloc fails and there is a new_handler, // call it to try free up memory. @@ -85,7 +85,7 @@ void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -111,7 +111,7 @@ void* operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -207,7 +207,7 @@ void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -233,7 +233,7 @@ void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { Index: libcxx/include/valarray === --- libcxx/include/valarray +++ libcxx/include/valarray @@ -802,7 +802,7 @@ public: // construct/destroy: _LIBCPP_INLINE_VISIBILITY -valarray() : __begin_(0), __end_(0) {} +valarray() : __begin_(nullptr), __end_(nullptr) {} inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit valarray(size_t __n); _LIBCPP_INLINE_VISIBILITY @@ -2750,8 +2750,8 @@ template inline valarray<_Tp>::valarray(size_t __n) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { if (__n) { @@ -2776,16 +2776,16 @@ template inline valarray<_Tp>::valarray(const value_type& __x, size_t __n) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { resize(__n, __x); } template valarray<_Tp>::valarray(const value_type* __p, size_t __n) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { if (__n) { @@ -2809,8 +2809,8 @@ template valarray<_Tp>::valarray(const valarray& __v) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { if (__v.size()) { @@ -2845,8 +2845,8 @@ template valarray<_Tp>::valarray(initializer_list __il) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { const size_t __n = __il.size(); if (__n) @@ -2874,8 +2874,8 @@ template valarray<_Tp>::valarray(const slice_array& __sa) -
[PATCH] D43159: [libc++] Replace several uses of 0 by nullptr
curdeius accepted this revision. curdeius added a comment. LGTM! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D43159/new/ https://reviews.llvm.org/D43159 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43159: [libc++] Replace several uses of 0 by nullptr
ldionne updated this revision to Diff 307888. ldionne marked 3 inline comments as done. ldionne added a comment. Apply review comments. Thanks for the catches! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D43159/new/ https://reviews.llvm.org/D43159 Files: libcxx/include/__locale libcxx/include/__sso_allocator libcxx/include/__string libcxx/include/__threading_support libcxx/include/algorithm libcxx/include/bitset libcxx/include/chrono libcxx/include/fstream libcxx/include/functional libcxx/include/ios libcxx/include/istream libcxx/include/iterator libcxx/include/locale libcxx/include/memory libcxx/include/regex libcxx/include/sstream libcxx/include/streambuf libcxx/include/string libcxx/include/strstream libcxx/include/system_error libcxx/include/valarray 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 @@ -27,7 +27,7 @@ if (size == 0) size = 1; void* p; -while ((p = ::malloc(size)) == 0) +while ((p = ::malloc(size)) == nullptr) { // If malloc fails and there is a new_handler, // call it to try free up memory. @@ -48,7 +48,7 @@ void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { @@ -74,7 +74,7 @@ void* operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { @@ -170,7 +170,7 @@ void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { @@ -196,7 +196,7 @@ void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { Index: libcxx/src/new.cpp === --- libcxx/src/new.cpp +++ libcxx/src/new.cpp @@ -64,7 +64,7 @@ if (size == 0) size = 1; void* p; -while ((p = ::malloc(size)) == 0) +while ((p = ::malloc(size)) == nullptr) { // If malloc fails and there is a new_handler, // call it to try free up memory. @@ -85,7 +85,7 @@ void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -111,7 +111,7 @@ void* operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -207,7 +207,7 @@ void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -233,7 +233,7 @@ void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { Index: libcxx/include/valarray === --- libcxx/include/valarray +++ libcxx/include/valarray @@ -802,7 +802,7 @@ public: // construct/destroy: _LIBCPP_INLINE_VISIBILITY -valarray() : __begin_(0), __end_(0) {} +valarray() : __begin_(nullptr), __end_(nullptr) {} inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit valarray(size_t __n); _LIBCPP_INLINE_VISIBILITY @@ -2750,8 +2750,8 @@ template inline valarray<_Tp>::valarray(size_t __n) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { if (__n) { @@ -2776,16 +2776,16 @@ template inline valarray<_Tp>::valarray(const value_type& __x, size_t __n) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { resize(__n, __x); } template valarray<_Tp>::valarray(const value_type* __p, size_t __n) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { if (__n) { @@ -2809,8 +2809,8 @@ template valarray<_Tp>::valarray(const valarray& __v) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { if (__v.size()) { @@ -2845,8 +2845,8 @@ template valarray<_Tp>::valarray(initializer_list __il) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { const size_t __n = __il.size(); if (__n) @@ -2874,8 +2874,8 @@ template valarray<_Tp>::valarray(const slice_array& __sa) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { const size_t __n = __sa.__s
[PATCH] D43159: [libc++] Replace several uses of 0 by nullptr
curdeius added inline comments. Comment at: libcxx/include/functional:1759 typedef __base<_Rp(_ArgTypes...)> __func; __func* __f_; All uses of `__f_` should also use `nullptr`. If my search counted correctly, there are 15 of them in `__value_func`. Comment at: libcxx/include/locale:4335 { wbuffer_convert* __rt = 0; if (__cv_ != 0 && __bufptr_ != 0) You missed this one. Comment at: libcxx/include/locale:4340 if ((__cm_ & ios_base::out) && sync()) __rt = 0; } And here. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D43159/new/ https://reviews.llvm.org/D43159 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43159: [libc++] Replace several uses of 0 by nullptr
curdeius added inline comments. Comment at: libcxx/include/memory:4371 bool expired() const _NOEXCEPT -{return __cntrl_ == 0 || __cntrl_->use_count() == 0;} +{return __cntrl_ == nullptr || __cntrl_->use_count() == nullptr;} shared_ptr<_Tp> lock() const _NOEXCEPT; Unneeded chang for `use_count()`. It's a `long`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D43159/new/ https://reviews.llvm.org/D43159 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43159: [libc++] Replace several uses of 0 by nullptr
ldionne accepted this revision. ldionne added a comment. I'll ship this if CI passes, since I addressed all comments we had originally. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D43159/new/ https://reviews.llvm.org/D43159 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43159: [libc++] Replace several uses of 0 by nullptr
ldionne updated this revision to Diff 307402. ldionne added a comment. Herald added a project: libc++abi. Herald added a reviewer: libc++abi. Address review comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D43159/new/ https://reviews.llvm.org/D43159 Files: libcxx/include/__locale libcxx/include/__sso_allocator libcxx/include/__string libcxx/include/__threading_support libcxx/include/algorithm libcxx/include/bitset libcxx/include/chrono libcxx/include/fstream libcxx/include/functional libcxx/include/ios libcxx/include/istream libcxx/include/iterator libcxx/include/locale libcxx/include/memory libcxx/include/regex libcxx/include/sstream libcxx/include/streambuf libcxx/include/string libcxx/include/strstream libcxx/include/system_error libcxx/include/valarray 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 @@ -27,7 +27,7 @@ if (size == 0) size = 1; void* p; -while ((p = ::malloc(size)) == 0) +while ((p = ::malloc(size)) == nullptr) { // If malloc fails and there is a new_handler, // call it to try free up memory. @@ -48,7 +48,7 @@ void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { @@ -74,7 +74,7 @@ void* operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { @@ -170,7 +170,7 @@ void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { @@ -196,7 +196,7 @@ void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCXXABI_NO_EXCEPTIONS try { Index: libcxx/src/new.cpp === --- libcxx/src/new.cpp +++ libcxx/src/new.cpp @@ -64,7 +64,7 @@ if (size == 0) size = 1; void* p; -while ((p = ::malloc(size)) == 0) +while ((p = ::malloc(size)) == nullptr) { // If malloc fails and there is a new_handler, // call it to try free up memory. @@ -85,7 +85,7 @@ void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -111,7 +111,7 @@ void* operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -207,7 +207,7 @@ void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -233,7 +233,7 @@ void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { -void* p = 0; +void* p = nullptr; #ifndef _LIBCPP_NO_EXCEPTIONS try { Index: libcxx/include/valarray === --- libcxx/include/valarray +++ libcxx/include/valarray @@ -802,7 +802,7 @@ public: // construct/destroy: _LIBCPP_INLINE_VISIBILITY -valarray() : __begin_(0), __end_(0) {} +valarray() : __begin_(nullptr), __end_(nullptr) {} inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit valarray(size_t __n); _LIBCPP_INLINE_VISIBILITY @@ -2750,8 +2750,8 @@ template inline valarray<_Tp>::valarray(size_t __n) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { if (__n) { @@ -2776,16 +2776,16 @@ template inline valarray<_Tp>::valarray(const value_type& __x, size_t __n) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { resize(__n, __x); } template valarray<_Tp>::valarray(const value_type* __p, size_t __n) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { if (__n) { @@ -2809,8 +2809,8 @@ template valarray<_Tp>::valarray(const valarray& __v) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { if (__v.size()) { @@ -2845,8 +2845,8 @@ template valarray<_Tp>::valarray(initializer_list __il) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { const size_t __n = __il.size(); if (__n) @@ -2874,8 +2874,8 @@ template valarray<_Tp>::valarray(const slice_array& __sa) -: __begin_(0), - __end_(0) +: __begin_(nullptr), + __end_(nullptr) { const size_t __n = _