[PATCH] D137872: Implement lambdas with inalloca parameters by forwarding to function without inalloca calling convention.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 10 14:45:37 PDT 2023


efriedma added inline comments.


================
Comment at: clang/lib/CodeGen/CGClass.cpp:3097
+                      FD->getLocation(), FD->getLocation());
+    CGF.EmitFunctionBody(FD->getBody());
+    CGF.FinishFunction();
----------------
Is there any way we can use GenerateCode as the entrypoint here, instead of calling EmitFunctionBody directly?  Without this patch, EmitFunctionBody has exactly one caller, so this makes the control flow and special cases more complicated to reason about.  For example, there's some special coroutine handling in GenerateCode.


================
Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:1472
+    // the call operator body.
+    EmitLambdaStaticInvokeBody(cast<CXXMethodDecl>(FD));
   } else if (FD->isDefaulted() && isa<CXXMethodDecl>(FD) &&
----------------
Does this pass the correct value of "this"?  EmitLambdaStaticInvokeBody creates a new alloca to represent "this", but it's already an argument to the function.

Granted, it only matters in really obscure cases, but still.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137872



More information about the cfe-commits mailing list