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(Stream &error_stream, ExecutionContext &exe_ctx, lldb_private::ExecutionPolicy execution_policy,
70 bool keep_result_in_memory, bool generate_debug_info) override;
72 lldb::ExpressionResults
73 Execute(Stream &error_stream, ExecutionContext &exe_ctx,
74 const EvaluateExpressionOptions &options,
75 lldb::UserExpressionSP &shared_ptr_to_me,
76 lldb::ExpressionVariableSP &result) override;
79 CanInterpret() override
84 FinalizeJITExecution(Stream &error_stream, ExecutionContext &exe_ctx, lldb::ExpressionVariableSP &result,
85 lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
86 lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS) override
93 std::unique_ptr<GoInterpreter> m_interpreter;
96 } // namespace lldb_private
98 #endif // liblldb_GoUserExpression_h_