67 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_REPL_CLANG_CLANGREPL_H10#define LLDB_SOURCE_PLUGINS_REPL_CLANG_CLANGREPL_H11 12#include "lldb/Expression/REPL.h"13 14namespace lldb_private {15/// Implements a Clang-based REPL for C languages on top of LLDB's REPL16/// framework.17class ClangREPL : public llvm::RTTIExtends<ClangREPL, REPL> {18public:19 // LLVM RTTI support20 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 30 static lldb::REPLSP CreateInstance(Status &error, lldb::LanguageType language,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 45 lldb::offset_t GetDesiredIndentation(const StringList &lines,46 int cursor_position,47 int tab_size) override;48 49 lldb::LanguageType GetLanguage() override;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 ¤t_code,56 CompletionRequest &request) override;57 58private:59 /// The specific C language of this REPL.60 lldb::LanguageType m_language;61 /// A regex matching the implicitly created LLDB result variables.62 lldb_private::RegularExpression m_implicit_expr_result_regex;63};64} // namespace lldb_private65 66#endif // LLDB_SOURCE_PLUGINS_REPL_CLANG_CLANGREPL_H67