[PATCH] D153616: [clang][Interp] Create a new local variable in visitLambdaExpr()

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 23 00:58:42 PDT 2023


tbaeder created this revision.
tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

  Move the logic for initialization of a lambda into
  visitRecordInitializer(). When we visit a LambdaExpr outside of the
  visitInitializer() logic, we need to create a new local variable so we
  have a place to write the lambda members into.

This fixes passing lambas as arguments to function calls.

In that case, we visit a `LambdaExpr` without it being an initializer to anything, so we should create a new local variable and return a pointer to it, which we then pass to the function call.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153616

Files:
  clang/lib/AST/Interp/ByteCodeExprGen.cpp
  clang/test/AST/Interp/lambda.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153616.533885.patch
Type: text/x-patch
Size: 3495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230623/5a3d12a2/attachment.bin>


More information about the cfe-commits mailing list