[libcxx-commits] [PATCH] D65667: [libcxx] Avoid destructor call for error_category singletons

Chris Bowler via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 29 10:09:26 PDT 2022


cebowleratibm updated this revision to Diff 418912.
cebowleratibm added a comment.
Herald added a reviewer: libc++.

I updated the patch to use the previous union pattern to bypass the singleton destructors but added constinit, constexpr and __attribute__((__no_destroy__)) as possible to avoid the runtime overhead of using a static local.

Note I had to introduce some new macros in __config to guard application of constinit and constexpr because one of the base classes error_category does not provide a constexpr constructor according to:

  #if defined(_LIBCPP_BUILDING_LIBRARY) && \
      defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
      error_category() _NOEXCEPT;
  ...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65667

Files:
  libcxx/include/__config
  libcxx/src/future.cpp
  libcxx/src/ios.cpp
  libcxx/src/system_error.cpp
  libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
  libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
  libcxx/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/iostream_category.pass.cpp
  libcxx/test/std/thread/futures/futures.errors/future_category.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65667.418912.patch
Type: text/x-patch
Size: 7224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220329/aeb63acc/attachment.bin>


More information about the libcxx-commits mailing list