Fix "help language", the languages printer was assuming the

eLanguageType numbers would be sequential, but vendor types
are not and the printer went crazy.

llvm-svn: 235153
This commit is contained in:
Jim Ingham 2015-04-17 00:44:36 +00:00
parent a09bcd0632
commit de50d36ab3
3 changed files with 15 additions and 6 deletions

View File

@ -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);

View File

@ -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();

View File

@ -369,6 +369,15 @@ LanguageRuntime::GetNameForLanguageType (LanguageType language)
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)
{