[all-commits] [llvm/llvm-project] fcf4e2: [LLDB][NFC] Create variable for hardcoded alignmen...

Michael137 via All-commits all-commits at lists.llvm.org
Fri Jul 22 00:02:56 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fcf4e252f4d992cade4bdfe5aed10ff96fa40202
      https://github.com/llvm/llvm-project/commit/fcf4e252f4d992cade4bdfe5aed10ff96fa40202
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2022-07-22 (Fri, 22 Jul 2022)

  Changed paths:
    M lldb/source/Expression/Materializer.cpp

  Log Message:
  -----------
  [LLDB][NFC] Create variable for hardcoded alignment/size constants in materializer


  Commit: 317c8bf84d185c6b4a51a415c0deb7f8af661cb6
      https://github.com/llvm/llvm-project/commit/317c8bf84d185c6b4a51a415c0deb7f8af661cb6
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2022-07-22 (Fri, 22 Jul 2022)

  Changed paths:
    M lldb/include/lldb/Expression/Materializer.h
    M lldb/include/lldb/lldb-private-types.h
    M lldb/source/Expression/Materializer.cpp
    A lldb/test/API/functionalities/breakpoint/breakpoint_on_lambda_capture/Makefile
    A lldb/test/API/functionalities/breakpoint/breakpoint_on_lambda_capture/TestBreakOnLambdaCapture.py
    A lldb/test/API/functionalities/breakpoint/breakpoint_on_lambda_capture/main.cpp

  Log Message:
  -----------
  [LLDB][Expression] Allow instantiation of IR Entity from ValueObject

This is required in preparation for the follow-up patch which adds
support for evaluating expressions from within C++ lambdas. In such
cases we need to materialize variables which are not part of the
current frame but instead are ivars on a 'this' pointer of the current
frame.


  Commit: 8184b252cdab2fbe44f766d6de28b29ebe4c8753
      https://github.com/llvm/llvm-project/commit/8184b252cdab2fbe44f766d6de28b29ebe4c8753
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2022-07-22 (Fri, 22 Jul 2022)

  Changed paths:
    M lldb/include/lldb/Expression/UserExpression.h
    M lldb/source/Expression/UserExpression.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h
    A lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionUtil.cpp
    A lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionUtil.h
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
    M lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
    A lldb/test/API/commands/expression/expr_inside_lambda/Makefile
    A lldb/test/API/commands/expression/expr_inside_lambda/TestExprInsideLambdas.py
    A lldb/test/API/commands/expression/expr_inside_lambda/main.cpp

  Log Message:
  -----------
  [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


Compare: https://github.com/llvm/llvm-project/compare/18cee95919c8...8184b252cdab


More information about the All-commits mailing list