[all-commits] [llvm/llvm-project] fbdf68: [libc++] Avoid destructor call for error_category ...
Chris Bowler via All-commits
all-commits at lists.llvm.org
Tue Sep 5 10:45:14 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: fbdf684fae5243e7a9ff50dd4abdc5b55e6aa895
https://github.com/llvm/llvm-project/commit/fbdf684fae5243e7a9ff50dd4abdc5b55e6aa895
Author: Chris Bowler <cebowleratibm at gmail.com>
Date: 2023-09-05 (Tue, 05 Sep 2023)
Changed paths:
M libcxx/src/CMakeLists.txt
A libcxx/src/error_category.cpp
M libcxx/src/future.cpp
M libcxx/src/ios.cpp
M libcxx/src/system_error.cpp
M libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
M libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
M libcxx/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/iostream_category.pass.cpp
M libcxx/test/std/thread/futures/futures.errors/future_category.pass.cpp
Log Message:
-----------
[libc++] Avoid destructor call for error_category singletons
When a handle to an error_category singleton object is used during the
termination phase of a program, the destruction of the error_category
object may have occurred prior to execution of the current destructor
or function registered with atexit, because the singleton object may
have been constructed after the corresponding initialization or call
to atexit. For example, the updated tests from this patch will fail if
using a libc++ built using a compiler that updates the vtable of the
object on destruction.
This patch attempts to avoid the issue by causing the destructor to not
be called in the style of ResourceInitHelper in src/experimental/memory_resource.cpp.
This approach might not work if object lifetime is strictly enforced.
Differential Revision: https://reviews.llvm.org/D65667
Co-authored-by: Louis Dionne <ldionne.2 at gmail.com>
More information about the All-commits
mailing list