LLDB mainline
|
"lldb/Expression/ExpressionParser.h" Encapsulates an instance of a compiler that can parse expressions. More...
#include <ExpressionParser.h>
Public Member Functions | |
ExpressionParser (ExecutionContextScope *exe_scope, Expression &expr, bool generate_debug_info) | |
Constructor. | |
virtual | ~ExpressionParser ()=default |
Destructor. | |
virtual bool | Complete (CompletionRequest &request, unsigned line, unsigned pos, unsigned typed_pos)=0 |
Attempts to find possible command line completions for the given expression. | |
virtual bool | RewriteExpression (DiagnosticManager &diagnostic_manager) |
Try to use the FixIts in the diagnostic_manager to rewrite the expression. | |
Status | PrepareForExecution (lldb::addr_t &func_addr, lldb::addr_t &func_end, std::shared_ptr< IRExecutionUnit > &execution_unit_sp, ExecutionContext &exe_ctx, bool &can_interpret, lldb_private::ExecutionPolicy execution_policy) |
Ready an already-parsed expression for execution, possibly evaluating it statically. | |
bool | GetGenerateDebugInfo () const |
Protected Member Functions | |
virtual Status | DoPrepareForExecution (lldb::addr_t &func_addr, lldb::addr_t &func_end, std::shared_ptr< IRExecutionUnit > &execution_unit_sp, ExecutionContext &exe_ctx, bool &can_interpret, lldb_private::ExecutionPolicy execution_policy)=0 |
Protected Attributes | |
Expression & | m_expr |
The expression to be parsed. | |
bool | m_generate_debug_info |
Private Member Functions | |
Status | RunStaticInitializers (lldb::IRExecutionUnitSP &execution_unit_sp, ExecutionContext &exe_ctx) |
Run all static initializers for an execution unit. | |
"lldb/Expression/ExpressionParser.h" Encapsulates an instance of a compiler that can parse expressions.
ExpressionParser is the base class for llvm based Expression parsers.
Definition at line 26 of file ExpressionParser.h.
|
inline |
Constructor.
Initializes class variables.
[in] | exe_scope | If non-NULL, an execution context scope that can help to correctly create an expression with a valid process for optional tuning Objective-C runtime support. Can be NULL. |
[in] | expr | The expression to be parsed. |
Definition at line 39 of file ExpressionParser.h.
|
virtualdefault |
Destructor.
|
pure virtual |
Attempts to find possible command line completions for the given expression.
[out] | request | The completion request to fill out. The completion should be a string that would complete the current token at the cursor position. Note that the string in the list replaces the current token in the command line. |
[in] | line | The line with the completion cursor inside the expression as a string. The first line in the expression has the number 0. |
[in] | pos | The character position in the line with the completion cursor. If the value is 0, then the cursor is on top of the first character in the line (i.e. the user has requested completion from the start of the expression). |
[in] | typed_pos | The cursor position in the line as typed by the user. If the user expression has not been transformed in some form (e.g. wrapping it in a function body for C languages), then this is equal to the 'pos' parameter. The semantics of this value are otherwise equal to 'pos' (e.g. a value of 0 means the cursor is at start of the expression). |
Implemented in lldb_private::ClangExpressionParser.
|
protectedpure virtual |
Implemented in lldb_private::ClangExpressionParser.
Referenced by PrepareForExecution().
|
inline |
Definition at line 128 of file ExpressionParser.h.
References m_generate_debug_info.
Referenced by lldb_private::ClangUtilityFunction::Install().
Status ExpressionParser::PrepareForExecution | ( | lldb::addr_t & | func_addr, |
lldb::addr_t & | func_end, | ||
std::shared_ptr< IRExecutionUnit > & | execution_unit_sp, | ||
ExecutionContext & | exe_ctx, | ||
bool & | can_interpret, | ||
lldb_private::ExecutionPolicy | execution_policy | ||
) |
Ready an already-parsed expression for execution, possibly evaluating it statically.
[out] | func_addr | The address to which the function has been written. |
[out] | func_end | The end of the function's allocated memory region. (func_addr and func_end do not delimit an allocated region; the allocated region may begin before func_addr.) |
[in] | execution_unit_sp | After parsing, ownership of the execution unit for for the expression is handed to this shared pointer. |
[in] | exe_ctx | The execution context to write the function into. |
[out] | can_interpret | Set to true if the expression could be interpreted statically; untouched otherwise. |
[in] | execution_policy | Determines whether the expression must be JIT-compiled, must be evaluated statically, or whether this decision may be made opportunistically. |
Definition at line 18 of file ExpressionParser.cpp.
References DoPrepareForExecution(), lldb_private::ExecutionContext::GetProcessPtr(), lldb_private::ExecutionContext::HasThreadScope(), RunStaticInitializers(), and lldb_private::Status::Success().
Referenced by lldb_private::ClangUtilityFunction::Install().
|
inlinevirtual |
Try to use the FixIts in the diagnostic_manager to rewrite the expression.
If successful, the rewritten expression is stored in the diagnostic_manager, get it out with GetFixedExpression.
[in] | diagnostic_manager | The diagnostic manager containing fixit's to apply. |
Reimplemented in lldb_private::ClangExpressionParser.
Definition at line 88 of file ExpressionParser.h.
|
private |
Run all static initializers for an execution unit.
[in] | execution_unit_sp | The execution unit. |
[in] | exe_ctx | The execution context to use when running them. Thread can't be null. |
Definition at line 33 of file ExpressionParser.cpp.
References lldb::eExpressionCompleted, lldb_private::Thread::GetProcess(), lldb_private::DiagnosticManager::GetString(), lldb_private::ExecutionContext::GetThreadRef(), lldb_private::ExecutionContext::HasThreadScope(), lldb_private::Status::SetErrorString(), and lldb_private::Status::SetErrorStringWithFormat().
Referenced by PrepareForExecution().
|
protected |
The expression to be parsed.
Definition at line 152 of file ExpressionParser.h.
Referenced by lldb_private::ClangExpressionParser::ClangExpressionParser(), lldb_private::ClangExpressionParser::Complete(), lldb_private::ClangExpressionParser::DoPrepareForExecution(), and lldb_private::ClangExpressionParser::ParseInternal().
|
protected |
Definition at line 153 of file ExpressionParser.h.
Referenced by GetGenerateDebugInfo().