[Lldb-commits] [lldb] r235153 - Fix "help language", the languages printer was assuming the
Jim Ingham
jingham at apple.com
Thu Apr 16 17:44:36 PDT 2015
Author: jingham
Date: Thu Apr 16 19:44:36 2015
New Revision: 235153
URL: http://llvm.org/viewvc/llvm-project?rev=235153&view=rev
Log:
Fix "help language", the languages printer was assuming the
eLanguageType numbers would be sequential, but vendor types
are not and the printer went crazy.
Modified:
lldb/trunk/include/lldb/Target/LanguageRuntime.h
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Target/LanguageRuntime.cpp
Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=235153&r1=235152&r2=235153&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Thu Apr 16 19:44:36 2015
@@ -91,6 +91,9 @@ public:
static const char *
GetNameForLanguageType (lldb::LanguageType language);
+ static void
+ PrintAllLanguages (Stream &s, const char *prefix, const char *suffix);
+
static bool
LanguageIsCPlusPlus (lldb::LanguageType language);
Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=235153&r1=235152&r2=235153&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Thu Apr 16 19:44:36 2015
@@ -850,12 +850,9 @@ LanguageTypeHelpTextCallback ()
StreamString sstr;
sstr << "One of the following languages:\n";
-
- for (unsigned int l = eLanguageTypeUnknown; l < eNumLanguageTypes; ++l)
- {
- sstr << " " << LanguageRuntime::GetNameForLanguageType(static_cast<LanguageType>(l)) << "\n";
- }
-
+
+ LanguageRuntime::PrintAllLanguages(sstr, " ", "\n");
+
sstr.Flush();
std::string data = sstr.GetString();
Modified: lldb/trunk/source/Target/LanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=235153&r1=235152&r2=235153&view=diff
==============================================================================
--- lldb/trunk/source/Target/LanguageRuntime.cpp (original)
+++ lldb/trunk/source/Target/LanguageRuntime.cpp Thu Apr 16 19:44:36 2015
@@ -369,6 +369,15 @@ LanguageRuntime::GetNameForLanguageType
return language_names[eLanguageTypeUnknown].name;
}
+void
+LanguageRuntime::PrintAllLanguages (Stream &s, const char *prefix, const char *suffix)
+{
+ for (uint32_t i = 1; i < num_languages; i++)
+ {
+ s.Printf("%s%s%s", prefix, language_names[i].name, suffix);
+ }
+}
+
bool
LanguageRuntime::LanguageIsCPlusPlus (LanguageType language)
{
More information about the lldb-commits
mailing list