[lldb] Provide a getter for m_materializer_up in LLVMUserExpression instead of relying on it being accessible.

Summary:
Motivated by Swift using the materializer in a few places which requires us to add this getter ourselves.
We also need a setter, but let's keep this minimal to unblock the downstream reverts in Swift.

Reviewers: davide

Reviewed By: davide

Subscribers: abidh, JDevlieghere, lldb-commits

Tags: #upstreaming_lldb_s_downstream_patches, #lldb

Differential Revision: https://reviews.llvm.org/D69714
This commit is contained in:
Raphael Isemann 2019-11-04 09:05:24 +01:00
parent 80bf88d8bc
commit ae10661a81
3 changed files with 8 additions and 2 deletions

View File

@ -64,6 +64,10 @@ public:
/// default, return eLanguageTypeUnknown.
virtual lldb::LanguageType Language() { return lldb::eLanguageTypeUnknown; }
/// Return the Materializer that the parser should use when registering
/// external values.
virtual Materializer *GetMaterializer() { return nullptr; }
/// Return the desired result type of the function, or eResultTypeAny if
/// indifferent.
virtual ResultType DesiredResultType() { return eResultTypeAny; }

View File

@ -63,6 +63,8 @@ public:
bool CanInterpret() override { return m_can_interpret; }
Materializer *GetMaterializer() override { return m_materializer_up.get(); }
/// Return the string that the parser should parse. Must be a full
/// translation unit.
const char *Text() override { return m_transformed_text.c_str(); }

View File

@ -576,7 +576,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager,
auto on_exit = llvm::make_scope_exit([this]() { ResetDeclMap(); });
if (!DeclMap()->WillParse(exe_ctx, m_materializer_up.get())) {
if (!DeclMap()->WillParse(exe_ctx, GetMaterializer())) {
diagnostic_manager.PutString(
eDiagnosticSeverityError,
"current process state is unsuitable for expression parsing");
@ -764,7 +764,7 @@ bool ClangUserExpression::Complete(ExecutionContext &exe_ctx,
auto on_exit = llvm::make_scope_exit([this]() { ResetDeclMap(); });
if (!DeclMap()->WillParse(exe_ctx, m_materializer_up.get())) {
if (!DeclMap()->WillParse(exe_ctx, GetMaterializer())) {
diagnostic_manager.PutString(
eDiagnosticSeverityError,
"current process state is unsuitable for expression parsing");