Page MenuHomePhabricator

LanguageType string table lookups

Authored by dawn on Jun 16 2015, 3:06 PM.



The LanguageType enums are used as indexes into array language_names and g_languages in LanguageRuntime::GetNameForLanguageType, Language::SetLanguageFromCString and Language::AsCString. This patch fixes the enum LanguageType values and language string table lookups for user defined languages (with DWARF values above DW_LANG_lo_user = 0x8000), by using a conversion routine to convert the DWARF value to it's corresponding LanguageType enum.


  • Fix enum LanguageType values so that they can be used as indexes.
  • Add DWARFCompileUnit::LanguageTypeFromDWARF to convert from DWARF DW_LANG_* values to enum LanguageType values.

Note: Support for the RenderScript was added in svn commit 234002, but I don't see how it could have ever worked, since the LanguageType values are used as indexes into string tables. The DWARF value was hardcoded as part of this fix since it doesn't exist in llvm.

Diff Detail


Event Timeline

dawn updated this revision to Diff 27781.Jun 16 2015, 3:06 PM
dawn retitled this revision from to LanguageType string table lookups.
dawn updated this object.
dawn edited the test plan for this revision. (Show Details)
dawn set the repository for this revision to rL LLVM.
dawn edited the test plan for this revision. (Show Details)Jun 16 2015, 4:37 PM
dawn added reviewers: domipheus, abidh, clayborg.
dawn added a subscriber: Unknown Object (MLST).
abidh accepted this revision.Jun 17 2015, 1:37 AM
abidh edited edge metadata.


1073 ↗(On Diff #27781)

It would be good to add a comment here warning user to handle the language between lo_user and hi_user explicitly.

This revision is now accepted and ready to land.Jun 17 2015, 1:37 AM
clayborg accepted this revision.Jun 17 2015, 10:11 AM
clayborg edited edge metadata.


This revision was automatically updated to reflect the committed changes.