From a562853a511b078912f3a9fccb4a27220ce75e9e Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 29 Jun 2021 13:52:26 -0400 Subject: [PATCH] [libc++] NFC: Fix return-by-const-value and pass-by-const-value typos While we can debate on the value of passing by const value, there is no arguing that it's confusing to do so in some circumstances, such as when marking a pointer parameter as being const (did you mean a pointer-to-const?). This commit fixes a few issues along those lines. --- libcxx/include/vector | 2 +- libcxx/src/string.cpp | 2 +- .../associative/map/map.cons/copy_assign.pass.cpp | 8 ++++---- .../string.view.find/find_last_not_of_char_size.pass.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libcxx/include/vector b/libcxx/include/vector index 69babd04f7e6..52ddd45ffa86 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -144,7 +144,7 @@ public: public: reference(const reference&) noexcept; operator bool() const noexcept; - reference& operator=(const bool x) noexcept; + reference& operator=(bool x) noexcept; reference& operator=(const reference& x) noexcept; iterator operator&() const noexcept; void flip() noexcept; diff --git a/libcxx/src/string.cpp b/libcxx/src/string.cpp index 63b81d67049d..97a773f79a3b 100644 --- a/libcxx/src/string.cpp +++ b/libcxx/src/string.cpp @@ -423,7 +423,7 @@ get_swprintf() } template -S i_to_string(const V v) +S i_to_string(V v) { // numeric_limits::digits10 returns value less on 1 than desired for unsigned numbers. // For example, for 1-byte unsigned value digits10 is 2 (999 can not be represented), diff --git a/libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp index 50b44446d117..bcae4b462a3c 100644 --- a/libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp +++ b/libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp @@ -40,12 +40,12 @@ public: template bool operator==(const counting_allocatorT& other) const noexcept { return foo == other.foo; } template bool operator!=(const counting_allocatorT& other) const noexcept { return foo != other.foo; } - T * allocate(const size_t n) const { + T* allocate(size_t n) const { ca_allocs.push_back(foo); void * const pv = ::malloc(n * sizeof(T)); return static_cast(pv); } - void deallocate(T * const p, size_t) const noexcept { + void deallocate(T* p, size_t) const noexcept { ca_deallocs.push_back(foo); free(p); } @@ -63,12 +63,12 @@ public: template bool operator==(const counting_allocatorF& other) const noexcept { return foo == other.foo; } template bool operator!=(const counting_allocatorF& other) const noexcept { return foo != other.foo; } - T * allocate(const size_t n) const { + T* allocate(size_t n) const { ca_allocs.push_back(foo); void * const pv = ::malloc(n * sizeof(T)); return static_cast(pv); } - void deallocate(T * const p, size_t) const noexcept { + void deallocate(T* p, size_t) const noexcept { ca_deallocs.push_back(foo); free(p); } diff --git a/libcxx/test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp b/libcxx/test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp index d2cf8d5d94f9..798c899e80f2 100644 --- a/libcxx/test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp +++ b/libcxx/test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp @@ -8,7 +8,7 @@ // -// const size_type find_last_not_of(charT c, size_type pos = npos) const; +// size_type find_last_not_of(charT c, size_type pos = npos) const; #include #include