There are a lot of
#if _LIBCPP_DEBUG_LEVEL == 2 __get_db()->__insert_c(this); #endif
This patch introduces __debug_db_insert_c() to put the #if in one central place.
Paths
| Differential D116947
[libc++] Introduce __debug_db_insert_c() ClosedPublic Authored by philnik on Jan 10 2022, 8:06 AM.
Details
Summary There are a lot of #if _LIBCPP_DEBUG_LEVEL == 2 __get_db()->__insert_c(this); #endif This patch introduces __debug_db_insert_c() to put the #if in one central place.
Diff Detail
Event TimelineThis revision is now accepted and ready to land.Jan 10 2022, 8:25 AM Comment Actions @ldionne has already accepted, but FWIW, I would have said let's not introduce a new function-call layer of indirection for this, because that harms -O0 codegen (not that we really care about -O0 codegen). I would have suggested a macro, or just not doing this at all. Food for thought maybe? Comment Actions
IMO we should try not to use macros when we have an easy alternative. And as you said, codegen at -O0 is not something that has a lot of weigh in the balance. I certainly wouldn't want to start making regular decisions based on that, at least. Comment Actions We could add _LIBCPP_ALWAYS_INLINE. That eliminates the function call even at -O0 (https://godbolt.org/z/PffnTM9P5). But I personally wouldn't really want to do that.
Closed by commit rGe3cf70502cae: [libc++] Introduce __debug_db_insert_c() (authored by philnik). · Explain WhyJan 11 2022, 2:12 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 398761 libcxx/include/__debug
libcxx/include/list
libcxx/include/string
libcxx/include/unordered_map
libcxx/include/unordered_set
libcxx/include/vector
|
Is this for __libcpp_is_constant_evaluated? Might it make sense to move __libcpp_is_constant_evaluated into <__config>?