From aea6096daa761b0cc1cdd8772bbe3987c32b238b Mon Sep 17 00:00:00 2001 From: Yuxuan Chen Date: Fri, 3 Jan 2025 10:40:29 -0800 Subject: [PATCH] add `[[clang::coro_await_elidable]]` to `NothrowAwaitable` and `TryAwaitable` Summary: [[clang::coro_await_elidable]] is an attribute to help us elide more coroutine heap allocations. See the diff where we enabled it. D58956574 Reviewed By: skrueger Differential Revision: D67299322 fbshipit-source-id: 2321765fd8818d8025e4e5c4a2f83a52544c1b37 --- folly/coro/ViaIfAsync.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/folly/coro/ViaIfAsync.h b/folly/coro/ViaIfAsync.h index e4f96d56759..11e98d7e8ee 100644 --- a/folly/coro/ViaIfAsync.h +++ b/folly/coro/ViaIfAsync.h @@ -645,7 +645,8 @@ class CommutativeWrapperAwaitable { }; template -class TryAwaitable : public CommutativeWrapperAwaitable { +class [[FOLLY_ATTR_CLANG_CORO_AWAIT_ELIDABLE]] TryAwaitable + : public CommutativeWrapperAwaitable { public: using CommutativeWrapperAwaitable:: CommutativeWrapperAwaitable; @@ -680,7 +681,7 @@ using semi_await_try_result_t = namespace detail { template -class NothrowAwaitable +class [[FOLLY_ATTR_CLANG_CORO_AWAIT_ELIDABLE]] NothrowAwaitable : public CommutativeWrapperAwaitable { public: using CommutativeWrapperAwaitable::