LLDB  mainline
ClangREPL.h
Go to the documentation of this file.
1 //===-- ClangREPL.h ---------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SOURCE_PLUGINS_REPL_CLANG_CLANGREPL_H
10 #define LLDB_SOURCE_PLUGINS_REPL_CLANG_CLANGREPL_H
11 
12 #include "lldb/Expression/REPL.h"
13 
14 namespace lldb_private {
15 /// Implements a Clang-based REPL for C languages on top of LLDB's REPL
16 /// framework.
17 class ClangREPL : public REPL {
18 public:
19  ClangREPL(lldb::LanguageType language, Target &target);
20 
21  ~ClangREPL() override;
22 
23  static void Initialize();
24 
25  static void Terminate();
26 
27  static lldb::REPLSP CreateInstance(Status &error, lldb::LanguageType language,
28  Debugger *debugger, Target *target,
29  const char *repl_options);
30 
31  static llvm::StringRef GetPluginNameStatic() { return "ClangREPL"; }
32 
33 protected:
34  Status DoInitialization() override;
35 
37 
38  const char *GetAutoIndentCharacters() override;
39 
40  bool SourceIsComplete(const std::string &source) override;
41 
43  int cursor_position,
44  int tab_size) override;
45 
47 
48  bool PrintOneVariable(Debugger &debugger, lldb::StreamFileSP &output_sp,
49  lldb::ValueObjectSP &valobj_sp,
50  ExpressionVariable *var = nullptr) override;
51 
52  void CompleteCode(const std::string &current_code,
53  CompletionRequest &request) override;
54 
55 private:
56  /// The specific C language of this REPL.
58  /// A regex matching the implicitly created LLDB result variables.
60 };
61 } // namespace lldb_private
62 
63 #endif // LLDB_SOURCE_PLUGINS_REPL_CLANG_CLANGREPL_H
lldb_private::ClangREPL::GetLanguage
lldb::LanguageType GetLanguage() override
Definition: ClangREPL.cpp:82
lldb_private::ClangREPL::Terminate
static void Terminate()
Definition: ClangREPL.cpp:42
lldb_private::REPL
Definition: REPL.h:21
lldb_private::RegularExpression
Definition: RegularExpression.h:18
lldb_private::ClangREPL::DoInitialization
Status DoInitialization() override
Definition: ClangREPL.cpp:61
lldb_private::ClangREPL::GetPluginNameStatic
static llvm::StringRef GetPluginNameStatic()
Definition: ClangREPL.h:31
lldb_private::ClangREPL::GetDesiredIndentation
lldb::offset_t GetDesiredIndentation(const StringList &lines, int cursor_position, int tab_size) override
Definition: ClangREPL.cpp:75
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::Target
Definition: Target.h:467
lldb_private::ClangREPL
Implements a Clang-based REPL for C languages on top of LLDB's REPL framework.
Definition: ClangREPL.h:17
lldb_private::ClangREPL::GetAutoIndentCharacters
const char * GetAutoIndentCharacters() override
Definition: ClangREPL.cpp:67
lldb_private::ClangREPL::ClangREPL
ClangREPL(lldb::LanguageType language, Target &target)
Definition: ClangREPL.cpp:18
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
REPL.h
lldb_private::ClangREPL::SourceIsComplete
bool SourceIsComplete(const std::string &source) override
Definition: ClangREPL.cpp:69
lldb_private::ClangREPL::~ClangREPL
~ClangREPL() override
lldb_private::ClangREPL::Initialize
static void Initialize()
Definition: ClangREPL.cpp:24
lldb_private::ClangREPL::GetSourceFileBasename
ConstString GetSourceFileBasename() override
Definition: ClangREPL.cpp:63
lldb_private::ClangREPL::m_implicit_expr_result_regex
lldb_private::RegularExpression m_implicit_expr_result_regex
A regex matching the implicitly created LLDB result variables.
Definition: ClangREPL.h:59
lldb_private::StringList
Definition: StringList.h:26
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::ClangREPL::m_language
lldb::LanguageType m_language
The specific C language of this REPL.
Definition: ClangREPL.h:57
lldb_private::Debugger
Definition: Debugger.h:74
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::ExpressionVariable
Definition: ExpressionVariable.h:23
lldb_private::Status
Definition: Status.h:44
lldb_private::ClangREPL::PrintOneVariable
bool PrintOneVariable(Debugger &debugger, lldb::StreamFileSP &output_sp, lldb::ValueObjectSP &valobj_sp, ExpressionVariable *var=nullptr) override
Definition: ClangREPL.cpp:84
lldb_private::ClangREPL::CompleteCode
void CompleteCode(const std::string &current_code, CompletionRequest &request) override
Definition: ClangREPL.cpp:99
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
lldb_private::ClangREPL::CreateInstance
static lldb::REPLSP CreateInstance(Status &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
Definition: ClangREPL.cpp:46