[clang] [llvm] [Clang] C++20 Coroutines: Introduce Frontend Attribute [[clang::coro_await_elidable]] (PR #99282)

Yuxuan Chen via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 28 09:24:27 PDT 2024


================
@@ -523,6 +523,12 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
     NormalCleanupDest = Address::invalid();
   }
 
+  if (getLangOpts().Coroutines && isCoroutine()) {
+    auto *Record = FnRetTy->getAsCXXRecordDecl();
+    if (Record && Record->hasAttr<CoroAwaitElidableAttr>())
+      CurFn->addFnAttr(llvm::Attribute::CoroGenNoallocRamp);
+  }
----------------
yuxuanchen1997 wrote:

Original intention was to not introduce extra work (for loop over usages) for non attributed code. The check won't have a quick exit path for unattributed code.

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


More information about the cfe-commits mailing list