]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / ScriptInterpreter / None / ScriptInterpreterNone.cpp
1 //===-- ScriptInterpreterNone.cpp -------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "ScriptInterpreterNone.h"
11 #include "lldb/Core/Debugger.h"
12 #include "lldb/Core/PluginManager.h"
13 #include "lldb/Core/StreamFile.h"
14 #include "lldb/Interpreter/CommandInterpreter.h"
15 #include "lldb/Utility/Stream.h"
16 #include "lldb/Utility/StringList.h"
17
18 #include "llvm/Support/Threading.h"
19
20 #include <mutex>
21
22 using namespace lldb;
23 using namespace lldb_private;
24
25 ScriptInterpreterNone::ScriptInterpreterNone(CommandInterpreter &interpreter)
26     : ScriptInterpreter(interpreter, eScriptLanguageNone) {}
27
28 ScriptInterpreterNone::~ScriptInterpreterNone() {}
29
30 bool ScriptInterpreterNone::ExecuteOneLine(llvm::StringRef command,
31                                            CommandReturnObject *,
32                                            const ExecuteScriptOptions &) {
33   m_interpreter.GetDebugger().GetErrorFile()->PutCString(
34       "error: there is no embedded script interpreter in this mode.\n");
35   return false;
36 }
37
38 void ScriptInterpreterNone::ExecuteInterpreterLoop() {
39   m_interpreter.GetDebugger().GetErrorFile()->PutCString(
40       "error: there is no embedded script interpreter in this mode.\n");
41 }
42
43 void ScriptInterpreterNone::Initialize() {
44   static llvm::once_flag g_once_flag;
45
46   llvm::call_once(g_once_flag, []() {
47     PluginManager::RegisterPlugin(GetPluginNameStatic(),
48                                   GetPluginDescriptionStatic(),
49                                   lldb::eScriptLanguageNone, CreateInstance);
50   });
51 }
52
53 void ScriptInterpreterNone::Terminate() {}
54
55 lldb::ScriptInterpreterSP
56 ScriptInterpreterNone::CreateInstance(CommandInterpreter &interpreter) {
57   return std::make_shared<ScriptInterpreterNone>(interpreter);
58 }
59
60 lldb_private::ConstString ScriptInterpreterNone::GetPluginNameStatic() {
61   static ConstString g_name("script-none");
62   return g_name;
63 }
64
65 const char *ScriptInterpreterNone::GetPluginDescriptionStatic() {
66   return "Null script interpreter";
67 }
68
69 lldb_private::ConstString ScriptInterpreterNone::GetPluginName() {
70   return GetPluginNameStatic();
71 }
72
73 uint32_t ScriptInterpreterNone::GetPluginVersion() { return 1; }