[libcxx-commits] [libcxx] WIP - [libc++][debugging] P2546R5: Debugging support (PR #81447)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 7 06:08:14 PST 2024


================
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_DEBUGGING
+#define _LIBCPP_DEBUGGING
+
+/*
+// all freestanding
+namespace std {
+  // [debugging.utility], utility
+  void breakpoint() noexcept;
+  void breakpoint_if_debugging() noexcept;
+  bool is_debugger_present() noexcept;
+}
+*/
+
+#include <__config>
+#include <version>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_DEBUGGING)
+
+_LIBCPP_EXPORTED_FROM_ABI void breakpoint() noexcept;
----------------
H-G-Hristov wrote:

Thank you for taking an interest in this patch. I'd like to do some refactoring: I'll move the `std::debugging_function()` implementation in the header and export the helper implementation `__debugging_function()` instead. I think this is a better approach and should also avoid any future issues similar to the `to_string` ones. I believe the availability macros would still be applicable.

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


More information about the libcxx-commits mailing list