[llvm] [DWARF][NFC] Support Roc Language (PR #225631)

Will Hawkins via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 01:05:32 PDT 2026


https://github.com/hawkinsw created https://github.com/llvm/llvm-project/pull/225631

The Roc language has been assigned language codes for DWARF v5 and v6. See [DWARF Issue 260821.1](https://dwarfstd.org/issues/260828.1.html).

>From dd8c77183dc88724d9fef9ecee440f05fdae6843 Mon Sep 17 00:00:00 2001
From: Will Hawkins <hawkinsw at obs.cr>
Date: Wed, 23 Sep 2026 03:55:46 -0400
Subject: [PATCH] [DWARF][NFC] Support Roc Language

The Roc language has been assigned language codes for DWARF v5 and v6.
See [DWARF Issue 260821.1](https://dwarfstd.org/issues/260828.1.html).
---
 llvm/include/llvm-c/DebugInfo.h          | 1 +
 llvm/include/llvm/BinaryFormat/Dwarf.def | 2 ++
 llvm/include/llvm/BinaryFormat/Dwarf.h   | 7 +++++++
 3 files changed, 10 insertions(+)

diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
index 2f7afa3f16aba1..dd7e43445ae3a1 100644
--- a/llvm/include/llvm-c/DebugInfo.h
+++ b/llvm/include/llvm-c/DebugInfo.h
@@ -151,6 +151,7 @@ typedef enum {
   LLVMDWARFSourceLanguageErlang,
   LLVMDWARFSourceLanguageElixir,
   LLVMDWARFSourceLanguageGleam,
+  LLVMDWARFSourceLanguageRoc,
 
   // Vendor extensions:
   LLVMDWARFSourceLanguageMips_Assembler,
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def
index 4c8ced7f7a87d1..f83f86c9bf9e43 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.def
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -1068,6 +1068,7 @@ HANDLE_DW_LANG(0x0045, Nim, 0, 0, DWARF)
 HANDLE_DW_LANG(0x0046, Erlang, 1, 0, DWARF)
 HANDLE_DW_LANG(0x0047, Elixir, 1, 0, DWARF)
 HANDLE_DW_LANG(0x0048, Gleam, 0, 0, DWARF)
+HANDLE_DW_LANG(0x0049, Roc, 0, 0, DWARF)
 
 // Vendor extensions:
 HANDLE_DW_LANG(0x8001, Mips_Assembler, std::nullopt, 0, MIPS)
@@ -1140,6 +1141,7 @@ HANDLE_DW_LNAME(0x002f, Nim, "Nim", 0) // VVMMPP
 HANDLE_DW_LNAME(0x0030, Erlang, "Erlang", 1) // VVMMPP
 HANDLE_DW_LNAME(0x0031, Elixir, "Elixir", 1) // VVMMPP
 HANDLE_DW_LNAME(0x0032, Gleam, "Gleam", 0) // VVMMPP
+HANDLE_DW_LNAME(0x0033, Roc, "Roc", 0) // VVMMPP
 
 // DWARF attribute type encodings.
 HANDLE_DW_ATE(0x01, address, 2, DWARF)
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.h b/llvm/include/llvm/BinaryFormat/Dwarf.h
index fe2c73b28ad207..503efdfc0a999c 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.h
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -391,6 +391,8 @@ inline std::optional<SourceLanguage> toDW_LANG(SourceLanguageName name,
     return DW_LANG_Elixir;
   case DW_LNAME_Gleam:
     return DW_LANG_Gleam;
+  case DW_LNAME_Roc:
+    return DW_LANG_Roc;
   }
   return {};
 }
@@ -541,6 +543,8 @@ toDW_LNAME(SourceLanguage language) {
     return {{DW_LNAME_Elixir, 0}};
   case DW_LANG_Gleam:
     return {{DW_LNAME_Gleam, 0}};
+  case DW_LANG_Roc:
+    return {{DW_LNAME_Roc, 0}};
   case DW_LANG_BORLAND_Delphi:
   case DW_LANG_CPP_for_OpenCL:
   case DW_LANG_lo_user:
@@ -643,6 +647,7 @@ inline bool isCPlusPlus(SourceLanguage S) {
   case DW_LANG_Erlang:
   case DW_LANG_Elixir:
   case DW_LANG_Gleam:
+  case DW_LANG_Roc:
     result = false;
     break;
   }
@@ -734,6 +739,7 @@ inline bool isFortran(SourceLanguage S) {
   case DW_LANG_Erlang:
   case DW_LANG_Elixir:
   case DW_LANG_Gleam:
+  case DW_LANG_Roc:
     result = false;
     break;
   }
@@ -823,6 +829,7 @@ inline bool isC(SourceLanguage S) {
   case DW_LANG_Erlang:
   case DW_LANG_Elixir:
   case DW_LANG_Gleam:
+  case DW_LANG_Roc:
     return false;
   }
 



More information about the llvm-commits mailing list