[libcxx-commits] [libcxx] [libc++][hardening] Classify assertions related to leaks and syscalls. (PR #77164)

Konstantin Varlamov via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 5 17:07:08 PST 2024


================
@@ -55,21 +55,21 @@ struct _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
   _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; }
 
   _LIBCPP_HIDE_FROM_ABI bool done() const {
-    _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines");
+    _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "done() can be called only on suspended coroutines");
----------------
var-const wrote:

This might be a little weird, but to me calling these coroutine compiler built-ins _does_ seem like doing a syscall, even though technically both the library and the compiler are part of the "implementation". It's essentially a black box that we don't control and I don't think we can easily say what happens if this condition is violated (without reading Clang sources, but from our perspective it's no different from reading e.g. `pthread` sources). I'd prefer not to multiply the number of categories too much and would certainly like to avoid making a separate category just for coroutines. Let me know what you think!

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


More information about the libcxx-commits mailing list