Skip to content

Commit 91ca034

Browse files
committed
Implemented P2810R4 - is_debuggegr_present() is replaceable
1 parent f181fdd commit 91ca034

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

libcxx/include/debugging

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3131

3232
#if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_DEBUGGING)
3333

34-
_LIBCPP_EXPORTED_FROM_ABI void __breakpoint() noexcept;
34+
_LIBCPP_AVAILABILITY_DEBUGGING _LIBCPP_EXPORTED_FROM_ABI void breakpoint() noexcept;
3535

36-
_LIBCPP_EXPORTED_FROM_ABI bool __is_debugger_present() noexcept;
36+
_LIBCPP_AVAILABILITY_DEBUGGING _LIBCPP_EXPORTED_FROM_ABI void breakpoint_if_debugging() noexcept;
3737

38-
_LIBCPP_AVAILABILITY_DEBUGGING _LIBCPP_HIDE_FROM_ABI inline void breakpoint() noexcept { __breakpoint(); }
39-
40-
_LIBCPP_AVAILABILITY_DEBUGGING _LIBCPP_HIDE_FROM_ABI inline void breakpoint_if_debugging() noexcept {
41-
if (__is_debugger_present())
42-
__breakpoint();
43-
}
44-
45-
_LIBCPP_AVAILABILITY_DEBUGGING _LIBCPP_HIDE_FROM_ABI inline bool is_debugger_present() noexcept {
46-
return __is_debugger_present();
47-
}
38+
_LIBCPP_AVAILABILITY_DEBUGGING _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_OVERRIDABLE_FUNC_VIS bool
39+
is_debugger_present() noexcept;
4840

4941
#endif
5042

libcxx/src/debugging.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_debugger_present() noexcept {
146146

147147
# endif // defined(_LIBCPP_WIN32API)
148148

149+
_LIBCPP_EXPORTED_FROM_ABI void breakpoint() noexcept { __breakpoint(); }
150+
151+
_LIBCPP_EXPORTED_FROM_ABI void breakpoint_if_debugging() noexcept {
152+
if (__is_debugger_present())
153+
__breakpoint();
154+
}
155+
156+
_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_WEAK bool is_debugger_present() noexcept { return __is_debugger_present(); }
157+
149158
#endif // defined(_LIBCPP_HAS_DEBUGGING)
150159

151160
_LIBCPP_END_NAMESPACE_STD

0 commit comments

Comments
 (0)