[PATCH] D115300: Add Rust to CodeView SourceLanguage (CV_CFL_LANG) enum

Arlo Siemsen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 7 15:44:31 PST 2021


arlosi created this revision.
arlosi added reviewers: rnk, alok, danielframpton.
arlosi added a project: LLVM.
Herald added subscribers: JDevlieghere, hiraditya.
arlosi requested review of this revision.

Microsoft has added several new entries to the CV_CFL_LANG enum, including Rust:

  https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang

This change adds Rust to the corresponding LLVM enum and translates `dwarf::DW_LANG_Rust` to `SourceLanguage::Rust` in the CodeView AsmPrinter.

This means that Rust will no longer emit as Masm.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115300

Files:
  llvm/include/llvm/DebugInfo/CodeView/CodeView.h
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/test/DebugInfo/COFF/language.ll


Index: llvm/test/DebugInfo/COFF/language.ll
===================================================================
--- llvm/test/DebugInfo/COFF/language.ll
+++ llvm/test/DebugInfo/COFF/language.ll
@@ -36,6 +36,9 @@
 ;
 ; RUN: sed -e 's/<LANG1>/DW_LANG_Fortran08/;s/<LANG2>/Fortran/' %s > %t
 ; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t
+;
+; RUN: sed -e 's/<LANG1>/DW_LANG_Rust/;s/<LANG2>/Rust/' %s > %t
+; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t
 
 ; CHECK:      CodeViewDebugInfo [
 ; CHECK:        Subsection [
Index: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -600,6 +600,8 @@
     return SourceLanguage::D;
   case dwarf::DW_LANG_Swift:
     return SourceLanguage::Swift;
+  case dwarf::DW_LANG_Rust:
+    return SourceLanguage::Rust;
   default:
     // There's no CodeView representation for this language, and CV doesn't
     // have an "unknown" option for the language field, so we'll use MASM,
Index: llvm/include/llvm/DebugInfo/CodeView/CodeView.h
===================================================================
--- llvm/include/llvm/DebugInfo/CodeView/CodeView.h
+++ llvm/include/llvm/DebugInfo/CodeView/CodeView.h
@@ -162,6 +162,8 @@
   MSIL = 0x0f,
   HLSL = 0x10,
 
+  Rust = 0x15,
+
   /// The DMD & Swift compilers emit 'D' and 'S', respectively, for the CV
   /// source language. Microsoft does not have enumerators for them yet.
   D = 'D',


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115300.392575.patch
Type: text/x-patch
Size: 1603 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211207/b0959e63/attachment.bin>


More information about the llvm-commits mailing list