summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/lldb-enumerations.h7
-rw-r--r--lldb/source/Core/Language.cpp20
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp20
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h3
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp8
-rw-r--r--lldb/source/Target/LanguageRuntime.cpp1
6 files changed, 49 insertions, 10 deletions
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index df788ddf1ca..ea891052586 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -421,7 +421,12 @@ namespace lldb {
eLanguageTypeFortran03 = 0x0022, ///< ISO Fortran 2003.
eLanguageTypeFortran08 = 0x0023, ///< ISO Fortran 2008.
// Vendor Extensions
- eLanguageTypeExtRenderScript = 0x8e57, ///< RenderScript
+ // Note: LanguageRuntime::GetNameForLanguageType
+ // assumes these can be used as indexes into array language_names, and
+ // Language::SetLanguageFromCString and Language::AsCString
+ // assume these can be used as indexes into array g_languages.
+ eLanguageTypeMipsAssembler = 0x0024, ///< Mips_Assembler.
+ eLanguageTypeExtRenderScript = 0x0025, ///< RenderScript.
eNumLanguageTypes
};
diff --git a/lldb/source/Core/Language.cpp b/lldb/source/Core/Language.cpp
index 1ffd5aadc52..1cc4b8a0dc9 100644
--- a/lldb/source/Core/Language.cpp
+++ b/lldb/source/Core/Language.cpp
@@ -46,7 +46,25 @@ g_languages[] =
{ { "objc++" , NULL , "Objective-C++" } },
{ { "upc" , NULL , "Unified Parallel C" } },
{ { "d" , NULL , "D" } },
- { { "python" , NULL , "Python" } }
+ { { "python" , NULL , "Python" } },
+ { { "opencl" , "OpenCL" , "OpenCL" } },
+ { { "go" , "Go" , "Go" } },
+ { { "modula3" , "Modula3" , "Modula 3" } },
+ { { "haskell" , "Haskell" , "Haskell" } },
+ { { "c++03" , "C_plus_plus_03" , "ISO C++:2003" } },
+ { { "c++11" , "C_plus_plus_11" , "ISO C++:2011" } },
+ { { "ocaml" , "OCaml" , "OCaml" } },
+ { { "rust" , "Rust" , "Rust" } },
+ { { "c11" , "C11" , "ISO C:2011" } },
+ { { "swift" , "Swift" , "Swift" } },
+ { { "julia" , "Julia" , "Julia" } },
+ { { "dylan" , "Dylan" , "Dylan" } },
+ { { "c++14" , "C_plus_plus_14" , "ISO C++:2014" } },
+ { { "f03" , "Fortran03" , "ISO Fortran 2003" } },
+ { { "f08" , "Fortran08" , "ISO Fortran 2008" } },
+ // Vendor Extensions
+ { { "mipsassem" , "Mips_Assembler" , "Mips Assembler" } },
+ { { "renderscript" , "RenderScript" , "RenderScript" } }
};
static const size_t g_num_languages = llvm::array_lengthof(g_languages);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index 9264411c1dd..75934f966bc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -1070,6 +1070,22 @@ DWARFCompileUnit::GetProducerVersionUpdate()
}
LanguageType
+DWARFCompileUnit::LanguageTypeFromDWARF(uint64_t val)
+{
+ // Note: user languages between lo_user and hi_user
+ // must be handled explicitly here.
+ switch (val)
+ {
+ case DW_LANG_Mips_Assembler:
+ return eLanguageTypeMipsAssembler;
+ case 0x8e57: // FIXME: needs to be added to llvm
+ return eLanguageTypeExtRenderScript;
+ default:
+ return static_cast<LanguageType>(val);
+ }
+}
+
+LanguageType
DWARFCompileUnit::GetLanguageType()
{
if (m_language_type != eLanguageTypeUnknown)
@@ -1077,8 +1093,8 @@ DWARFCompileUnit::GetLanguageType()
const DWARFDebugInfoEntry *die = GetCompileUnitDIEOnly();
if (die)
- m_language_type = static_cast<LanguageType>(
- die->GetAttributeValueAsUnsigned(m_dwarf2Data, this, DW_AT_language, eLanguageTypeUnknown));
+ m_language_type = LanguageTypeFromDWARF(
+ die->GetAttributeValueAsUnsigned(m_dwarf2Data, this, DW_AT_language, 0));
return m_language_type;
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
index fff2701a43d..93c8df822dc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -187,6 +187,9 @@ public:
uint32_t
GetProducerVersionUpdate();
+ static lldb::LanguageType
+ LanguageTypeFromDWARF(uint64_t val);
+
lldb::LanguageType
GetLanguageType();
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 6078d3a19a1..854481e8f1b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -989,7 +989,7 @@ SymbolFileDWARF::ParseCompileUnit (DWARFCompileUnit* dwarf_cu, uint32_t cu_idx)
if (module_sp->RemapSourceFile(cu_file_spec.GetCString(), remapped_file))
cu_file_spec.SetFile(remapped_file, false);
- LanguageType cu_language = (LanguageType)cu_die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_language, 0);
+ LanguageType cu_language = DWARFCompileUnit::LanguageTypeFromDWARF(cu_die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_language, 0));
cu_sp.reset(new CompileUnit (module_sp,
dwarf_cu,
@@ -1192,11 +1192,7 @@ SymbolFileDWARF::ParseCompileUnitLanguage (const SymbolContext& sc)
{
const DWARFDebugInfoEntry *die = dwarf_cu->GetCompileUnitDIEOnly();
if (die)
- {
- const uint32_t language = die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_language, 0);
- if (language)
- return (lldb::LanguageType)language;
- }
+ return DWARFCompileUnit::LanguageTypeFromDWARF(die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_language, 0));
}
return eLanguageTypeUnknown;
}
diff --git a/lldb/source/Target/LanguageRuntime.cpp b/lldb/source/Target/LanguageRuntime.cpp
index 6008cacd160..9c7b441d4c5 100644
--- a/lldb/source/Target/LanguageRuntime.cpp
+++ b/lldb/source/Target/LanguageRuntime.cpp
@@ -367,6 +367,7 @@ struct language_name_pair language_names[] =
{ "fortran03", eLanguageTypeFortran03 },
{ "fortran08", eLanguageTypeFortran08 },
// Vendor Extensions
+ { "mipsassem", eLanguageTypeMipsAssembler },
{ "renderscript", eLanguageTypeExtRenderScript},
// Now synonyms, in arbitrary order
{ "objc", eLanguageTypeObjC },
OpenPOWER on IntegriCloud