[libcxx-commits] [PATCH] D157058: [libc++] Remove generic char_traits implementation

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 10 01:08:58 PDT 2023


mstorsjo added a comment.

It seems like this change broke building LLDB:

  In file included from /home/martin/code/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:17:
  In file included from /home/martin/clang-nightly/aarch64-w64-mingw32/include/c++/v1/thread:92:
  In file included from /home/martin/clang-nightly/aarch64-w64-mingw32/include/c++/v1/__thread/formatter.h:18:
  In file included from /home/martin/clang-nightly/aarch64-w64-mingw32/include/c++/v1/__format/formatter_integral.h:21:
  In file included from /home/martin/clang-nightly/aarch64-w64-mingw32/include/c++/v1/__format/formatter_output.h:22:
  In file included from /home/martin/clang-nightly/aarch64-w64-mingw32/include/c++/v1/__format/parser_std_format_spec.h:39:
  /home/martin/clang-nightly/aarch64-w64-mingw32/include/c++/v1/string:723:46: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
    723 |     static_assert(( is_same<_CharT, typename traits_type::char_type>::value), 
        |                                              ^
  /home/martin/code/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:634:34: note: in instantiation of template class 'std::basic_string<unsigned char>' requested here
    634 |       std::basic_string<uint8_t> zeros(reg_info.byte_size, '\0');
        |                                  ^
  /home/martin/clang-nightly/aarch64-w64-mingw32/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
     23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
        |                             ^

In this case, it seems like the fix is quite trivial:

  diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  index 4efc454967a1..f9d95fc5d2a6 100644
  --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  @@ -631,7 +631,7 @@ static void WriteRegisterValueInHexFixedWidth(
     } else {
       // Zero-out any unreadable values.
       if (reg_info.byte_size > 0) {
  -      std::basic_string<uint8_t> zeros(reg_info.byte_size, '\0');
  +      std::vector<uint8_t> zeros(reg_info.byte_size, '\0');
         AppendHexValue(response, zeros.data(), zeros.size(), false);
       }
     }



================
Comment at: libcxx/include/__string/char_traits.h:79
-template <class _CharT>
-struct _LIBCPP_DEPRECATED_("char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it.")
-    char_traits
----------------
FWIW, I've never seen this deprecation message in earlier builds of lldb - I rechecked old build logs, and this wasn't ever printed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157058



More information about the libcxx-commits mailing list