Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
528d7a2
Add C++23 stacktrace
elsteveogrande Jan 16, 2025
979441d
Address formatting and other issues
elsteveogrande Jul 9, 2025
2156560
update headers and modules
elsteveogrande Jul 9, 2025
64a0af4
Break up large linux impl
elsteveogrande Jul 9, 2025
562f700
Exclude stacktrace headers if C++ < 23
elsteveogrande Jul 9, 2025
e4885c4
Use proper header format/layout
elsteveogrande Jul 10, 2025
3526a3a
Test for 'noexcept' (and related fixes)
elsteveogrande Jul 10, 2025
f2439c9
drop 'debug'; fix windows
elsteveogrande Jul 15, 2025
339c65d
Avoid throwing exceptions for -fno-exceptions builds
elsteveogrande Jul 16, 2025
9489ab7
Disable only-uses-allocator test for *-SAN's
elsteveogrande Jul 16, 2025
41c6c65
Fix usage: 'optional.has_value'
elsteveogrande Jul 16, 2025
b1e4a80
Fix ABI lists
elsteveogrande Jul 17, 2025
c9fd1f5
Hardened 'basic_stacktrace::current' (p3697r0)
elsteveogrande Jul 17, 2025
52dd57c
Fix bugs in st_entry, and in tests
elsteveogrande Jul 17, 2025
5c20b62
Update ABI list
elsteveogrande Jul 19, 2025
0185ed1
Fix ctors
elsteveogrande Jul 19, 2025
d64984f
Rework allocation using the caller's allocator
elsteveogrande Jul 19, 2025
e71ff7a
Misc fixes so things build
elsteveogrande Aug 7, 2025
9544b13
Fix release notes
elsteveogrande Aug 13, 2025
bdcb282
Fix ABI list
elsteveogrande Aug 13, 2025
81ba9b1
Fix ABI symbols
elsteveogrande Aug 13, 2025
bf2cfe8
Fixing windows impl
elsteveogrande Aug 13, 2025
1a36da5
Improved str allocation
elsteveogrande Aug 15, 2025
e71b1d5
Comment out some asserts for now, addr2line not working in CI
elsteveogrande Aug 19, 2025
ddcc193
Fix transitive includes
elsteveogrande Aug 19, 2025
775ae37
Fixes: MSAN, hardening-debug
elsteveogrande Aug 19, 2025
7b2fc6c
rethinking (again) strings and vectors and allocators
elsteveogrande Aug 20, 2025
e0d2736
Rethink string allocation
elsteveogrande Aug 25, 2025
aebf1e0
Fix several abilists
elsteveogrande Aug 26, 2025
b376d8f
Fix comparison
elsteveogrande Aug 27, 2025
c0670d3
Remove 'libcxxabi.v2.unstable', don't introduce that in this PR
elsteveogrande Aug 27, 2025
fd37e3f
Undo unneeded change
elsteveogrande Aug 27, 2025
12ed9d5
Remove external tool code
elsteveogrande Aug 30, 2025
ae3d3cf
Fix localization test
elsteveogrande Aug 30, 2025
fec40ae
Attempt fixing windows impl
elsteveogrande Aug 30, 2025
3698e56
abi-hide a bunch of functions; fixing Windows impl
elsteveogrande Aug 30, 2025
6440081
Fix ABI files
elsteveogrande Aug 31, 2025
179091d
Fix ABI list again
elsteveogrande Aug 31, 2025
c6f56a0
More fixes: ABI, windows, misc
elsteveogrande Aug 31, 2025
f0381d6
More fixes: ABI, windows, misc
elsteveogrande Aug 31, 2025
ff2962c
Undo unrelated / accidental changes
elsteveogrande Sep 2, 2025
000e830
[WIP] adding XFAILS, clean up test code
elsteveogrande Sep 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/docs/FeatureTestMacroTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_spanstream`` *unimplemented*
---------------------------------------------------------- -----------------
``__cpp_lib_stacktrace`` *unimplemented*
``__cpp_lib_stacktrace`` ``202011L``
---------------------------------------------------------- -----------------
``__cpp_lib_stdatomic_h`` ``202011L``
---------------------------------------------------------- -----------------
Expand Down
2 changes: 2 additions & 0 deletions libcxx/docs/ReleaseNotes/22.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Implemented Papers
- P2321R2: ``zip`` (`Github <https://github.com/llvm/llvm-project/issues/105169>`__) (The paper is partially
implemented. ``zip_transform_view`` is implemented in this release)
- P3168R2: Give ``std::optional`` Range Support (`Github <https://github.com/llvm/llvm-project/issues/105430>`__)
- P0881R7: A Proposal to add stacktrace library (`Github <https://github.com/llvm/llvm-project/issues/105131>`__)
- P2301R1: Add a `pmr` alias for `std::stacktrace` (`Github <https://github.com/llvm/llvm-project/issues/105167>`__)
Comment on lines +44 to +45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- P0881R7: A Proposal to add stacktrace library (`Github <https://github.com/llvm/llvm-project/issues/105131>`__)
- P2301R1: Add a `pmr` alias for `std::stacktrace` (`Github <https://github.com/llvm/llvm-project/issues/105167>`__)
- P0881R7: A Proposal to add stacktrace library (`Github <https://llvm.org/PR105131>`__)
- P2301R1: Add a `pmr` alias for `std::stacktrace` (`Github <https://llvm.org/PR105167>`__)

Please update all issue links to the universal format after: #156288


Improvements and New Features
-----------------------------
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx23Issues.csv
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
"`LWG3028 <https://wg21.link/LWG3028>`__","Container requirements tables should distinguish ``const`` and non-``const`` variables","2022-11 (Kona)","","",""
"`LWG3118 <https://wg21.link/LWG3118>`__","``fpos`` equality comparison unspecified","2022-11 (Kona)","","",""
"`LWG3177 <https://wg21.link/LWG3177>`__","Limit permission to specialize variable templates to program-defined types","2022-11 (Kona)","|Nothing To Do|","",""
"`LWG3515 <https://wg21.link/LWG3515>`__","§[stacktrace.basic.nonmem]: ``operator<<`` should be less templatized","2022-11 (Kona)","","",""
"`LWG3515 <https://wg21.link/LWG3515>`__","§[stacktrace.basic.nonmem]: ``operator<<`` should be less templatized","2022-11 (Kona)","|Complete|","",""
"`LWG3545 <https://wg21.link/LWG3545>`__","``std::pointer_traits`` should be SFINAE-friendly","2022-11 (Kona)","|Complete|","18",""
"`LWG3569 <https://wg21.link/LWG3569>`__","``join_view`` fails to support ranges of ranges with non-default_initializable iterators","2022-11 (Kona)","","",""
"`LWG3594 <https://wg21.link/LWG3594>`__","``inout_ptr`` — inconsistent ``release()`` in destructor","2022-11 (Kona)","|Complete|","19",""
Expand Down
6 changes: 3 additions & 3 deletions libcxx/docs/Status/Cxx23Papers.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"Paper #","Paper Name","Meeting","Status","First released version","Notes"
"`P0881R7 <https://wg21.link/P0881R7>`__","A Proposal to add stacktrace library","2020-11 (Virtual)","","",""
"`P0881R7 <https://wg21.link/P0881R7>`__","A Proposal to add stacktrace library","2020-11 (Virtual)","|Complete|","21",""
"`P0943R6 <https://wg21.link/P0943R6>`__","Support C atomics in C++","2020-11 (Virtual)","|Complete|","15",""
"`P1048R1 <https://wg21.link/P1048R1>`__","A proposal for a type trait to detect scoped enumerations","2020-11 (Virtual)","|Complete|","12",""
"`P1679R3 <https://wg21.link/P1679R3>`__","string contains function","2020-11 (Virtual)","|Complete|","12",""
Expand Down Expand Up @@ -32,7 +32,7 @@
"`P1675R2 <https://wg21.link/P1675R2>`__","``rethrow_exception`` must be allowed to copy","2021-10 (Virtual)","|Nothing To Do|","",""
"`P2077R3 <https://wg21.link/P2077R3>`__","Heterogeneous erasure overloads for associative containers","2021-10 (Virtual)","","",""
"`P2251R1 <https://wg21.link/P2251R1>`__","Require ``span`` & ``basic_string_view`` to be Trivially Copyable","2021-10 (Virtual)","|Complete|","14",""
"`P2301R1 <https://wg21.link/P2301R1>`__","Add a ``pmr`` alias for ``std::stacktrace``","2021-10 (Virtual)","","",""
"`P2301R1 <https://wg21.link/P2301R1>`__","Add a ``pmr`` alias for ``std::stacktrace``","2021-10 (Virtual)","|Complete|","21",""
"`P2321R2 <https://wg21.link/P2321R2>`__","``zip``","2021-10 (Virtual)","|In Progress|","",""
"`P2340R1 <https://wg21.link/P2340R1>`__","Clarifying the status of the 'C headers'","2021-10 (Virtual)","|Nothing To Do|","",""
"`P2393R1 <https://wg21.link/P2393R1>`__","Cleaning up ``integer``-class types","2021-10 (Virtual)","","",""
Expand Down Expand Up @@ -110,7 +110,7 @@
"`P2713R1 <https://wg21.link/P2713R1>`__","Escaping improvements in ``std::format``","2023-02 (Issaquah)","|Complete|","19",""
"`P2675R1 <https://wg21.link/P2675R1>`__","``format``'s width estimation is too approximate and not forward compatible","2023-02 (Issaquah)","|Complete|","17",""
"`P2572R1 <https://wg21.link/P2572R1>`__","``std::format`` fill character allowances","2023-02 (Issaquah)","|Complete|","17",""
"`P2693R1 <https://wg21.link/P2693R1>`__","Formatting ``thread::id`` and ``stacktrace``","2023-02 (Issaquah)","|Partial|","","The formatter for ``stacktrace`` is not implemented, since ``stacktrace`` is not implemented yet"
"`P2693R1 <https://wg21.link/P2693R1>`__","Formatting ``thread::id`` and ``stacktrace``","2023-02 (Issaquah)","|Partial|","","The formatter for ``stacktrace`` is not implemented yet"
"`P2679R2 <https://wg21.link/P2679R2>`__","Fixing ``std::start_lifetime_as`` for arrays","2023-02 (Issaquah)","","",""
"`P2674R1 <https://wg21.link/P2674R1>`__","A trait for implicit lifetime types","2023-02 (Issaquah)","|Complete|","20",""
"`P2655R3 <https://wg21.link/P2655R3>`__","``common_reference_t`` of ``reference_wrapper`` Should Be a Reference Type","2023-02 (Issaquah)","|Complete|","21","The paper is implemented as a DR to C++20"
Expand Down
3 changes: 3 additions & 0 deletions libcxx/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@ set(files
__ranges/zip_transform_view.h
__ranges/zip_view.h
__split_buffer
__stacktrace/basic_stacktrace.h
__stacktrace/stacktrace_entry.h
__std_mbstate_t.h
__stop_token/atomic_unique_lock.h
__stop_token/intrusive_list_view.h
Expand Down Expand Up @@ -1058,6 +1060,7 @@ set(files
span
sstream
stack
stacktrace
stdatomic.h
stdbool.h
stddef.h
Expand Down
27 changes: 27 additions & 0 deletions libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,33 @@ typedef __char32_t char32_t;
# define _LIBCPP_NOINLINE
# endif

// Some functions, e.g. std::stacktrace::current, need to avoid being
// tail-called by (and tail-calling other) functions, for proper enumeration of
// call-stack frames.
// clang-format off

// Disables tail-call optimization for "outbound" calls
// performed in the function annotated with this attribute.
# if __has_cpp_attribute(_Clang::__disable_tail_calls__)
# define _LIBCPP_NO_TAIL_CALLS_OUT [[_Clang::__disable_tail_calls__]]
# elif __has_cpp_attribute(__gnu__::__optimize__)
# define _LIBCPP_NO_TAIL_CALLS_OUT [[__gnu__::__optimize__("no-optimize-sibling-calls")]]
# else
# define _LIBCPP_NO_TAIL_CALLS_OUT
# endif

// Disables tail-call optimization for "inbound" calls -- that is,
// calls from some other function calling the one having this attribute.
# if __has_cpp_attribute(_Clang::__not_tail_called__)
# define _LIBCPP_NO_TAIL_CALLS_IN [[_Clang::__not_tail_called__]]
# else
# define _LIBCPP_NO_TAIL_CALLS_IN
# endif

// Disable TCO for calls into, and out from, the annotated function.
# define _LIBCPP_NO_TAIL_CALLS _LIBCPP_NO_TAIL_CALLS_IN _LIBCPP_NO_TAIL_CALLS_OUT
// clang-format on
Comment on lines +968 to +993
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it would be better if we go the other way around and add [[gnu::always_inline, gnu::nodebug]]. I'm pretty sure people don't care about the stacktrace::current() at the top of the trace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, agreed; I changed current (the 3 overloads) to be always-inlined. There are a few unit tests which still use these, which I think should still be helpful in constructing a chain of calls into a predictable stacktrace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However I didn't add nodebug, will do that


// We often repeat things just for handling wide characters in the library.
// When wide characters are disabled, it can be useful to have a quick way of
// disabling it without having to resort to #if-#endif, which has a larger
Expand Down
4 changes: 4 additions & 0 deletions libcxx/include/__configuration/availability.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@
#define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE _LIBCPP_INTRODUCED_IN_LLVM_21
// No attribute, since we've had bad_function_call::what() in the headers before

// This controls the availability of C++23 <stacktrace>.
#define _LIBCPP_AVAILABILITY_HAS_STACKTRACE _LIBCPP_INTRODUCED_IN_LLVM_21
#define _LIBCPP_AVAILABILITY_STACKTRACE _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE

// Define availability attributes that depend on both
// _LIBCPP_HAS_EXCEPTIONS and _LIBCPP_HAS_RTTI.
#if !_LIBCPP_HAS_EXCEPTIONS || !_LIBCPP_HAS_RTTI
Expand Down
Loading
Loading