[llvm] b70bbaa - DebugInfo: Add support for new DWARFv5 language codes
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 5 17:32:02 PST 2022
Author: David Blaikie
Date: 2022-12-06T01:31:53Z
New Revision: b70bbaaaa9d9a230f45453b4d792637ee19c0ddc
URL: https://github.com/llvm/llvm-project/commit/b70bbaaaa9d9a230f45453b4d792637ee19c0ddc
DIFF: https://github.com/llvm/llvm-project/commit/b70bbaaaa9d9a230f45453b4d792637ee19c0ddc.diff
LOG: DebugInfo: Add support for new DWARFv5 language codes
Added:
Modified:
llvm/include/llvm-c/DebugInfo.h
llvm/include/llvm/BinaryFormat/Dwarf.def
llvm/include/llvm/BinaryFormat/Dwarf.h
llvm/lib/IR/DIBuilder.cpp
llvm/test/DebugInfo/X86/assumed_size_array.ll
llvm/test/DebugInfo/X86/dwarf-public-names.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
index ef6a147eb2a52..122bfccedf5c4 100644
--- a/llvm/include/llvm-c/DebugInfo.h
+++ b/llvm/include/llvm-c/DebugInfo.h
@@ -116,6 +116,15 @@ typedef enum {
LLVMDWARFSourceLanguageFortran08,
LLVMDWARFSourceLanguageRenderScript,
LLVMDWARFSourceLanguageBLISS,
+ LLVMDWARFSourceLanguageKotlin,
+ LLVMDWARFSourceLanguageZig,
+ LLVMDWARFSourceLanguageCrystal,
+ LLVMDWARFSourceLanguageC_plus_plus_17,
+ LLVMDWARFSourceLanguageC_plus_plus_20,
+ LLVMDWARFSourceLanguageC17,
+ LLVMDWARFSourceLanguageFortran18,
+ LLVMDWARFSourceLanguageAda2005,
+ LLVMDWARFSourceLanguageAda2012,
// Vendor extensions:
LLVMDWARFSourceLanguageMips_Assembler,
LLVMDWARFSourceLanguageGOOGLE_RenderScript,
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def
index fad4bb936ee09..1409568b8664f 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.def
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -915,11 +915,22 @@ HANDLE_DW_LANG(0x0022, Fortran03, 1, 5, DWARF)
HANDLE_DW_LANG(0x0023, Fortran08, 1, 5, DWARF)
HANDLE_DW_LANG(0x0024, RenderScript, 0, 5, DWARF)
HANDLE_DW_LANG(0x0025, BLISS, 0, 5, DWARF)
+// New since DWARF v5:
+HANDLE_DW_LANG(0x0026, Kotlin, 0, 0, DWARF)
+HANDLE_DW_LANG(0x0027, Zig, 0, 0, DWARF)
+HANDLE_DW_LANG(0x0028, Crystal, 0, 0, DWARF)
+HANDLE_DW_LANG(0x002a, C_plus_plus_17, 0, 0, DWARF)
+HANDLE_DW_LANG(0x002b, C_plus_plus_20, 0, 0, DWARF)
+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)
// Vendor extensions:
HANDLE_DW_LANG(0x8001, Mips_Assembler, std::nullopt, 0, MIPS)
HANDLE_DW_LANG(0x8e57, GOOGLE_RenderScript, 0, 0, GOOGLE)
HANDLE_DW_LANG(0xb000, BORLAND_Delphi, 0, 0, BORLAND)
+
// DWARF attribute type encodings.
HANDLE_DW_ATE(0x01, address, 2, DWARF)
HANDLE_DW_ATE(0x02, boolean, 2, DWARF)
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.h b/llvm/include/llvm/BinaryFormat/Dwarf.h
index 72e008d8a92c7..89b239c37245e 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.h
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -216,6 +216,8 @@ inline bool isCPlusPlus(SourceLanguage S) {
case DW_LANG_C_plus_plus_03:
case DW_LANG_C_plus_plus_11:
case DW_LANG_C_plus_plus_14:
+ case DW_LANG_C_plus_plus_17:
+ case DW_LANG_C_plus_plus_20:
result = true;
break;
case DW_LANG_C89:
@@ -256,6 +258,13 @@ inline bool isCPlusPlus(SourceLanguage S) {
case DW_LANG_BORLAND_Delphi:
case DW_LANG_lo_user:
case DW_LANG_hi_user:
+ case DW_LANG_Kotlin:
+ case DW_LANG_Zig:
+ case DW_LANG_Crystal:
+ case DW_LANG_C17:
+ case DW_LANG_Fortran18:
+ case DW_LANG_Ada2005:
+ case DW_LANG_Ada2012:
result = false;
break;
}
@@ -274,6 +283,7 @@ inline bool isFortran(SourceLanguage S) {
case DW_LANG_Fortran95:
case DW_LANG_Fortran03:
case DW_LANG_Fortran08:
+ case DW_LANG_Fortran18:
result = true;
break;
case DW_LANG_C89:
@@ -313,6 +323,14 @@ inline bool isFortran(SourceLanguage S) {
case DW_LANG_BORLAND_Delphi:
case DW_LANG_lo_user:
case DW_LANG_hi_user:
+ case DW_LANG_Kotlin:
+ case DW_LANG_Zig:
+ case DW_LANG_Crystal:
+ case DW_LANG_C_plus_plus_17:
+ case DW_LANG_C_plus_plus_20:
+ case DW_LANG_C17:
+ case DW_LANG_Ada2005:
+ case DW_LANG_Ada2012:
result = false;
break;
}
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 8cb8303852b35..5028f549ef12e 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -156,7 +156,7 @@ DICompileUnit *DIBuilder::createCompileUnit(
DICompileUnit::DebugNameTableKind NameTableKind, bool RangesBaseAddress,
StringRef SysRoot, StringRef SDK) {
- assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) ||
+ assert(((Lang <= dwarf::DW_LANG_Ada2012 && Lang >= dwarf::DW_LANG_C89) ||
(Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
"Invalid Language tag");
diff --git a/llvm/test/DebugInfo/X86/assumed_size_array.ll b/llvm/test/DebugInfo/X86/assumed_size_array.ll
index cad7afdd68b59..6e8f13c310c0a 100644
--- a/llvm/test/DebugInfo/X86/assumed_size_array.ll
+++ b/llvm/test/DebugInfo/X86/assumed_size_array.ll
@@ -3,6 +3,11 @@
; RUN: llc -mtriple=x86_64-unknown-linux-gnu %s -filetype=obj -o %t.o
; RUN: llvm-dwarfdump %t.o | FileCheck %s
+; RUN: rm -rf %t
+; RUN: mkdir %t
+; RUN: sed -e "s/Fortran90/Fortran18/" %s > %t/test.ll
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu %t/test.ll -filetype=obj -o %t/test.o
+; RUN: llvm-dwarfdump %t/test.o | FileCheck %s
; CHECK-LABEL: DW_TAG_formal_parameter
; CHECK: DW_AT_name ("array1")
diff --git a/llvm/test/DebugInfo/X86/dwarf-public-names.ll b/llvm/test/DebugInfo/X86/dwarf-public-names.ll
index 30b83df63c251..22bd123506a8d 100644
--- a/llvm/test/DebugInfo/X86/dwarf-public-names.ll
+++ b/llvm/test/DebugInfo/X86/dwarf-public-names.ll
@@ -4,6 +4,24 @@
; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck --check-prefix=NOPUB %s
; RUN: llc -mtriple=x86_64-scei-ps4 -filetype=obj -o %t.o < %s
; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck --check-prefix=NOPUB %s
+
+; RUN: rm -rf %t
+; RUN: mkdir %t
+; RUN: sed -e "s/C_plus_plus/C_plus_plus_03/" %s > %t/test.ll
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t/test.o < %t/test.ll
+; RUN: llvm-dwarfdump -debug-pubnames %t/test.o | FileCheck --check-prefix=LINUX %s
+; RUN: sed -e "s/C_plus_plus/C_plus_plus_11/" %s > %t/test.ll
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t/test.o < %t/test.ll
+; RUN: llvm-dwarfdump -debug-pubnames %t/test.o | FileCheck --check-prefix=LINUX %s
+; RUN: sed -e "s/C_plus_plus/C_plus_plus_14/" %s > %t/test.ll
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t/test.o < %t/test.ll
+; RUN: llvm-dwarfdump -debug-pubnames %t/test.o | FileCheck --check-prefix=LINUX %s
+; RUN: sed -e "s/C_plus_plus/C_plus_plus_17/" %s > %t/test.ll
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t/test.o < %t/test.ll
+; RUN: llvm-dwarfdump -debug-pubnames %t/test.o | FileCheck --check-prefix=LINUX %s
+; RUN: sed -e "s/C_plus_plus/C_plus_plus_20/" %s > %t/test.ll
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t/test.o < %t/test.ll
+; RUN: llvm-dwarfdump -debug-pubnames %t/test.o | FileCheck --check-prefix=LINUX %s
; ModuleID = 'dwarf-public-names.cpp'
;
; Generated from:
More information about the llvm-commits
mailing list