[libcxx-commits] [libcxx] [libc++] Add std::stacktrace (P0881R7) (PR #136528)

Steve O'Brien via libcxx-commits libcxx-commits at lists.llvm.org
Sat Nov 15 16:20:22 PST 2025


================
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++23
+// UNSUPPORTED: availability-stacktrace-missing
+
+// (19.6.4.3) Observers [stacktrace.basic.obs]
+//
+//   const_reverse_iterator crbegin() const noexcept;
+//   const_reverse_iterator crend() const noexcept;
+
+#include <cassert>
+#include <iterator>
+#include <stacktrace>
+
+// Call chain is: main -> c -> b -> a -> stacktrace::current
+_LIBCPP_NOINLINE std::stacktrace a() { return std::stacktrace::current(); }
----------------
elsteveogrande wrote:

TODO: use TEST_NO_INLINE instead

https://github.com/llvm/llvm-project/pull/136528


More information about the libcxx-commits mailing list