diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2022-07-12 09:40:12 +0100 |
---|---|---|
committer | Michael Buch <michaelbuch12@gmail.com> | 2022-07-22 08:02:09 +0100 |
commit | 8184b252cdab2fbe44f766d6de28b29ebe4c8753 (patch) | |
tree | c4e8a45c81dae41b6cbf1401ee91d24bb314cc63 /clang/lib/CodeGen | |
parent | 317c8bf84d185c6b4a51a415c0deb7f8af661cb6 (diff) | |
download | llvm-8184b252cdab2fbe44f766d6de28b29ebe4c8753.zip llvm-8184b252cdab2fbe44f766d6de28b29ebe4c8753.tar.gz llvm-8184b252cdab2fbe44f766d6de28b29ebe4c8753.tar.bz2 |
[LLDB][ClangExpression] Allow expression evaluation from within C++ Lambdas
This patch adds support for evaluating expressions which reference
a captured `this` from within the context of a C++ lambda expression.
Currently LLDB doesn't provide Clang with enough information to
determine that we're inside a lambda expression and are allowed to
access variables on a captured `this`; instead Clang simply fails
to parse the expression.
There are two problems to solve here:
1. Make sure `clang::Sema` doesn't reject the expression due to an
illegal member access.
2. Materialize all the captured variables/member variables required
to evaluate the expression.
To address (1), we currently import the outer structure's AST context
onto `$__lldb_class`, making the `contextClass` and the `NamingClass`
match, a requirement by `clang::Sema::BuildPossibleImplicitMemberExpr`.
To address (2), we inject all captured variables as locals into the
expression source code.
**Testing**
* Added API test
Diffstat (limited to 'clang/lib/CodeGen')
0 files changed, 0 insertions, 0 deletions