[llvm] 582582f - [LLDB] Add DWARF definitions for the new Mojo language
walter erquinigo via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 26 09:33:46 PDT 2023
Author: walter erquinigo
Date: 2023-06-26T11:31:48-05:00
New Revision: 582582fb474b8cd4103e65c3e5a705b3aff61794
URL: https://github.com/llvm/llvm-project/commit/582582fb474b8cd4103e65c3e5a705b3aff61794
DIFF: https://github.com/llvm/llvm-project/commit/582582fb474b8cd4103e65c3e5a705b3aff61794.diff
LOG: [LLDB] Add DWARF definitions for the new Mojo language
The new language Mojo recently received a proper DWARF code, which can be seen in https://dwarfstd.org/languages.html, and this patch adds the basic definitions for using this language in DWARF.
Differential Revision: https://reviews.llvm.org/D153073
Added:
Modified:
lldb/include/lldb/lldb-enumerations.h
lldb/source/Target/Language.cpp
llvm/include/llvm-c/DebugInfo.h
llvm/include/llvm/BinaryFormat/Dwarf.def
llvm/include/llvm/BinaryFormat/Dwarf.h
llvm/lib/IR/DIBuilder.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index da5b88c1fb164..3981eb0acfccf 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -490,16 +490,16 @@ enum LanguageType {
eLanguageTypeFortran18 = 0x002d,
eLanguageTypeAda2005 = 0x002e,
eLanguageTypeAda2012 = 0x002f,
+ eLanguageTypeMojo = 0x0033,
// Vendor Extensions
// Note: Language::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, ///< Mips_Assembler.
+ eLanguageTypeMipsAssembler, ///< Mips_Assembler.
// Mojo will move to the common list of languages once the DWARF committee
// creates a language code for it.
- eLanguageTypeMojo,
eNumLanguageTypes
};
diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp
index a307cb345c005..77ba946012b00 100644
--- a/lldb/source/Target/Language.cpp
+++ b/lldb/source/Target/Language.cpp
@@ -209,9 +209,9 @@ struct language_name_pair language_names[] = {
{"fortran18", eLanguageTypeFortran18},
{"ada2005", eLanguageTypeAda2005},
{"ada2012", eLanguageTypeAda2012},
+ {"mojo", eLanguageTypeMojo},
// Vendor Extensions
{"assembler", eLanguageTypeMipsAssembler},
- {"mojo", eLanguageTypeMojo},
// Now synonyms, in arbitrary order
{"objc", eLanguageTypeObjC},
{"objc++", eLanguageTypeObjC_plus_plus},
@@ -457,12 +457,12 @@ Language::GetFormatterPrefixSuffix(llvm::StringRef type_hint) {
return std::pair<llvm::StringRef, llvm::StringRef>();
}
-bool Language::DemangledNameContainsPath(llvm::StringRef path,
+bool Language::DemangledNameContainsPath(llvm::StringRef path,
ConstString demangled) const {
// The base implementation does a simple contains comparision:
if (path.empty())
return false;
- return demangled.GetStringRef().contains(path);
+ return demangled.GetStringRef().contains(path);
}
DumpValueObjectOptions::DeclPrintingHelper Language::GetDeclPrintingHelper() {
diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
index fe3a64ed3dfda..5924294708cc3 100644
--- a/llvm/include/llvm-c/DebugInfo.h
+++ b/llvm/include/llvm-c/DebugInfo.h
@@ -125,6 +125,7 @@ typedef enum {
LLVMDWARFSourceLanguageFortran18,
LLVMDWARFSourceLanguageAda2005,
LLVMDWARFSourceLanguageAda2012,
+ LLVMDWARFSourceLanguageMojo,
// Vendor extensions:
LLVMDWARFSourceLanguageMips_Assembler,
LLVMDWARFSourceLanguageGOOGLE_RenderScript,
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def
index d0357bec0bbf5..40d958c867de9 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.def
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -948,6 +948,7 @@ HANDLE_DW_LANG(0x002c, C17, 0, 0, DWARF)
HANDLE_DW_LANG(0x002d, Fortran18, 0, 0, DWARF)
HANDLE_DW_LANG(0x002e, Ada2005, 0, 0, DWARF)
HANDLE_DW_LANG(0x002f, Ada2012, 0, 0, DWARF)
+HANDLE_DW_LANG(0x0033, Mojo, 0, 0, DWARF)
// Vendor extensions:
HANDLE_DW_LANG(0x8001, Mips_Assembler, std::nullopt, 0, MIPS)
HANDLE_DW_LANG(0x8e57, GOOGLE_RenderScript, 0, 0, GOOGLE)
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.h b/llvm/include/llvm/BinaryFormat/Dwarf.h
index c4d0232ac6c75..869352b35e323 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.h
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -268,6 +268,7 @@ inline bool isCPlusPlus(SourceLanguage S) {
case DW_LANG_Fortran18:
case DW_LANG_Ada2005:
case DW_LANG_Ada2012:
+ case DW_LANG_Mojo:
result = false;
break;
}
@@ -334,6 +335,7 @@ inline bool isFortran(SourceLanguage S) {
case DW_LANG_C17:
case DW_LANG_Ada2005:
case DW_LANG_Ada2012:
+ case DW_LANG_Mojo:
result = false;
break;
}
@@ -398,6 +400,7 @@ inline bool isC(SourceLanguage S) {
case DW_LANG_Fortran18:
case DW_LANG_Ada2005:
case DW_LANG_Ada2012:
+ case DW_LANG_Mojo:
return false;
}
llvm_unreachable("Unknown language kind.");
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 0e6b974cb60f4..1ce8c17f8a880 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -140,7 +140,7 @@ DICompileUnit *DIBuilder::createCompileUnit(
DICompileUnit::DebugNameTableKind NameTableKind, bool RangesBaseAddress,
StringRef SysRoot, StringRef SDK) {
- assert(((Lang <= dwarf::DW_LANG_Ada2012 && Lang >= dwarf::DW_LANG_C89) ||
+ assert(((Lang <= dwarf::DW_LANG_Mojo && Lang >= dwarf::DW_LANG_C89) ||
(Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
"Invalid Language tag");
More information about the llvm-commits
mailing list