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
13
14namespace lldb_private {
15/// Implements a Clang-based REPL for C languages on top of LLDB's REPL
16/// framework.
17class ClangREPL : public llvm::RTTIExtends<ClangREPL, REPL> {
18public:
19 // LLVM RTTI support
20 static char ID;
21
22 ClangREPL(lldb::LanguageType language, Target &target);
23
24 ~ClangREPL() override;
25
26 static void Initialize();
27
28 static void Terminate();
29
31 Debugger *debugger, Target *target,
32 const char *repl_options);
33
34 static llvm::StringRef GetPluginNameStatic() { return "ClangREPL"; }
35
36protected:
37 Status DoInitialization() override;
38
39 llvm::StringRef GetSourceFileBasename() override;
40
41 const char *GetAutoIndentCharacters() override;
42
43 bool SourceIsComplete(const std::string &source) override;
44
46 int cursor_position,
47 int tab_size) override;
48
50
51 bool PrintOneVariable(Debugger &debugger, lldb::StreamFileSP &output_sp,
52 lldb::ValueObjectSP &valobj_sp,
53 ExpressionVariable *var = nullptr) override;
54
55 void CompleteCode(const std::string &current_code,
56 CompletionRequest &request) override;
57
58private:
59 /// The specific C language of this REPL.
61 /// A regex matching the implicitly created LLDB result variables.
63};
64} // namespace lldb_private
65
66#endif // LLDB_SOURCE_PLUGINS_REPL_CLANG_CLANGREPL_H
static llvm::raw_ostream & error(Stream &strm)
Implements a Clang-based REPL for C languages on top of LLDB's REPL framework.
Definition: ClangREPL.h:17
lldb::LanguageType GetLanguage() override
Definition: ClangREPL.cpp:85
static void Initialize()
Definition: ClangREPL.cpp:26
static void Terminate()
Definition: ClangREPL.cpp:44
const char * GetAutoIndentCharacters() override
Definition: ClangREPL.cpp:70
lldb_private::RegularExpression m_implicit_expr_result_regex
A regex matching the implicitly created LLDB result variables.
Definition: ClangREPL.h:62
static llvm::StringRef GetPluginNameStatic()
Definition: ClangREPL.h:34
static lldb::REPLSP CreateInstance(Status &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
Definition: ClangREPL.cpp:48
Status DoInitialization() override
Definition: ClangREPL.cpp:63
void CompleteCode(const std::string &current_code, CompletionRequest &request) override
Definition: ClangREPL.cpp:102
llvm::StringRef GetSourceFileBasename() override
Definition: ClangREPL.cpp:65
lldb::offset_t GetDesiredIndentation(const StringList &lines, int cursor_position, int tab_size) override
Definition: ClangREPL.cpp:78
bool SourceIsComplete(const std::string &source) override
Definition: ClangREPL.cpp:72
bool PrintOneVariable(Debugger &debugger, lldb::StreamFileSP &output_sp, lldb::ValueObjectSP &valobj_sp, ExpressionVariable *var=nullptr) override
Definition: ClangREPL.cpp:87
lldb::LanguageType m_language
The specific C language of this REPL.
Definition: ClangREPL.h:60
"lldb/Utility/ArgCompletionRequest.h"
A class to manage flag bits.
Definition: Debugger.h:79
An error handling class.
Definition: Status.h:44
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:472
uint64_t offset_t
Definition: lldb-types.h:83
LanguageType
Programming language type.
std::shared_ptr< lldb_private::StreamFile > StreamFileSP
Definition: lldb-forward.h:421
std::shared_ptr< lldb_private::REPL > REPLSP
Definition: lldb-forward.h:393