[PATCH] D157833: [C++20] [Coroutines] Mark await_suspend as noinline if the awaiter is not empty

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 13 22:42:35 PDT 2023


ChuanqiXu added inline comments.


================
Comment at: clang/lib/CodeGen/CGCoroutine.cpp:158-169
+    assert(Result && "Why can't we find the record type from the common "
+                     "expression of a coroutine suspend expression? "
+                     "Maybe we missed some types or the Sema get something "
+                     "incorrect");
+
+    // In a release build without assertions enabled, return false directly
+    // to give users better user experience. It doesn't matter with the
----------------
Note that the may cause a crash if there are some types we are not able to covered. This is intentional. Since such crash is easy to fix by adding new type to the TypeVisitor. I guess this may be understandable since the type system of clang frontend (or should I say C++?) is really complex.

Also note that this only matters with people who enabled assertions, possibly developers or testers.

For end users who use a clean release build, it is completely OK to not match the type. They may only need to pay 1 bit memory overhead for that. I feel this is better for the user experience.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157833/new/

https://reviews.llvm.org/D157833



More information about the cfe-commits mailing list