[PATCH] Add more DWARF 5 language constants.

Bruce Mitchener bruce.mitchener at gmail.com
Thu Feb 5 02:57:02 PST 2015


Hi echristo,

http://reviews.llvm.org/D7430

Files:
  include/llvm/Support/Dwarf.h
  lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  lib/IR/DIBuilder.cpp
  lib/Support/Dwarf.cpp

Index: include/llvm/Support/Dwarf.h
===================================================================
--- include/llvm/Support/Dwarf.h
+++ include/llvm/Support/Dwarf.h
@@ -545,6 +545,14 @@
   DW_LANG_C_plus_plus_03 = 0x0019,
   DW_LANG_C_plus_plus_11 = 0x001a,
   DW_LANG_OCaml = 0x001b,
+  DW_LANG_Rust = 0x001c,
+  DW_LANG_C11 = 0x001d,
+  DW_LANG_Swift = 0x001e,
+  DW_LANG_Julia = 0x001f,
+  DW_LANG_Dylan = 0x0020,
+  DW_LANG_C_plus_plus_14 = 0x0021,
+  DW_LANG_Fortran03 = 0x0022,
+  DW_LANG_Fortran08 = 0x0023,
 
   DW_LANG_lo_user = 0x8000,
   DW_LANG_Mips_Assembler = 0x8001,
Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -130,6 +130,30 @@
     if (dwarf::DWARF_VERSION >= 4)
       return 1;
     break;
+
+  // The languages below have valid values only if the DWARF version >= 5.
+  case dwarf::DW_LANG_OpenCL:
+  case dwarf::DW_LANG_Go:
+  case dwarf::DW_LANG_Haskell:
+  case dwarf::DW_LANG_C_plus_plus_03:
+  case dwarf::DW_LANG_C_plus_plus_11:
+  case dwarf::DW_LANG_OCaml:
+  case dwarf::DW_LANG_Rust:
+  case dwarf::DW_LANG_C11:
+  case dwarf::DW_LANG_Swift:
+  case dwarf::DW_LANG_Dylan:
+  case dwarf::DW_LANG_C_plus_plus_14:
+    if (dwarf::DWARF_VERSION >= 5)
+      return 0;
+    break;
+
+  case dwarf::DW_LANG_Modula3:
+  case dwarf::DW_LANG_Julia:
+  case dwarf::DW_LANG_Fortran03:
+  case dwarf::DW_LANG_Fortran08:
+    if (dwarf::DWARF_VERSION >= 5)
+      return 1;
+    break;
   }
 
   return -1;
Index: lib/IR/DIBuilder.cpp
===================================================================
--- lib/IR/DIBuilder.cpp
+++ lib/IR/DIBuilder.cpp
@@ -145,7 +145,7 @@
                                            DebugEmissionKind Kind,
                                            bool EmitDebugInfo) {
 
-  assert(((Lang <= dwarf::DW_LANG_OCaml && Lang >= dwarf::DW_LANG_C89) ||
+  assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) ||
           (Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
          "Invalid Language tag");
   assert(!Filename.empty() &&
Index: lib/Support/Dwarf.cpp
===================================================================
--- lib/Support/Dwarf.cpp
+++ lib/Support/Dwarf.cpp
@@ -507,6 +507,15 @@
   case DW_LANG_C_plus_plus_03:           return "DW_LANG_C_plus_plus_03";
   case DW_LANG_C_plus_plus_11:           return "DW_LANG_C_plus_plus_11";
   case DW_LANG_OCaml:                    return "DW_LANG_OCaml";
+  case DW_LANG_Rust:                     return "DW_LANG_Rust";
+  case DW_LANG_C11:                      return "DW_LANG_C11";
+  case DW_LANG_Swift:                    return "DW_LANG_Swift";
+  case DW_LANG_Julia:                    return "DW_LANG_Julia";
+  case DW_LANG_Dylan:                    return "DW_LANG_Dylan";
+  case DW_LANG_C_plus_plus_14:           return "DW_LANG_C_plus_plus_14";
+  case DW_LANG_Fortran03:                return "DW_LANG_Fortran03";
+  case DW_LANG_Fortran08:                return "DW_LANG_Fortran08";
+
   case DW_LANG_lo_user:                  return "DW_LANG_lo_user";
   case DW_LANG_Mips_Assembler:           return "DW_LANG_Mips_Assembler";
   case DW_LANG_hi_user:                  return "DW_LANG_hi_user";

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7430.19389.patch
Type: text/x-patch
Size: 3327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150205/314d7884/attachment.bin>


More information about the llvm-commits mailing list