[lldb] Add support for evaluating expressions in static member functions
authorRaphael Isemann <teemperor@gmail.com>
Mon, 19 Apr 2021 13:50:10 +0000 (15:50 +0200)
committerRaphael Isemann <teemperor@gmail.com>
Thu, 22 Apr 2021 10:14:31 +0000 (12:14 +0200)
commit00764c36edf88ae9806e8d57a6addb782e6ceae8
treee96a6f792c46e6d7a27a9a6fb4bd42627d322885
parent092619cf6b8d33e8830221925c1174f5d373f1d2
[lldb] Add support for evaluating expressions in static member functions

At the moment the expression parser doesn't support evaluating expressions in
static member functions and just pretends the expression is evaluated within a
non-member function. This causes that all static members are inaccessible when
doing unqualified name lookup.

This patch adds support for evaluating in static member functions. It
essentially just does the same setup as what LLDB is already doing for
non-static member functions (i.e., wrapping the expression in a fake member
function) with the difference that we now mark the wrapping function as static
(to prevent access to non-static members).

Reviewed By: shafik, jarin

Differential Revision: https://reviews.llvm.org/D81550
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
lldb/test/API/lang/cpp/stopped_in_static_member_function/Makefile [new file with mode: 0644]
lldb/test/API/lang/cpp/stopped_in_static_member_function/TestStoppedInStaticMemberFunction.py [new file with mode: 0644]
lldb/test/API/lang/cpp/stopped_in_static_member_function/main.cpp [new file with mode: 0644]