[libcxx-commits] [libcxx] 0b10bb7 - [libc++] Move <__sso_allocator> out of include/ into src/. NFCI.

Arthur O'Dwyer via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 5 13:23:40 PDT 2021


Author: Arthur O'Dwyer
Date: 2021-05-05T16:20:52-04:00
New Revision: 0b10bb7ddd3c92465ef12d52e88614e6b4c5ef27

URL: https://github.com/llvm/llvm-project/commit/0b10bb7ddd3c92465ef12d52e88614e6b4c5ef27
DIFF: https://github.com/llvm/llvm-project/commit/0b10bb7ddd3c92465ef12d52e88614e6b4c5ef27.diff

LOG: [libc++] Move <__sso_allocator> out of include/ into src/. NFCI.

This allocator is not intended for libc++'s users to use;
it's strictly an implementation detail of `src/locale.cpp`.
So, move it to the `src/include/` directory.

Drive-by const-qualify its comparison operators.

For consistency with `__hidden_allocator` (defined in `src/thread.cpp`),
do *not* remove it from "libcxx/lib/libc++unexp.exp",
"libcxx/utils/symcheck-blacklists/linux_blacklist.txt", etc.

Differential Revision: https://reviews.llvm.org/D101293

Added: 
    libcxx/src/include/sso_allocator.h

Modified: 
    libcxx/include/CMakeLists.txt
    libcxx/include/module.modulemap
    libcxx/src/CMakeLists.txt
    libcxx/src/locale.cpp

Removed: 
    libcxx/include/__sso_allocator


################################################################################
diff  --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index bc8ed907084af..9648d980a0320 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -41,7 +41,6 @@ set(files
   __ranges/view.h
   __ranges/size.h
   __split_buffer
-  __sso_allocator
   __std_stream
   __string
   __threading_support

diff  --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index f1f2410f7dc07..8f023942c042f 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -542,7 +542,6 @@ module std [system] {
   module __locale { header "__locale" export * }
   module __mutex_base { header "__mutex_base" export * }
   module __split_buffer { header "__split_buffer" export * }
-  module __sso_allocator { header "__sso_allocator" export * }
   module __std_stream { header "__std_stream" export * }
   module __string { header "__string" export * }
   module __tree { header "__tree" export * }

diff  --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 7568b391bbbaa..87b71f7ba334b 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -64,6 +64,7 @@ endif()
 
 if (LIBCXX_ENABLE_LOCALIZATION)
   list(APPEND LIBCXX_SOURCES
+    include/sso_allocator.h
     ios.cpp
     ios.instantiations.cpp
     iostream.cpp

diff  --git a/libcxx/include/__sso_allocator b/libcxx/src/include/sso_allocator.h
similarity index 89%
rename from libcxx/include/__sso_allocator
rename to libcxx/src/include/sso_allocator.h
index ed993372bc49e..2baf599c5c242 100644
--- a/libcxx/include/__sso_allocator
+++ b/libcxx/src/include/sso_allocator.h
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef _LIBCPP___SSO_ALLOCATOR
-#define _LIBCPP___SSO_ALLOCATOR
+#ifndef _LIBCPP_SSO_ALLOCATOR_H
+#define _LIBCPP_SSO_ALLOCATOR_H
 
 #include <__config>
 #include <memory>
@@ -67,11 +67,11 @@ class _LIBCPP_HIDDEN __sso_allocator
     _LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
 
     _LIBCPP_INLINE_VISIBILITY
-    bool operator==(__sso_allocator& __a) const {return &buf_ == &__a.buf_;}
+    bool operator==(const __sso_allocator& __a) const {return &buf_ == &__a.buf_;}
     _LIBCPP_INLINE_VISIBILITY
-    bool operator!=(__sso_allocator& __a) const {return &buf_ != &__a.buf_;}
+    bool operator!=(const __sso_allocator& __a) const {return &buf_ != &__a.buf_;}
 };
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // _LIBCPP___SSO_ALLOCATOR
+#endif // _LIBCPP_SSO_ALLOCATOR_H

diff  --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index bb28e1ff498e4..e352a3462d0e4 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -27,7 +27,6 @@
 #define _CTYPE_DISABLE_MACROS
 #endif
 #include "cwctype"
-#include "__sso_allocator"
 #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
 #include "__support/win32/locale_win32.h"
 #elif !defined(__BIONIC__) && !defined(__NuttX__)
@@ -36,6 +35,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include "include/atomic_support.h"
+#include "include/sso_allocator.h"
 #include "__undef_macros"
 
 // On Linux, wint_t and wchar_t have 
diff erent signed-ness, and this causes


        


More information about the libcxx-commits mailing list