Commit ae10661a authored by Raphael Isemann's avatar Raphael Isemann
Browse files

[lldb] Provide a getter for m_materializer_up in LLVMUserExpression instead of...

[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
parent 80bf88d8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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; }
+2 −0
Original line number Diff line number Diff line
@@ -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(); }
+2 −2
Original line number Diff line number Diff line
@@ -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");