[PATCH] D43159: Modernize: Use nullptr more.

2019-07-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem added a comment.

In addition to my previous explanation for the concerns about using `nullptr` 
more ... it should be noted that many of these files already use `nullptr`.


Repository:
  rCXX libc++

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: Modernize: Use nullptr more.

2019-07-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem updated this revision to Diff 207356.
brucem added a comment.

Updating to current master.


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D43159

Files:
  include/__locale
  include/__sso_allocator
  include/__string
  include/__threading_support
  include/algorithm
  include/bitset
  include/chrono
  include/fstream
  include/functional
  include/ios
  include/istream
  include/iterator
  include/locale
  include/memory
  include/regex
  include/sstream
  include/streambuf
  include/string
  include/strstream
  include/system_error
  include/valarray
  src/new.cpp

Index: src/new.cpp
===
--- src/new.cpp
+++ 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
 {
@@ -206,7 +206,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
 {
@@ -232,7 +232,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: include/valarray
===
--- include/valarray
+++ 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
@@ -2764,8 +2764,8 @@
 template 
 inline
 valarray<_Tp>::valarray(size_t __n)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 if (__n)
 {
@@ -2791,16 +2791,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)
 {
@@ -2825,8 +2825,8 @@
 
 template 
 valarray<_Tp>::valarray(const valarray& __v)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 if (__v.size())
 {
@@ -2862,8 +2862,8 @@
 
 template 
 valarray<_Tp>::valarray(initializer_list __il)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 const size_t __n = __il.size();
 if (__n)
@@ -2892,8 +2892,8 @@
 
 template 
 valarray<_Tp>::valarray(const slice_array& __sa)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 const size_t __n = __sa.__size_;
 if (__n)
@@ -2920,8 +2920,8 @@
 
 template 
 valarray<_Tp>::valarray(const gslice_array& __ga)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 const size_t __n = __ga.__1d_.size();
 if (__n)
@@ -2950,8 +2950,8 @@
 
 template 
 valarray<_Tp>::valarray(const mask_array& __ma)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 const size_t __n = __ma.__1d_.size();
 if (__n)
@@ -2980,8 +2980,8 @@
 
 template 
 valarray<_Tp>::valarray(const indirect_array& __ia)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 const size_t __n = __ia.__1d_.size();
 if (__n)
Index: include/system_error
===
--- include/system_error
+++ include/system_error
@@ -253,7 +253,7 @@
 template 
 _LIBCPP_INLINE_VISIBILITY
 error_condition(_Ep __e,
-  typename enable_if::value>::type* = 0
+  typename enable_if::value>::type* = nullptr
  ) _NOEXCEPT
 {*this = make_error_condition(__e);}
 
@@ -325,7 +325,7 @@
 template 
 _LIBCPP_INLINE_VISIBILITY
 error_code(_Ep __e,
-   typename enable_if::value>::type* = 0
+   typename enable_if::value>::type* = nullptr
  ) _NOEXCEPT
 {*this = 

[PATCH] D43226: __threading_support: Remove (void) in favor of ().

2019-07-01 Thread Bruce Mitchener via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL364799: __threading_support: Remove (void) in favor of (). 
(authored by brucem, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D43226

Files:
  libcxx/trunk/include/__threading_support


Index: libcxx/trunk/include/__threading_support
===
--- libcxx/trunk/include/__threading_support
+++ libcxx/trunk/include/__threading_support
@@ -158,7 +158,7 @@
 // Execute once
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-  void (*init_routine)(void));
+  void (*init_routine)());
 
 // Thread id
 _LIBCPP_THREAD_ABI_VISIBILITY
@@ -301,7 +301,7 @@
 
 // Execute once
 int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-  void (*init_routine)(void)) {
+  void (*init_routine)()) {
   return pthread_once(flag, init_routine);
 }
 


Index: libcxx/trunk/include/__threading_support
===
--- libcxx/trunk/include/__threading_support
+++ libcxx/trunk/include/__threading_support
@@ -158,7 +158,7 @@
 // Execute once
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-  void (*init_routine)(void));
+  void (*init_routine)());
 
 // Thread id
 _LIBCPP_THREAD_ABI_VISIBILITY
@@ -301,7 +301,7 @@
 
 // Execute once
 int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-  void (*init_routine)(void)) {
+  void (*init_routine)()) {
   return pthread_once(flag, init_routine);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62782: Fix -Wdouble-promotion warnings.

2019-07-01 Thread Bruce Mitchener via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL364798: Fix -Wdouble-promotion warnings. (authored by 
brucem, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62782

Files:
  libcxx/trunk/include/limits
  libcxx/trunk/include/utility


Index: libcxx/trunk/include/limits
===
--- libcxx/trunk/include/limits
+++ libcxx/trunk/include/limits
@@ -409,7 +409,7 @@
 static _LIBCPP_CONSTEXPR const bool is_exact = false;
 static _LIBCPP_CONSTEXPR const int  radix = __FLT_RADIX__;
 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() 
_NOEXCEPT {return __LDBL_EPSILON__;}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() 
_NOEXCEPT {return 0.5;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() 
_NOEXCEPT {return 0.5L;}
 
 static _LIBCPP_CONSTEXPR const int  min_exponent = __LDBL_MIN_EXP__;
 static _LIBCPP_CONSTEXPR const int  min_exponent10 = __LDBL_MIN_10_EXP__;
Index: libcxx/trunk/include/utility
===
--- libcxx/trunk/include/utility
+++ libcxx/trunk/include/utility
@@ -1479,7 +1479,7 @@
 size_t operator()(float __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-   if (__v == 0.0)
+   if (__v == 0.0f)
return 0;
 return __scalar_hash::operator()(__v);
 }
@@ -1507,7 +1507,7 @@
 size_t operator()(long double __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-if (__v == 0.0)
+if (__v == 0.0L)
 return 0;
 #if defined(__i386__)
 // Zero out padding bits


Index: libcxx/trunk/include/limits
===
--- libcxx/trunk/include/limits
+++ libcxx/trunk/include/limits
@@ -409,7 +409,7 @@
 static _LIBCPP_CONSTEXPR const bool is_exact = false;
 static _LIBCPP_CONSTEXPR const int  radix = __FLT_RADIX__;
 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5L;}
 
 static _LIBCPP_CONSTEXPR const int  min_exponent = __LDBL_MIN_EXP__;
 static _LIBCPP_CONSTEXPR const int  min_exponent10 = __LDBL_MIN_10_EXP__;
Index: libcxx/trunk/include/utility
===
--- libcxx/trunk/include/utility
+++ libcxx/trunk/include/utility
@@ -1479,7 +1479,7 @@
 size_t operator()(float __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-   if (__v == 0.0)
+   if (__v == 0.0f)
return 0;
 return __scalar_hash::operator()(__v);
 }
@@ -1507,7 +1507,7 @@
 size_t operator()(long double __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-if (__v == 0.0)
+if (__v == 0.0L)
 return 0;
 #if defined(__i386__)
 // Zero out padding bits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62782: Fix -Wdouble-promotion warnings.

2019-06-04 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem added a comment.

I'd modified `CMakeLists.txt` to add `-Wdouble-promotion` and removed this 
line: `-Wno-double-promotion # FIXME: remove me` ...


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D62782



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62782: Fix -Wdouble-promotion warnings.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem created this revision.
brucem added a reviewer: mclow.lists.
Herald added subscribers: ldionne, christof.

Repository:
  rCXX libc++

https://reviews.llvm.org/D62782

Files:
  include/limits
  include/utility


Index: include/utility
===
--- include/utility
+++ include/utility
@@ -1479,7 +1479,7 @@
 size_t operator()(float __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-   if (__v == 0.0)
+   if (__v == 0.0f)
return 0;
 return __scalar_hash::operator()(__v);
 }
@@ -1507,7 +1507,7 @@
 size_t operator()(long double __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-if (__v == 0.0)
+if (__v == 0.0L)
 return 0;
 #if defined(__i386__)
 // Zero out padding bits
Index: include/limits
===
--- include/limits
+++ include/limits
@@ -409,7 +409,7 @@
 static _LIBCPP_CONSTEXPR const bool is_exact = false;
 static _LIBCPP_CONSTEXPR const int  radix = __FLT_RADIX__;
 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() 
_NOEXCEPT {return __LDBL_EPSILON__;}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() 
_NOEXCEPT {return 0.5;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() 
_NOEXCEPT {return 0.5L;}
 
 static _LIBCPP_CONSTEXPR const int  min_exponent = __LDBL_MIN_EXP__;
 static _LIBCPP_CONSTEXPR const int  min_exponent10 = __LDBL_MIN_10_EXP__;


Index: include/utility
===
--- include/utility
+++ include/utility
@@ -1479,7 +1479,7 @@
 size_t operator()(float __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-   if (__v == 0.0)
+   if (__v == 0.0f)
return 0;
 return __scalar_hash::operator()(__v);
 }
@@ -1507,7 +1507,7 @@
 size_t operator()(long double __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-if (__v == 0.0)
+if (__v == 0.0L)
 return 0;
 #if defined(__i386__)
 // Zero out padding bits
Index: include/limits
===
--- include/limits
+++ include/limits
@@ -409,7 +409,7 @@
 static _LIBCPP_CONSTEXPR const bool is_exact = false;
 static _LIBCPP_CONSTEXPR const int  radix = __FLT_RADIX__;
 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5L;}
 
 static _LIBCPP_CONSTEXPR const int  min_exponent = __LDBL_MIN_EXP__;
 static _LIBCPP_CONSTEXPR const int  min_exponent10 = __LDBL_MIN_10_EXP__;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43159: Modernize: Use nullptr more.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem marked an inline comment as done.
brucem added a comment.

In D43159#1526215 , @mclow.lists wrote:

> What was the result of testing with `-std=c++98` and/or `-std=gnu++98` ?
>  The code changes look fine; but as @Ericwf said


It seems to work for me in `-std=c++98` ...

I responded to the point that @Ericwf made before ... the `__nullptr` header is 
included by the wrapper around `stddef.h` ... and these aren't the first / only 
usages of `nullptr` in the headers.


Repository:
  rCXX libc++

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: Modernize: Use nullptr more.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem marked 2 inline comments as done.
brucem added inline comments.



Comment at: include/memory:1259
 template  static __two __test(...);
 template  static char __test(typename _Xp::template 
rebind<_Up>::other* = 0);
 public:

zoecarver wrote:
> This could be `nullptr` too. 
This pointed out a number of things that could be fixed, so did  that and 
updated.


Repository:
  rCXX libc++

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: Modernize: Use nullptr more.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem updated this revision to Diff 202555.
brucem added a comment.

Remove CMakeLists.txt change.


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D43159

Files:
  include/__functional_base
  include/__locale
  include/__sso_allocator
  include/__string
  include/__threading_support
  include/algorithm
  include/bitset
  include/chrono
  include/deque
  include/fstream
  include/functional
  include/ios
  include/istream
  include/iterator
  include/locale
  include/memory
  include/regex
  include/sstream
  include/streambuf
  include/string
  include/strstream
  include/system_error
  include/type_traits
  include/valarray
  src/ios.cpp
  src/locale.cpp
  src/new.cpp
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -84,7 +84,7 @@
 unsigned n;
 int mib[2] = {CTL_HW, HW_NCPU};
 std::size_t s = sizeof(n);
-sysctl(mib, 2, , , 0, 0);
+sysctl(mib, 2, , , nullptr, 0);
 return n;
 #elif defined(_SC_NPROCESSORS_ONLN)
 long result = sysconf(_SC_NPROCESSORS_ONLN);
Index: src/new.cpp
===
--- src/new.cpp
+++ 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
 {
@@ -206,7 +206,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
 {
@@ -232,7 +232,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: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -47,7 +47,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 struct __libcpp_unique_locale {
-  __libcpp_unique_locale(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, 0)) {}
+  __libcpp_unique_locale(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, nullptr)) {}
 
   ~__libcpp_unique_locale() {
 if (__loc_)
@@ -536,7 +536,7 @@
 
 locale::locale(const char* name)
 : __locale_(name ? new __imp(name)
- : (__throw_runtime_error("locale constructed with null"), (__imp*)0))
+ : (__throw_runtime_error("locale constructed with null"), nullptr))
 {
 __locale_->__add_shared();
 }
@@ -549,7 +549,7 @@
 
 locale::locale(const locale& other, const char* name, category c)
 : __locale_(name ? new __imp(*other.__locale_, name, c)
- : (__throw_runtime_error("locale constructed with null"), (__imp*)0))
+ : (__throw_runtime_error("locale constructed with null"), nullptr))
 {
 __locale_->__add_shared();
 }
@@ -664,18 +664,18 @@
 
 collate_byname::collate_byname(const char* n, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, n, 0))
+  __l(newlocale(LC_ALL_MASK, n, nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname"
 " failed to construct for " + string(n));
 }
 
 collate_byname::collate_byname(const string& name, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
+  __l(newlocale(LC_ALL_MASK, name.c_str(), nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname"
 " failed to construct for " + name);
 }
@@ -703,7 +703,7 @@
 collate_byname::do_transform(const char_type* lo, const char_type* hi) const
 {
 const string_type in(lo, hi);
-string_type out(strxfrm_l(0, in.c_str(), 0, __l), char());
+string_type out(strxfrm_l(nullptr, in.c_str(), 0, __l), char());
 strxfrm_l(const_cast(out.c_str()), in.c_str(), out.size()+1, __l);
 return out;
 }
@@ -712,18 +712,18 @@
 
 collate_byname::collate_byname(const char* n, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, n, 0))
+  __l(newlocale(LC_ALL_MASK, n, nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname(size_t refs)"
 " failed to construct for " + string(n));
 }
 
 collate_byname::collate_byname(const 

[PATCH] D43159: Modernize: Use nullptr more.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem updated this revision to Diff 202554.
brucem added a comment.
Herald added a subscriber: mgorny.

Updated to current master and added more nullptr usage.


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D43159

Files:
  CMakeLists.txt
  include/__functional_base
  include/__locale
  include/__sso_allocator
  include/__string
  include/__threading_support
  include/algorithm
  include/bitset
  include/chrono
  include/deque
  include/fstream
  include/functional
  include/ios
  include/istream
  include/iterator
  include/locale
  include/memory
  include/regex
  include/sstream
  include/streambuf
  include/string
  include/strstream
  include/system_error
  include/type_traits
  include/valarray
  src/ios.cpp
  src/locale.cpp
  src/new.cpp
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -84,7 +84,7 @@
 unsigned n;
 int mib[2] = {CTL_HW, HW_NCPU};
 std::size_t s = sizeof(n);
-sysctl(mib, 2, , , 0, 0);
+sysctl(mib, 2, , , nullptr, 0);
 return n;
 #elif defined(_SC_NPROCESSORS_ONLN)
 long result = sysconf(_SC_NPROCESSORS_ONLN);
Index: src/new.cpp
===
--- src/new.cpp
+++ 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
 {
@@ -206,7 +206,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
 {
@@ -232,7 +232,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: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -47,7 +47,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 struct __libcpp_unique_locale {
-  __libcpp_unique_locale(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, 0)) {}
+  __libcpp_unique_locale(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, nullptr)) {}
 
   ~__libcpp_unique_locale() {
 if (__loc_)
@@ -536,7 +536,7 @@
 
 locale::locale(const char* name)
 : __locale_(name ? new __imp(name)
- : (__throw_runtime_error("locale constructed with null"), (__imp*)0))
+ : (__throw_runtime_error("locale constructed with null"), nullptr))
 {
 __locale_->__add_shared();
 }
@@ -549,7 +549,7 @@
 
 locale::locale(const locale& other, const char* name, category c)
 : __locale_(name ? new __imp(*other.__locale_, name, c)
- : (__throw_runtime_error("locale constructed with null"), (__imp*)0))
+ : (__throw_runtime_error("locale constructed with null"), nullptr))
 {
 __locale_->__add_shared();
 }
@@ -664,18 +664,18 @@
 
 collate_byname::collate_byname(const char* n, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, n, 0))
+  __l(newlocale(LC_ALL_MASK, n, nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname"
 " failed to construct for " + string(n));
 }
 
 collate_byname::collate_byname(const string& name, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
+  __l(newlocale(LC_ALL_MASK, name.c_str(), nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname"
 " failed to construct for " + name);
 }
@@ -703,7 +703,7 @@
 collate_byname::do_transform(const char_type* lo, const char_type* hi) const
 {
 const string_type in(lo, hi);
-string_type out(strxfrm_l(0, in.c_str(), 0, __l), char());
+string_type out(strxfrm_l(nullptr, in.c_str(), 0, __l), char());
 strxfrm_l(const_cast(out.c_str()), in.c_str(), out.size()+1, __l);
 return out;
 }
@@ -712,18 +712,18 @@
 
 collate_byname::collate_byname(const char* n, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, n, 0))
+  __l(newlocale(LC_ALL_MASK, n, nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname(size_t refs)"
 " 

[PATCH] D43159: Modernize: Use nullptr more.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem added a comment.
Herald added subscribers: libcxx-commits, jfb, ldionne, christof.

Can we revive this review? I'd still like to land this ...


Repository:
  rCXX libc++

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] D43226: __threading_support: Remove (void) in favor of ().

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem added a comment.
Herald added subscribers: libcxx-commits, ldionne.

Can we revive this review? I'd still like to land it ...


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D43226



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43226: __threading_support: Remove (void) in favor of ().

2018-02-15 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem added a comment.

This is `modernize-redundant-void-arg`: 
https://clang.llvm.org/extra/clang-tidy/checks/modernize-redundant-void-arg.html


Repository:
  rCXX libc++

https://reviews.llvm.org/D43226



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43277: limits: Use `false` instead of `type(0)`.

2018-02-15 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem added a comment.
Herald added a subscriber: christof.

Without this, anyone using `clang-tidy` with this check gets 6 system header 
warnings whenever they transitively have included `limits`.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43277



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43277: limits: Use `false` instead of `type(0)`.

2018-02-13 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem created this revision.
brucem added reviewers: mclow.lists, EricWF.

This fixes warnings when using clang-tidy and the
`modernize-use-bool-literals` check.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43277

Files:
  include/limits


Index: include/limits
===
--- include/limits
+++ include/limits
@@ -269,8 +269,8 @@
 static _LIBCPP_CONSTEXPR const bool is_integer = true;
 static _LIBCPP_CONSTEXPR const bool is_exact = true;
 static _LIBCPP_CONSTEXPR const int  radix = 2;
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() 
_NOEXCEPT {return type(0);}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() 
_NOEXCEPT {return type(0);}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() 
_NOEXCEPT {return false;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() 
_NOEXCEPT {return false;}
 
 static _LIBCPP_CONSTEXPR const int  min_exponent = 0;
 static _LIBCPP_CONSTEXPR const int  min_exponent10 = 0;
@@ -282,10 +282,10 @@
 static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
 static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = 
denorm_absent;
 static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() 
_NOEXCEPT {return type(0);}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() 
_NOEXCEPT {return type(0);}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() 
_NOEXCEPT {return type(0);}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() 
_NOEXCEPT {return type(0);}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() 
_NOEXCEPT {return false;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() 
_NOEXCEPT {return false;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() 
_NOEXCEPT {return false;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() 
_NOEXCEPT {return false;}
 
 static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
 static _LIBCPP_CONSTEXPR const bool is_bounded = true;


Index: include/limits
===
--- include/limits
+++ include/limits
@@ -269,8 +269,8 @@
 static _LIBCPP_CONSTEXPR const bool is_integer = true;
 static _LIBCPP_CONSTEXPR const bool is_exact = true;
 static _LIBCPP_CONSTEXPR const int  radix = 2;
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return false;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return false;}
 
 static _LIBCPP_CONSTEXPR const int  min_exponent = 0;
 static _LIBCPP_CONSTEXPR const int  min_exponent10 = 0;
@@ -282,10 +282,10 @@
 static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
 static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
 static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return false;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return false;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return false;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return false;}
 
 static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
 static _LIBCPP_CONSTEXPR const bool is_bounded = true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43167: Fix incorrect indentation.

2018-02-13 Thread Bruce Mitchener via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL325087: Fix incorrect indentation. (authored by brucem, 
committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D43167

Files:
  libcxx/trunk/include/ios


Index: libcxx/trunk/include/ios
===
--- libcxx/trunk/include/ios
+++ libcxx/trunk/include/ios
@@ -670,7 +670,7 @@
 void set_rdbuf(basic_streambuf* __sb);
 private:
 basic_ostream* __tie_;
- mutable int_type __fill_;
+mutable int_type __fill_;
 };
 
 template 


Index: libcxx/trunk/include/ios
===
--- libcxx/trunk/include/ios
+++ libcxx/trunk/include/ios
@@ -670,7 +670,7 @@
 void set_rdbuf(basic_streambuf* __sb);
 private:
 basic_ostream* __tie_;
- mutable int_type __fill_;
+mutable int_type __fill_;
 };
 
 template 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43226: __threading_support: Remove (void) in favor of ().

2018-02-13 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem created this revision.
brucem added reviewers: mclow.lists, EricWF.

This fixes a clang-tidy warning when building something that uses
this file.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43226

Files:
  include/__threading_support


Index: include/__threading_support
===
--- include/__threading_support
+++ include/__threading_support
@@ -160,7 +160,7 @@
 // Execute once
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-  void (*init_routine)(void));
+  void (*init_routine)());
 
 // Thread id
 _LIBCPP_THREAD_ABI_VISIBILITY
@@ -303,7 +303,7 @@
 
 // Execute once
 int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-  void (*init_routine)(void)) {
+  void (*init_routine)()) {
   return pthread_once(flag, init_routine);
 }
 


Index: include/__threading_support
===
--- include/__threading_support
+++ include/__threading_support
@@ -160,7 +160,7 @@
 // Execute once
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-  void (*init_routine)(void));
+  void (*init_routine)());
 
 // Thread id
 _LIBCPP_THREAD_ABI_VISIBILITY
@@ -303,7 +303,7 @@
 
 // Execute once
 int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
-  void (*init_routine)(void)) {
+  void (*init_routine)()) {
   return pthread_once(flag, init_routine);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43167: Fix incorrect indentation.

2018-02-13 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem updated this revision to Diff 134002.
brucem added a comment.

Rebased forward.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43167

Files:
  include/ios


Index: include/ios
===
--- include/ios
+++ include/ios
@@ -670,7 +670,7 @@
 void set_rdbuf(basic_streambuf* __sb);
 private:
 basic_ostream* __tie_;
- mutable int_type __fill_;
+mutable int_type __fill_;
 };
 
 template 


Index: include/ios
===
--- include/ios
+++ include/ios
@@ -670,7 +670,7 @@
 void set_rdbuf(basic_streambuf* __sb);
 private:
 basic_ostream* __tie_;
- mutable int_type __fill_;
+mutable int_type __fill_;
 };
 
 template 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43224: Fix typos.

2018-02-13 Thread Bruce Mitchener via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL324989: Fix typos. (authored by brucem, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D43224

Files:
  libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst
  libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst


Index: libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst
===
--- libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst
+++ libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst
@@ -46,7 +46,7 @@
 
 Otherwise we create a custom installation rule that modifies the installed 
__config
 header. The rule first generates a dummy "__config_site" header containing the 
required
-#defines. The contents of the dummy header are then prependend to the installed
+#defines. The contents of the dummy header are then prepended to the installed
 __config header. By manually prepending the files we avoid the cost of an
 extra #include and we allow the __config header to be ignorant of the extra
 configuration all together. An example "__config" header generated when
Index: libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst
===
--- libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst
+++ libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst
@@ -58,7 +58,7 @@
 Some parameters can be passed to lit to run the test-suite and exercising the
 availability.
 
-* The `platform` parameter controls the deployement target. For example lit can
+* The `platform` parameter controls the deployment target. For example lit can
   be invoked with `--param=platform=macosx10.8`. Default is the current host.
 * The `use_system_cxx_lib` parameter indicates to use another library than the
   just built one. Invoking lit with `--param=use_system_cxx_lib=true` will run


Index: libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst
===
--- libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst
+++ libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst
@@ -46,7 +46,7 @@
 
 Otherwise we create a custom installation rule that modifies the installed __config
 header. The rule first generates a dummy "__config_site" header containing the required
-#defines. The contents of the dummy header are then prependend to the installed
+#defines. The contents of the dummy header are then prepended to the installed
 __config header. By manually prepending the files we avoid the cost of an
 extra #include and we allow the __config header to be ignorant of the extra
 configuration all together. An example "__config" header generated when
Index: libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst
===
--- libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst
+++ libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst
@@ -58,7 +58,7 @@
 Some parameters can be passed to lit to run the test-suite and exercising the
 availability.
 
-* The `platform` parameter controls the deployement target. For example lit can
+* The `platform` parameter controls the deployment target. For example lit can
   be invoked with `--param=platform=macosx10.8`. Default is the current host.
 * The `use_system_cxx_lib` parameter indicates to use another library than the
   just built one. Invoking lit with `--param=use_system_cxx_lib=true` will run
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43224: Fix typos.

2018-02-12 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem created this revision.
brucem added reviewers: mclow.lists, EricWF.

Repository:
  rCXX libc++

https://reviews.llvm.org/D43224

Files:
  docs/DesignDocs/AvailabilityMarkup.rst
  docs/DesignDocs/CapturingConfigInfo.rst


Index: docs/DesignDocs/CapturingConfigInfo.rst
===
--- docs/DesignDocs/CapturingConfigInfo.rst
+++ docs/DesignDocs/CapturingConfigInfo.rst
@@ -46,7 +46,7 @@
 
 Otherwise we create a custom installation rule that modifies the installed 
__config
 header. The rule first generates a dummy "__config_site" header containing the 
required
-#defines. The contents of the dummy header are then prependend to the installed
+#defines. The contents of the dummy header are then prepended to the installed
 __config header. By manually prepending the files we avoid the cost of an
 extra #include and we allow the __config header to be ignorant of the extra
 configuration all together. An example "__config" header generated when
Index: docs/DesignDocs/AvailabilityMarkup.rst
===
--- docs/DesignDocs/AvailabilityMarkup.rst
+++ docs/DesignDocs/AvailabilityMarkup.rst
@@ -58,7 +58,7 @@
 Some parameters can be passed to lit to run the test-suite and exercising the
 availability.
 
-* The `platform` parameter controls the deployement target. For example lit can
+* The `platform` parameter controls the deployment target. For example lit can
   be invoked with `--param=platform=macosx10.8`. Default is the current host.
 * The `use_system_cxx_lib` parameter indicates to use another library than the
   just built one. Invoking lit with `--param=use_system_cxx_lib=true` will run


Index: docs/DesignDocs/CapturingConfigInfo.rst
===
--- docs/DesignDocs/CapturingConfigInfo.rst
+++ docs/DesignDocs/CapturingConfigInfo.rst
@@ -46,7 +46,7 @@
 
 Otherwise we create a custom installation rule that modifies the installed __config
 header. The rule first generates a dummy "__config_site" header containing the required
-#defines. The contents of the dummy header are then prependend to the installed
+#defines. The contents of the dummy header are then prepended to the installed
 __config header. By manually prepending the files we avoid the cost of an
 extra #include and we allow the __config header to be ignorant of the extra
 configuration all together. An example "__config" header generated when
Index: docs/DesignDocs/AvailabilityMarkup.rst
===
--- docs/DesignDocs/AvailabilityMarkup.rst
+++ docs/DesignDocs/AvailabilityMarkup.rst
@@ -58,7 +58,7 @@
 Some parameters can be passed to lit to run the test-suite and exercising the
 availability.
 
-* The `platform` parameter controls the deployement target. For example lit can
+* The `platform` parameter controls the deployment target. For example lit can
   be invoked with `--param=platform=macosx10.8`. Default is the current host.
 * The `use_system_cxx_lib` parameter indicates to use another library than the
   just built one. Invoking lit with `--param=use_system_cxx_lib=true` will run
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43159: Modernize: Use nullptr more.

2018-02-12 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem added a comment.

In https://reviews.llvm.org/D43159#1004617, @jroelofs wrote:

> Is it worth adding `-Werror=zero-as-null-pointer-constant` to the build?


I'll look at this as a follow up.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43159



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43159: Modernize: Use nullptr more.

2018-02-12 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem added a comment.

In https://reviews.llvm.org/D43159#1004639, @dim wrote:

> In https://reviews.llvm.org/D43159#1004625, @EricWF wrote:
>
> > So my main concern with this patch is that `nullptr` is actually  
> > `#defined`'ed in C++03 mode. That definition comes from the `__nullptr` 
> > header, and therefore we would need to add that header to each include 
> > which uses it. Which kind of sucks.
>
>
> Indeed, but isn't `nullptr` used in many headers already?  And as far as I 
> can see, none of those includes <__nullptr> explicitly, so the definition 
> must come from some transitive include.


It is handled in the wrapper around `stddef.h` so it all should just work.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43159



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43159: Modernize: Use nullptr more.

2018-02-12 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem updated this revision to Diff 133996.
brucem added a comment.

Addressed minor issues.

- Addressed missing __end_ initialization from valarray.
- Removed cast that was no longer needed.
- Added nullptr usage to include/regex.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43159

Files:
  include/__locale
  include/__sso_allocator
  include/__string
  include/__threading_support
  include/algorithm
  include/bitset
  include/chrono
  include/fstream
  include/functional
  include/ios
  include/istream
  include/iterator
  include/locale
  include/memory
  include/regex
  include/sstream
  include/streambuf
  include/string
  include/strstream
  include/system_error
  include/valarray
  src/new.cpp

Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -71,7 +71,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.
@@ -92,7 +92,7 @@
 void*
 operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -118,7 +118,7 @@
 void*
 operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -214,7 +214,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
 {
@@ -240,7 +240,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: include/valarray
===
--- include/valarray
+++ include/valarray
@@ -802,7 +802,7 @@
 public:
 // construct/destroy:
 _LIBCPP_INLINE_VISIBILITY
-valarray() : __begin_(0), __end_(0) {}
+valarray() : __begin_(nullptr), __end_(nullptr) {}
 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
 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)
 {
 size_t __n = __il.size();
 if (__n)
@@ -2873,8 +2873,8 @@
 
 template 
 valarray<_Tp>::valarray(const slice_array& __sa)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __sa.__size_;
 if (__n)
@@ -2899,8 +2899,8 @@
 
 template 
 valarray<_Tp>::valarray(const gslice_array& __ga)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __ga.__1d_.size();
 if (__n)
@@ -2928,8 +2928,8 @@
 
 template 
 valarray<_Tp>::valarray(const mask_array& __ma)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __ma.__1d_.size();
 if (__n)
@@ -2957,8 +2957,8 @@
 
 template 
 valarray<_Tp>::valarray(const indirect_array& __ia)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __ia.__1d_.size();
 if (__n)
Index: include/system_error
===
--- include/system_error
+++ include/system_error
@@ -440,7 +440,7 @@
 template 
 _LIBCPP_ALWAYS_INLINE
 error_condition(_Ep __e,
-  typename enable_if::value>::type* = 0
+  typename enable_if::value>::type* = nullptr
  ) _NOEXCEPT
 {*this = make_error_condition(__e);}
 
@@ -512,7 +512,7 @@
 template 
 _LIBCPP_ALWAYS_INLINE
 error_code(_Ep __e,
-   typename enable_if::value>::type* = 0
+   typename 

[PATCH] D43167: Fix incorrect indentation.

2018-02-10 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem created this revision.
brucem added a reviewer: mclow.lists.

Repository:
  rCXX libc++

https://reviews.llvm.org/D43167

Files:
  include/ios


Index: include/ios
===
--- include/ios
+++ include/ios
@@ -670,7 +670,7 @@
 void set_rdbuf(basic_streambuf* __sb);
 private:
 basic_ostream* __tie_;
- mutable int_type __fill_;
+mutable int_type __fill_;
 };
 
 template 


Index: include/ios
===
--- include/ios
+++ include/ios
@@ -670,7 +670,7 @@
 void set_rdbuf(basic_streambuf* __sb);
 private:
 basic_ostream* __tie_;
- mutable int_type __fill_;
+mutable int_type __fill_;
 };
 
 template 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43159: Modernize: Use nullptr more.

2018-02-10 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem updated this revision to Diff 133778.
brucem added a comment.

More nullptr usage.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43159

Files:
  include/__locale
  include/__sso_allocator
  include/__string
  include/__threading_support
  include/algorithm
  include/bitset
  include/chrono
  include/fstream
  include/functional
  include/ios
  include/istream
  include/iterator
  include/locale
  include/memory
  include/sstream
  include/streambuf
  include/string
  include/strstream
  include/system_error
  include/valarray
  src/new.cpp

Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -71,7 +71,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.
@@ -92,7 +92,7 @@
 void*
 operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -118,7 +118,7 @@
 void*
 operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -214,7 +214,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
 {
@@ -240,7 +240,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: include/valarray
===
--- include/valarray
+++ include/valarray
@@ -802,7 +802,7 @@
 public:
 // construct/destroy:
 _LIBCPP_INLINE_VISIBILITY
-valarray() : __begin_(0), __end_(0) {}
+valarray() : __begin_(nullptr), __end_(0) {}
 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
 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)
 {
 size_t __n = __il.size();
 if (__n)
@@ -2873,8 +2873,8 @@
 
 template 
 valarray<_Tp>::valarray(const slice_array& __sa)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __sa.__size_;
 if (__n)
@@ -2899,8 +2899,8 @@
 
 template 
 valarray<_Tp>::valarray(const gslice_array& __ga)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __ga.__1d_.size();
 if (__n)
@@ -2928,8 +2928,8 @@
 
 template 
 valarray<_Tp>::valarray(const mask_array& __ma)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __ma.__1d_.size();
 if (__n)
@@ -2957,8 +2957,8 @@
 
 template 
 valarray<_Tp>::valarray(const indirect_array& __ia)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __ia.__1d_.size();
 if (__n)
Index: include/system_error
===
--- include/system_error
+++ include/system_error
@@ -440,7 +440,7 @@
 template 
 _LIBCPP_ALWAYS_INLINE
 error_condition(_Ep __e,
-  typename enable_if::value>::type* = 0
+  typename enable_if::value>::type* = nullptr
  ) _NOEXCEPT
 {*this = make_error_condition(__e);}
 
@@ -512,7 +512,7 @@
 template 
 _LIBCPP_ALWAYS_INLINE
 error_code(_Ep __e,
-   typename enable_if::value>::type* = 0
+   typename enable_if::value>::type* = nullptr
  ) _NOEXCEPT
 {*this = make_error_code(__e);}
 

[PATCH] D43159: Modernize: Use nullptr more.

2018-02-10 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem created this revision.
brucem added reviewers: mclow.lists, EricWF.

Repository:
  rCXX libc++

https://reviews.llvm.org/D43159

Files:
  include/__locale
  include/__string
  include/__threading_support
  include/algorithm
  include/bitset
  include/chrono
  include/fstream
  include/functional
  include/ios
  include/iterator
  include/locale
  include/memory
  include/sstream
  include/string
  include/system_error

Index: include/system_error
===
--- include/system_error
+++ include/system_error
@@ -512,7 +512,7 @@
 template 
 _LIBCPP_ALWAYS_INLINE
 error_code(_Ep __e,
-   typename enable_if::value>::type* = 0
+   typename enable_if::value>::type* = nullptr
  ) _NOEXCEPT
 {*this = make_error_code(__e);}
 
Index: include/string
===
--- include/string
+++ include/string
@@ -426,15 +426,15 @@
 typedef basic_string u16string;
 typedef basic_string u32string;
 
-intstoi  (const string& str, size_t* idx = 0, int base = 10);
-long   stol  (const string& str, size_t* idx = 0, int base = 10);
-unsigned long  stoul (const string& str, size_t* idx = 0, int base = 10);
-long long  stoll (const string& str, size_t* idx = 0, int base = 10);
-unsigned long long stoull(const string& str, size_t* idx = 0, int base = 10);
+intstoi  (const string& str, size_t* idx = nullptr, int base = 10);
+long   stol  (const string& str, size_t* idx = nullptr, int base = 10);
+unsigned long  stoul (const string& str, size_t* idx = nullptr, int base = 10);
+long long  stoll (const string& str, size_t* idx = nullptr, int base = 10);
+unsigned long long stoull(const string& str, size_t* idx = nullptr, int base = 10);
 
-float   stof (const string& str, size_t* idx = 0);
-double  stod (const string& str, size_t* idx = 0);
-long double stold(const string& str, size_t* idx = 0);
+float   stof (const string& str, size_t* idx = nullptr);
+double  stod (const string& str, size_t* idx = nullptr);
+long double stold(const string& str, size_t* idx = nullptr);
 
 string to_string(int val);
 string to_string(unsigned val);
@@ -446,15 +446,15 @@
 string to_string(double val);
 string to_string(long double val);
 
-intstoi  (const wstring& str, size_t* idx = 0, int base = 10);
-long   stol  (const wstring& str, size_t* idx = 0, int base = 10);
-unsigned long  stoul (const wstring& str, size_t* idx = 0, int base = 10);
-long long  stoll (const wstring& str, size_t* idx = 0, int base = 10);
-unsigned long long stoull(const wstring& str, size_t* idx = 0, int base = 10);
+intstoi  (const wstring& str, size_t* idx = nullptr, int base = 10);
+long   stol  (const wstring& str, size_t* idx = nullptr, int base = 10);
+unsigned long  stoul (const wstring& str, size_t* idx = nullptr, int base = 10);
+long long  stoll (const wstring& str, size_t* idx = nullptr, int base = 10);
+unsigned long long stoull(const wstring& str, size_t* idx = nullptr, int base = 10);
 
-float   stof (const wstring& str, size_t* idx = 0);
-double  stod (const wstring& str, size_t* idx = 0);
-long double stold(const wstring& str, size_t* idx = 0);
+float   stof (const wstring& str, size_t* idx = nullptr);
+double  stod (const wstring& str, size_t* idx = nullptr);
+long double stold(const wstring& str, size_t* idx = nullptr);
 
 wstring to_wstring(int val);
 wstring to_wstring(unsigned val);
@@ -3923,15 +3923,15 @@
 
 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
 
-_LIBCPP_FUNC_VIS intstoi  (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS long   stol  (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS unsigned long  stoul (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS long long  stoll (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS intstoi  (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS long   stol  (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long  stoul (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS long long  stoll (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = nullptr, int __base = 10);
 
-_LIBCPP_FUNC_VIS float   stof (const string& __str, size_t* __idx = 0);
-_LIBCPP_FUNC_VIS 

[PATCH] D42945: [libc++] Fix misleading indentation.

2018-02-05 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem created this revision.
Herald added a reviewer: EricWF.

This was picked up via clang-tidy's readability-misleading-indentation
check.


Repository:
  rCXX libc++

https://reviews.llvm.org/D42945

Files:
  include/__string
  include/algorithm


Index: include/algorithm
===
--- include/algorithm
+++ include/algorithm
@@ -4705,7 +4705,7 @@
 case 2:
__destruct_n __d(0);
 unique_ptr __h2(__first2, __d);
- if (__comp(*--__last1, *__first1))
+if (__comp(*--__last1, *__first1))
 {
 ::new(__first2) value_type(_VSTD::move(*__last1));
 __d.__incr((value_type*)0);
Index: include/__string
===
--- include/__string
+++ include/__string
@@ -374,7 +374,7 @@
 if (__n == 0)
 return NULL;
 #if __has_feature(cxx_constexpr_string_builtins)
-return __builtin_wmemchr(__s, __a, __n);
+return __builtin_wmemchr(__s, __a, __n);
 #elif _LIBCPP_STD_VER <= 14
 return wmemchr(__s, __a, __n);
 #else


Index: include/algorithm
===
--- include/algorithm
+++ include/algorithm
@@ -4705,7 +4705,7 @@
 case 2:
__destruct_n __d(0);
 unique_ptr __h2(__first2, __d);
- if (__comp(*--__last1, *__first1))
+if (__comp(*--__last1, *__first1))
 {
 ::new(__first2) value_type(_VSTD::move(*__last1));
 __d.__incr((value_type*)0);
Index: include/__string
===
--- include/__string
+++ include/__string
@@ -374,7 +374,7 @@
 if (__n == 0)
 return NULL;
 #if __has_feature(cxx_constexpr_string_builtins)
-return __builtin_wmemchr(__s, __a, __n);
+return __builtin_wmemchr(__s, __a, __n);
 #elif _LIBCPP_STD_VER <= 14
 return wmemchr(__s, __a, __n);
 #else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25241: [libcxx] Improve code generation for vector::clear().

2017-03-23 Thread Bruce Mitchener via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL298601: [libcxx] Improve code generation for 
vector::clear(). (authored by brucem).

Changed prior to commit:
  https://reviews.llvm.org/D25241?vs=73790=92796#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25241

Files:
  libcxx/trunk/include/vector
  
libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp


Index: libcxx/trunk/include/vector
===
--- libcxx/trunk/include/vector
+++ libcxx/trunk/include/vector
@@ -413,8 +413,10 @@
 void
 __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT
 {
-while (__new_last != __end_)
-__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_));
+pointer __soon_to_be_end = __end_;
+while (__new_last != __soon_to_be_end)
+__alloc_traits::destroy(__alloc(), 
_VSTD::__to_raw_pointer(--__soon_to_be_end));
+__end_ = __new_last;
 }
 
 template 
Index: 
libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
===
--- 
libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
+++ 
libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
@@ -0,0 +1,40 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// void clear();
+
+#include 
+#include 
+
+#include "min_allocator.h"
+#include "asan_testing.h"
+
+int main()
+{
+{
+int a[] = {1, 2, 3};
+std::vector c(a, a+3);
+c.clear();
+assert(c.empty());
+LIBCPP_ASSERT(c.__invariants());
+LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+}
+#if TEST_STD_VER >= 11
+{
+int a[] = {1, 2, 3};
+std::vector c(a, a+3);
+c.clear();
+assert(c.empty());
+LIBCPP_ASSERT(c.__invariants());
+LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+}
+#endif
+}


Index: libcxx/trunk/include/vector
===
--- libcxx/trunk/include/vector
+++ libcxx/trunk/include/vector
@@ -413,8 +413,10 @@
 void
 __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT
 {
-while (__new_last != __end_)
-__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_));
+pointer __soon_to_be_end = __end_;
+while (__new_last != __soon_to_be_end)
+__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end));
+__end_ = __new_last;
 }
 
 template 
Index: libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
===
--- libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
+++ libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
@@ -0,0 +1,40 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// void clear();
+
+#include 
+#include 
+
+#include "min_allocator.h"
+#include "asan_testing.h"
+
+int main()
+{
+{
+int a[] = {1, 2, 3};
+std::vector c(a, a+3);
+c.clear();
+assert(c.empty());
+LIBCPP_ASSERT(c.__invariants());
+LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+}
+#if TEST_STD_VER >= 11
+{
+int a[] = {1, 2, 3};
+std::vector c(a, a+3);
+c.clear();
+assert(c.empty());
+LIBCPP_ASSERT(c.__invariants());
+LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
+}
+#endif
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25241: [libcxx] Improve code generation for vector::clear().

2017-03-23 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem added a comment.

This was accepted long ago, and then I got sidetracked for a while. Is this 
still okay to land?


https://reviews.llvm.org/D25241



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits