LLDB  mainline
Public Member Functions | Protected Attributes | List of all members
lldb_private::ExpressionParser Class Referenceabstract

"lldb/Expression/ExpressionParser.h" Encapsulates an instance of a compiler that can parse expressions. More...

#include <ExpressionParser.h>

Inheritance diagram for lldb_private::ExpressionParser:
Inheritance graph
Collaboration diagram for lldb_private::ExpressionParser:
Collaboration graph

Public Member Functions

 ExpressionParser (ExecutionContextScope *exe_scope, Expression &expr, bool generate_debug_info)
 Constructor. More...
virtual ~ExpressionParser ()
 Destructor. More...
virtual bool Complete (CompletionRequest &request, unsigned line, unsigned pos, unsigned typed_pos)=0
 Attempts to find possible command line completions for the given expression. More...
virtual bool RewriteExpression (DiagnosticManager &diagnostic_manager)
 Try to use the FixIts in the diagnostic_manager to rewrite the expression. More...
virtual 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)=0
 Ready an already-parsed expression for execution, possibly evaluating it statically. More...
bool GetGenerateDebugInfo () const

Protected Attributes

 The expression to be parsed. More...
bool m_generate_debug_info

Detailed Description

"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.

Constructor & Destructor Documentation

◆ ExpressionParser()

lldb_private::ExpressionParser::ExpressionParser ( ExecutionContextScope exe_scope,
Expression expr,
bool  generate_debug_info 


Initializes class variables.

[in]exe_scopeIf 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]exprThe expression to be parsed.

Definition at line 39 of file ExpressionParser.h.

◆ ~ExpressionParser()

virtual lldb_private::ExpressionParser::~ExpressionParser ( )


Definition at line 44 of file ExpressionParser.h.

References Complete().

Member Function Documentation

◆ Complete()

virtual bool lldb_private::ExpressionParser::Complete ( CompletionRequest request,
unsigned  line,
unsigned  pos,
unsigned  typed_pos 
pure virtual

Attempts to find possible command line completions for the given expression.

[out]requestThe 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]lineThe line with the completion cursor inside the expression as a string. The first line in the expression has the number 0.
[in]posThe 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_posThe 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).
True if we added any completion results to the output; false otherwise.

Implemented in lldb_private::ClangExpressionParser.

Referenced by ~ExpressionParser().

◆ GetGenerateDebugInfo()

bool lldb_private::ExpressionParser::GetGenerateDebugInfo ( ) const

Definition at line 128 of file ExpressionParser.h.

References m_generate_debug_info.

◆ PrepareForExecution()

virtual Status lldb_private::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 
pure virtual

Ready an already-parsed expression for execution, possibly evaluating it statically.

[out]func_addrThe address to which the function has been written.
[out]func_endThe 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_spAfter parsing, ownership of the execution unit for for the expression is handed to this shared pointer.
[in]exe_ctxThe execution context to write the function into.
[out]can_interpretSet to true if the expression could be interpreted statically; untouched otherwise.
[in]execution_policyDetermines whether the expression must be JIT-compiled, must be evaluated statically, or whether this decision may be made opportunistically.
An error code indicating the success or failure of the operation. Test with Success().

Referenced by RewriteExpression().

◆ RewriteExpression()

virtual bool lldb_private::ExpressionParser::RewriteExpression ( DiagnosticManager diagnostic_manager)

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_managerThe diagnostic manager containing fixit's to apply.
true if the rewrite was successful, false otherwise.

Reimplemented in lldb_private::ClangExpressionParser.

Definition at line 88 of file ExpressionParser.h.

References PrepareForExecution().

Member Data Documentation

◆ m_expr

Expression& lldb_private::ExpressionParser::m_expr

◆ m_generate_debug_info

bool lldb_private::ExpressionParser::m_generate_debug_info

Definition at line 132 of file ExpressionParser.h.

Referenced by GetGenerateDebugInfo().

The documentation for this class was generated from the following file: