[Lldb-commits] [lldb] r362268 - [Commands] Stop hardcoding languages in CommandObjectType
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Fri May 31 15:15:30 PDT 2019
Author: xiaobai
Date: Fri May 31 15:15:29 2019
New Revision: 362268
URL: http://llvm.org/viewvc/llvm-project?rev=362268&view=rev
Log:
[Commands] Stop hardcoding languages in CommandObjectType
Modified:
lldb/trunk/source/Commands/CommandObjectType.cpp
Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=362268&r1=362267&r2=362268&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Fri May 31 15:15:29 2019
@@ -2806,17 +2806,11 @@ public:
return m_cmd_help_long;
StreamString stream;
- // FIXME: hardcoding languages is not good
- lldb::LanguageType languages[] = {eLanguageTypeObjC,
- eLanguageTypeC_plus_plus};
-
- for (const auto lang_type : languages) {
- if (auto language = Language::FindPlugin(lang_type)) {
- if (const char *help = language->GetLanguageSpecificTypeLookupHelp()) {
- stream.Printf("%s\n", help);
- }
- }
- }
+ Language::ForEach([&](Language *lang) {
+ if (const char *help = lang->GetLanguageSpecificTypeLookupHelp())
+ stream.Printf("%s\n", help);
+ return true;
+ });
m_cmd_help_long = stream.GetString();
return m_cmd_help_long;
@@ -2852,9 +2846,10 @@ public:
if ((is_global_search =
(m_command_options.m_language == eLanguageTypeUnknown))) {
- // FIXME: hardcoding languages is not good
- languages.push_back(Language::FindPlugin(eLanguageTypeObjC));
- languages.push_back(Language::FindPlugin(eLanguageTypeC_plus_plus));
+ Language::ForEach([&](Language *lang) {
+ languages.push_back(lang);
+ return true;
+ });
} else {
languages.push_back(Language::FindPlugin(m_command_options.m_language));
}
More information about the lldb-commits
mailing list