[Lldb-commits] [lldb] acdda13 - [lldb/Lua] Add missing boiler plate to ScriptInterpreter.
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Sat Dec 21 21:56:23 PST 2019
Author: Jonas Devlieghere
Date: 2019-12-21T21:54:44-08:00
New Revision: acdda1344a0e1b45bd3ba7feb0e8cd398bee0179
URL: https://github.com/llvm/llvm-project/commit/acdda1344a0e1b45bd3ba7feb0e8cd398bee0179
DIFF: https://github.com/llvm/llvm-project/commit/acdda1344a0e1b45bd3ba7feb0e8cd398bee0179.diff
LOG: [lldb/Lua] Add missing boiler plate to ScriptInterpreter.
- Fix enum entry order.
- Fix missing enum case in CommandObjectBreakpointCommand.
- Add Lua entry to swtich in LanguageToString and simplify the code.
Added:
Modified:
lldb/include/lldb/lldb-enumerations.h
lldb/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/source/Interpreter/ScriptInterpreter.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index 5640a16c8f44..dd3d9cc7da50 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -211,11 +211,11 @@ enum DescriptionLevel {
/// Script interpreter types.
enum ScriptLanguage {
- eScriptLanguageNone,
+ eScriptLanguageNone = 0,
eScriptLanguagePython,
eScriptLanguageLua,
- eScriptLanguageDefault = eScriptLanguagePython,
- eScriptLanguageUnknown
+ eScriptLanguageUnknown,
+ eScriptLanguageDefault = eScriptLanguagePython
};
/// Register numbering types.
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index d62fe519eca5..551d0ac0081a 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -307,6 +307,7 @@ are no syntax errors may indicate that a function was declared but never called.
m_use_script_language = true;
break;
case eScriptLanguageNone:
+ case eScriptLanguageUnknown:
m_use_script_language = false;
break;
}
diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp
index fd47aed6dcf6..552661ef80ee 100644
--- a/lldb/source/Interpreter/ScriptInterpreter.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreter.cpp
@@ -43,21 +43,16 @@ void ScriptInterpreter::CollectDataForWatchpointCommandCallback(
}
std::string ScriptInterpreter::LanguageToString(lldb::ScriptLanguage language) {
- std::string return_value;
-
switch (language) {
case eScriptLanguageNone:
- return_value = "None";
- break;
+ return "None";
case eScriptLanguagePython:
- return_value = "Python";
- break;
+ return "Python";
+ case eScriptLanguageLua:
+ return "Lua";
case eScriptLanguageUnknown:
- return_value = "Unknown";
- break;
+ return "Unknown";
}
-
- return return_value;
}
lldb::ScriptLanguage
@@ -66,6 +61,8 @@ ScriptInterpreter::StringToLanguage(const llvm::StringRef &language) {
return eScriptLanguageNone;
if (language.equals_lower(LanguageToString(eScriptLanguagePython)))
return eScriptLanguagePython;
+ if (language.equals_lower(LanguageToString(eScriptLanguageLua)))
+ return eScriptLanguageLua;
return eScriptLanguageUnknown;
}
@@ -82,13 +79,12 @@ Status ScriptInterpreter::SetBreakpointCommandCallback(
}
Status ScriptInterpreter::SetBreakpointCommandCallbackFunction(
- std::vector<BreakpointOptions *> &bp_options_vec,
- const char *function_name,
+ std::vector<BreakpointOptions *> &bp_options_vec, const char *function_name,
StructuredData::ObjectSP extra_args_sp) {
Status error;
for (BreakpointOptions *bp_options : bp_options_vec) {
- error = SetBreakpointCommandCallbackFunction(bp_options, function_name,
- extra_args_sp);
+ error = SetBreakpointCommandCallbackFunction(bp_options, function_name,
+ extra_args_sp);
if (!error.Success())
return error;
}
More information about the lldb-commits
mailing list