[libcxx-commits] [libcxx] Add C++23 stacktrace (P0881R7) (PR #136528)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Sep 1 03:19:06 PDT 2025
================
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+/*
+ (19.6.4.3) Observers [stacktrace.basic.obs]
+
+ const_reference at(size_type) const;
+*/
+
+#include <cassert>
+#include <stacktrace>
+
+_LIBCPP_NO_TAIL_CALLS _LIBCPP_NOINLINE std::stacktrace test1() { return std::stacktrace::current(0, 4); }
----------------
Zingam wrote:
AFAIK `_LIBCPP` prefixed macros are considered internal implementation details and you shouldn't use them directly. You should redefine them in https://github.com/llvm/llvm-project/blob/main/libcxx/test/support/test_macros.h
You should comment why you have test1(), test2(), etc... and I think you need to use another name for these as you aren't testing anything, so the names are confusing.
https://github.com/llvm/llvm-project/pull/136528
More information about the libcxx-commits
mailing list