[Lldb-commits] [lldb] ae10661 - [lldb] Provide a getter for m_materializer_up in LLVMUserExpression instead of relying on it being accessible.
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 4 00:06:03 PST 2019
Author: Raphael Isemann
Date: 2019-11-04T09:05:24+01:00
New Revision: ae10661a8121558679463a57dd8661c81895f3ff
URL: https://github.com/llvm/llvm-project/commit/ae10661a8121558679463a57dd8661c81895f3ff
DIFF: https://github.com/llvm/llvm-project/commit/ae10661a8121558679463a57dd8661c81895f3ff.diff
LOG: [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
Added:
Modified:
lldb/include/lldb/Expression/Expression.h
lldb/include/lldb/Expression/LLVMUserExpression.h
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h
index 2f0183cf269b..fca5fb9119cb 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -64,6 +64,10 @@ class Expression {
/// 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
/// in
diff erent.
virtual ResultType DesiredResultType() { return eResultTypeAny; }
diff --git a/lldb/include/lldb/Expression/LLVMUserExpression.h b/lldb/include/lldb/Expression/LLVMUserExpression.h
index c3b8ed506f17..5f4c43cdea2e 100644
--- a/lldb/include/lldb/Expression/LLVMUserExpression.h
+++ b/lldb/include/lldb/Expression/LLVMUserExpression.h
@@ -63,6 +63,8 @@ class LLVMUserExpression : public UserExpression {
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(); }
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index da1ca785635c..60592cac517e 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -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");
More information about the lldb-commits
mailing list