LLDB  mainline
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
lldb_private::ClangREPL Class Reference

Implements a Clang-based REPL for C languages on top of LLDB's REPL framework. More...

#include <ClangREPL.h>

Inheritance diagram for lldb_private::ClangREPL:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::ClangREPL:
Collaboration graph
[legend]

Public Member Functions

 ClangREPL (lldb::LanguageType language, Target &target)
 
 ~ClangREPL () override
 
- Public Member Functions inherited from lldb_private::REPL
LLVMCastKind getKind () const
 
 REPL (LLVMCastKind kind, Target &target)
 
 ~REPL () override
 
void SetFormatOptions (const OptionGroupFormat &options)
 
void SetValueObjectDisplayOptions (const OptionGroupValueObjectDisplay &options)
 
void SetEvaluateOptions (const EvaluateExpressionOptions &options)
 
void SetCompilerOptions (const char *options)
 
lldb::IOHandlerSP GetIOHandler ()
 
Status RunLoop ()
 
void IOHandlerActivated (IOHandler &io_handler, bool interactive) override
 
bool IOHandlerInterrupt (IOHandler &io_handler) override
 
void IOHandlerInputInterrupted (IOHandler &io_handler, std::string &line) override
 
const char * IOHandlerGetFixIndentationCharacters () override
 
ConstString IOHandlerGetControlSequence (char ch) override
 
const char * IOHandlerGetCommandPrefix () override
 
const char * IOHandlerGetHelpPrologue () override
 
bool IOHandlerIsInputComplete (IOHandler &io_handler, StringList &lines) override
 Called to determine whether typing enter after the last line in lines should end input. More...
 
int IOHandlerFixIndentation (IOHandler &io_handler, const StringList &lines, int cursor_position) override
 Called when a new line is created or one of an identified set of indentation characters is typed. More...
 
void IOHandlerInputComplete (IOHandler &io_handler, std::string &line) override
 Called when a line or lines have been retrieved. More...
 
void IOHandlerComplete (IOHandler &io_handler, CompletionRequest &request) override
 
- Public Member Functions inherited from lldb_private::IOHandlerDelegate
 IOHandlerDelegate (Completion completion=Completion::None)
 
virtual ~IOHandlerDelegate ()=default
 
virtual void IOHandlerDeactivated (IOHandler &io_handler)
 
virtual llvm::Optional< std::stringIOHandlerSuggestion (IOHandler &io_handler, llvm::StringRef line)
 

Static Public Member Functions

static void Initialize ()
 
static void Terminate ()
 
static lldb::REPLSP CreateInstance (Status &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
 
static llvm::StringRef GetPluginNameStatic ()
 
- Static Public Member Functions inherited from lldb_private::REPL
static lldb::REPLSP Create (Status &Status, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
 Get a REPL with an existing target (or, failing that, a debugger to use), and (optional) extra arguments for the compiler. More...
 

Protected Member Functions

Status DoInitialization () override
 
ConstString GetSourceFileBasename () override
 
const char * GetAutoIndentCharacters () override
 
bool SourceIsComplete (const std::string &source) override
 
lldb::offset_t GetDesiredIndentation (const StringList &lines, int cursor_position, int tab_size) override
 
lldb::LanguageType GetLanguage () override
 
bool PrintOneVariable (Debugger &debugger, lldb::StreamFileSP &output_sp, lldb::ValueObjectSP &valobj_sp, ExpressionVariable *var=nullptr) override
 
void CompleteCode (const std::string &current_code, CompletionRequest &request) override
 

Private Attributes

lldb::LanguageType m_language
 The specific C language of this REPL. More...
 
lldb_private::RegularExpression m_implicit_expr_result_regex
 A regex matching the implicitly created LLDB result variables. More...
 

Additional Inherited Members

- Public Types inherited from lldb_private::REPL
enum  LLVMCastKind { eKindClang, eKindSwift, eKindGo, kNumKinds }
 
- Public Types inherited from lldb_private::IOHandlerDelegate
enum  Completion { Completion::None, Completion::LLDBCommand, Completion::Expression }
 
- Static Protected Member Functions inherited from lldb_private::REPL
static int CalculateActualIndentation (const StringList &lines)
 
- Protected Attributes inherited from lldb_private::REPL
OptionGroupFormat m_format_options = OptionGroupFormat(lldb::eFormatDefault)
 
OptionGroupValueObjectDisplay m_varobj_options
 
EvaluateExpressionOptions m_expr_options
 
std::string m_compiler_options
 
bool m_enable_auto_indent = true
 
std::string m_indent_str
 
std::string m_current_indent_str
 
uint32_t m_current_indent_level = 0
 
std::string m_repl_source_path
 
bool m_dedicated_repl_mode = false
 
StringList m_code
 
Targetm_target
 
lldb::IOHandlerSP m_io_handler_sp
 
LLVMCastKind m_kind
 
- Protected Attributes inherited from lldb_private::IOHandlerDelegate
Completion m_completion
 

Detailed Description

Implements a Clang-based REPL for C languages on top of LLDB's REPL framework.

Definition at line 17 of file ClangREPL.h.

Constructor & Destructor Documentation

◆ ClangREPL()

ClangREPL::ClangREPL ( lldb::LanguageType  language,
Target target 
)

Definition at line 18 of file ClangREPL.cpp.

◆ ~ClangREPL()

ClangREPL::~ClangREPL ( )
override

Definition at line 22 of file ClangREPL.cpp.

Member Function Documentation

◆ CompleteCode()

void ClangREPL::CompleteCode ( const std::string current_code,
CompletionRequest request 
)
overrideprotectedvirtual

Implements lldb_private::REPL.

Definition at line 99 of file ClangREPL.cpp.

◆ CreateInstance()

lldb::REPLSP ClangREPL::CreateInstance ( Status error,
lldb::LanguageType  language,
Debugger debugger,
Target target,
const char *  repl_options 
)
static

Definition at line 46 of file ClangREPL.cpp.

References error(), and lldb_private::Target::SetREPL().

Referenced by Initialize(), and Terminate().

◆ DoInitialization()

Status ClangREPL::DoInitialization ( )
overrideprotectedvirtual

Implements lldb_private::REPL.

Definition at line 61 of file ClangREPL.cpp.

◆ GetAutoIndentCharacters()

const char * ClangREPL::GetAutoIndentCharacters ( )
overrideprotectedvirtual

Implements lldb_private::REPL.

Definition at line 67 of file ClangREPL.cpp.

◆ GetDesiredIndentation()

lldb::offset_t ClangREPL::GetDesiredIndentation ( const StringList lines,
int  cursor_position,
int  tab_size 
)
overrideprotectedvirtual

Implements lldb_private::REPL.

Definition at line 75 of file ClangREPL.cpp.

References LLDB_INVALID_OFFSET.

◆ GetLanguage()

lldb::LanguageType ClangREPL::GetLanguage ( )
overrideprotectedvirtual

Implements lldb_private::REPL.

Definition at line 82 of file ClangREPL.cpp.

References m_language.

◆ GetPluginNameStatic()

static llvm::StringRef lldb_private::ClangREPL::GetPluginNameStatic ( )
inlinestatic

Definition at line 31 of file ClangREPL.h.

Referenced by Initialize().

◆ GetSourceFileBasename()

ConstString ClangREPL::GetSourceFileBasename ( )
overrideprotectedvirtual

Implements lldb_private::REPL.

Definition at line 63 of file ClangREPL.cpp.

◆ Initialize()

void ClangREPL::Initialize ( )
static

◆ PrintOneVariable()

bool ClangREPL::PrintOneVariable ( Debugger debugger,
lldb::StreamFileSP &  output_sp,
lldb::ValueObjectSP &  valobj_sp,
ExpressionVariable var = nullptr 
)
overrideprotectedvirtual

◆ SourceIsComplete()

bool ClangREPL::SourceIsComplete ( const std::string source)
overrideprotectedvirtual

Implements lldb_private::REPL.

Definition at line 69 of file ClangREPL.cpp.

◆ Terminate()

void ClangREPL::Terminate ( )
static

Member Data Documentation

◆ m_implicit_expr_result_regex

lldb_private::RegularExpression lldb_private::ClangREPL::m_implicit_expr_result_regex
private

A regex matching the implicitly created LLDB result variables.

Definition at line 59 of file ClangREPL.h.

Referenced by PrintOneVariable().

◆ m_language

lldb::LanguageType lldb_private::ClangREPL::m_language
private

The specific C language of this REPL.

Definition at line 57 of file ClangREPL.h.

Referenced by GetLanguage().


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