Skip to content

Commit 7f5f4e8

Browse files
committed
add attributes for coro optimize
1 parent c1add92 commit 7f5f4e8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

async_simple/CommonMacros.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,26 @@
4343
#endif // __SANITIZE_ADDRESS__
4444
#endif // __GNUC__
4545

46+
#if __has_cpp_attribute(clang::coro_only_destroy_when_complete)
47+
#define CORO_ONLY_DESTROY_WHEN_DONE [[clang::coro_only_destroy_when_complete]]
48+
#else
4649
#if defined(__alibaba_clang__) && \
4750
__has_cpp_attribute(ACC::coro_only_destroy_when_complete)
4851
#define CORO_ONLY_DESTROY_WHEN_DONE [[ACC::coro_only_destroy_when_complete]]
4952
#else
5053
#define CORO_ONLY_DESTROY_WHEN_DONE
5154
#endif
55+
#endif
5256

57+
#if __has_cpp_attribute(clang::coro_await_elidable)
58+
#define ELIDEABLE_AFTER_AWAIT [[clang::coro_await_elidable]]
59+
#else
5360
#if defined(__alibaba_clang__) && \
5461
__has_cpp_attribute(ACC::elideable_after_await)
5562
#define ELIDEABLE_AFTER_AWAIT [[ACC::elideable_after_await]]
5663
#else
5764
#define ELIDEABLE_AFTER_AWAIT
5865
#endif
66+
#endif
5967

6068
#endif

0 commit comments

Comments
 (0)