LLDB mainline
|
#include <ClangExpressionSourceCode.h>
Public Types | |
enum class | WrapKind { CppMemberFunction , ObjCInstanceMethod , ObjCStaticMethod , Function } |
The possible ways an expression can be wrapped. More... | |
Public Member Functions | |
bool | GetText (std::string &text, ExecutionContext &exe_ctx, bool add_locals, bool force_add_all_locals, llvm::ArrayRef< std::string > modules) const |
Generates the source code that will evaluate the expression. | |
bool | GetOriginalBodyBounds (std::string transformed_text, size_t &start_loc, size_t &end_loc) |
Public Member Functions inherited from lldb_private::ExpressionSourceCode | |
bool | NeedsWrapping () const |
const char * | GetName () const |
Static Public Member Functions | |
static ClangExpressionSourceCode * | CreateWrapped (llvm::StringRef filename, llvm::StringRef prefix, llvm::StringRef body, WrapKind wrap_kind) |
Static Public Attributes | |
static const llvm::StringRef | g_prefix_file_name = PREFIX_NAME |
The file name we use for the wrapper code that we inject before the user expression. | |
static const char * | g_expression_prefix |
static const char * | g_expression_suffix |
Protected Member Functions | |
ClangExpressionSourceCode (llvm::StringRef filename, llvm::StringRef name, llvm::StringRef prefix, llvm::StringRef body, Wrapping wrap, WrapKind wrap_kind) | |
Protected Member Functions inherited from lldb_private::ExpressionSourceCode | |
ExpressionSourceCode (llvm::StringRef name, llvm::StringRef prefix, llvm::StringRef body, Wrapping wrap) | |
Private Member Functions | |
void | AddLocalVariableDecls (StreamString &stream, const std::string &expr, StackFrame *frame) const |
Writes "using" declarations for local variables into the specified stream. | |
Private Attributes | |
std::string | m_start_marker |
String marking the start of the user expression. | |
std::string | m_end_marker |
String marking the end of the user expression. | |
const WrapKind | m_wrap_kind |
How the expression has been wrapped. | |
Additional Inherited Members | |
Protected Types inherited from lldb_private::ExpressionSourceCode | |
enum | Wrapping : bool { Wrap = true , NoWrap = false } |
Protected Attributes inherited from lldb_private::ExpressionSourceCode | |
std::string | m_name |
std::string | m_prefix |
std::string | m_body |
Wrapping | m_wrap |
Definition at line 24 of file ClangExpressionSourceCode.h.
|
strong |
The possible ways an expression can be wrapped.
Definition at line 33 of file ClangExpressionSourceCode.h.
|
protected |
Definition at line 193 of file ClangExpressionSourceCode.cpp.
References g_expression_suffix, m_end_marker, and m_start_marker.
|
private |
Writes "using" declarations for local variables into the specified stream.
Behaviour is undefined if 'frame == nullptr'.
[out] | stream | Stream that this function generates "using" declarations into. |
[in] | expr | Expression source that we're evaluating. |
[in] | frame | StackFrame which carries information about the local variables that we're generating "using" declarations for. |
Definition at line 310 of file ClangExpressionSourceCode.cpp.
References lldb_private::ConstString::AsCString(), CppMemberFunction, lldb_private::StackFrame::GetInScopeVariableList(), lldb_private::ConstString::GetStringRef(), m_wrap_kind, ObjCInstanceMethod, ObjCStaticMethod, and lldb_private::Stream::Printf().
Referenced by GetText().
|
inlinestatic |
Definition at line 45 of file ClangExpressionSourceCode.h.
References lldb_private::ExpressionSourceCode::Wrap.
Referenced by lldb_private::ClangUserExpression::CreateSourceCode().
bool ClangExpressionSourceCode::GetOriginalBodyBounds | ( | std::string | transformed_text, |
size_t & | start_loc, | ||
size_t & | end_loc | ||
) |
Definition at line 521 of file ClangExpressionSourceCode.cpp.
References m_end_marker, and m_start_marker.
bool ClangExpressionSourceCode::GetText | ( | std::string & | text, |
ExecutionContext & | exe_ctx, | ||
bool | add_locals, | ||
bool | force_add_all_locals, | ||
llvm::ArrayRef< std::string > | modules | ||
) | const |
Generates the source code that will evaluate the expression.
text | output parameter containing the source code string. |
exe_ctx | The execution context in which the expression will be evaluated. |
add_locals | True iff local variables should be injected into the expression source code. |
force_add_all_locals | True iff all local variables should be injected even if they are not used in the expression. |
modules | A list of (C++) modules that the expression should import. |
Definition at line 346 of file ClangExpressionSourceCode.cpp.
References AddLocalVariableDecls(), AddMacros(), lldb_private::SymbolContext::comp_unit, CppMemberFunction, lldb::eLanguageTypeC, Function, g_expression_prefix, lldb_private::Target::GetArchitecture(), lldb_private::StreamString::GetData(), lldb_private::CompileUnit::GetDebugMacros(), lldb_private::TargetProperties::GetEnableAutoImportClangModules(), lldb_private::LineEntry::GetFile(), lldb_private::StackFrame::GetFrameBlock(), lldb_private::ExecutionContext::GetFramePtr(), lldb_private::TargetProperties::GetInjectLocalVariables(), lldb_private::ArchSpec::GetMachine(), lldb_private::Target::GetPersistentExpressionStateForLanguage(), lldb_private::Target::GetPlatform(), lldb_private::StreamString::GetString(), lldb_private::StackFrame::GetSymbolContext(), lldb_private::ExecutionContext::GetTargetPtr(), lldb_private::LineEntry::IsValid(), lldb_private::LineEntry::line, lldb_private::SymbolContext::line_entry, lldb_private::ExpressionSourceCode::m_body, m_end_marker, lldb_private::ExpressionSourceCode::m_name, lldb_private::ExpressionSourceCode::m_prefix, m_start_marker, lldb_private::ExpressionSourceCode::m_wrap, m_wrap_kind, ObjCInstanceMethod, ObjCStaticMethod, and lldb_private::Stream::Printf().
|
static |
Definition at line 29 of file ClangExpressionSourceCode.h.
Referenced by lldb_private::ClangUtilityFunction::ClangUtilityFunction(), and GetText().
|
static |
Definition at line 30 of file ClangExpressionSourceCode.h.
Referenced by ClangExpressionSourceCode(), and lldb_private::ClangUtilityFunction::ClangUtilityFunction().
|
static |
The file name we use for the wrapper code that we inject before the user expression.
Definition at line 28 of file ClangExpressionSourceCode.h.
Referenced by lldb_private::ClangExpressionParser::LLDBPreprocessorCallbacks::moduleImport().
|
private |
String marking the end of the user expression.
Definition at line 98 of file ClangExpressionSourceCode.h.
Referenced by ClangExpressionSourceCode(), GetOriginalBodyBounds(), and GetText().
|
private |
String marking the start of the user expression.
Definition at line 96 of file ClangExpressionSourceCode.h.
Referenced by ClangExpressionSourceCode(), GetOriginalBodyBounds(), and GetText().
|
private |
How the expression has been wrapped.
Definition at line 100 of file ClangExpressionSourceCode.h.
Referenced by AddLocalVariableDecls(), and GetText().