1 //===-- GoUserExpression.h --------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_GoUserExpression_h_
11 #define liblldb_GoUserExpression_h_
17 // Other libraries and framework includes
19 #include "lldb/lldb-forward.h"
20 #include "lldb/lldb-private.h"
21 #include "lldb/Expression/UserExpression.h"
22 #include "lldb/Expression/ExpressionVariable.h"
23 #include "lldb/Target/ExecutionContext.h"
25 namespace lldb_private
29 class GoPersistentExpressionState : public PersistentExpressionState
32 GoPersistentExpressionState();
34 ConstString GetNextPersistentVariableName() override;
36 void RemovePersistentVariable(lldb::ExpressionVariableSP variable) override;
39 LookupSymbol(const ConstString &name) override
41 return LLDB_INVALID_ADDRESS;
45 classof(const PersistentExpressionState *pv)
47 return pv->getKind() == PersistentExpressionState::eKindGo;
51 uint32_t m_next_persistent_variable_id; ///< The counter used by GetNextResultName().
54 //----------------------------------------------------------------------
55 /// @class GoUserExpression GoUserExpression.h "lldb/Expression/GoUserExpression.h"
56 /// @brief Encapsulates a single expression for use with Go
58 /// LLDB uses expressions for various purposes, notably to call functions
59 /// and as a backend for the expr command. GoUserExpression encapsulates
60 /// the objects needed to parse and interpret an expression.
61 //----------------------------------------------------------------------
62 class GoUserExpression : public UserExpression
65 GoUserExpression(ExecutionContextScope &exe_scope, const char *expr, const char *expr_prefix,
66 lldb::LanguageType language, ResultType desired_type, const EvaluateExpressionOptions &options);
69 Parse(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
70 lldb_private::ExecutionPolicy execution_policy, bool keep_result_in_memory,
71 bool generate_debug_info) override;
74 CanInterpret() override
79 FinalizeJITExecution(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
80 lldb::ExpressionVariableSP &result,
81 lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
82 lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS) override
88 lldb::ExpressionResults
89 DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
90 const EvaluateExpressionOptions &options, lldb::UserExpressionSP &shared_ptr_to_me,
91 lldb::ExpressionVariableSP &result) override;
95 std::unique_ptr<GoInterpreter> m_interpreter;
98 } // namespace lldb_private
100 #endif // liblldb_GoUserExpression_h_