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

Arlo Siemsen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 8 10:40:09 PST 2021


arlosi updated this revision to Diff 392831.
arlosi added a comment.

Adds Rust to a few more places that were missed. Test should pass now.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115300/new/

https://reviews.llvm.org/D115300

Files:
  llvm/include/llvm/DebugInfo/CodeView/CodeView.h
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/lib/DebugInfo/CodeView/EnumTables.cpp
  llvm/lib/DebugInfo/PDB/PDBExtras.cpp
  llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
  llvm/test/DebugInfo/COFF/language.ll
  llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp


Index: llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
===================================================================
--- llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
+++ llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
@@ -207,6 +207,7 @@
     RETURN_CASE(SourceLanguage, HLSL, "hlsl");
     RETURN_CASE(SourceLanguage, D, "d");
     RETURN_CASE(SourceLanguage, Swift, "swift");
+    RETURN_CASE(SourceLanguage, Rust, "rust");
   }
   return formatUnknownEnum(Lang);
 }
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/DebugInfo/PDB/PDBSymbolCompiland.cpp
===================================================================
--- llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
+++ llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
@@ -100,6 +100,7 @@
               .Case(".c", Lang == PDB_Lang::C)
               .Case(".asm", Lang == PDB_Lang::Masm)
               .Case(".swift", Lang == PDB_Lang::Swift)
+              .Case(".rs", Lang == PDB_Lang::Rust)
               .Default(false))
         return File->getFileName();
     }
Index: llvm/lib/DebugInfo/PDB/PDBExtras.cpp
===================================================================
--- llvm/lib/DebugInfo/PDB/PDBExtras.cpp
+++ llvm/lib/DebugInfo/PDB/PDBExtras.cpp
@@ -231,6 +231,7 @@
     CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, HLSL, OS)
     CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, D, OS)
     CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Swift, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Rust, OS)
   }
   return OS;
 }
Index: llvm/lib/DebugInfo/CodeView/EnumTables.cpp
===================================================================
--- llvm/lib/DebugInfo/CodeView/EnumTables.cpp
+++ llvm/lib/DebugInfo/CodeView/EnumTables.cpp
@@ -104,7 +104,7 @@
     CV_ENUM_ENT(SourceLanguage, ILAsm),   CV_ENUM_ENT(SourceLanguage, Java),
     CV_ENUM_ENT(SourceLanguage, JScript), CV_ENUM_ENT(SourceLanguage, MSIL),
     CV_ENUM_ENT(SourceLanguage, HLSL),    CV_ENUM_ENT(SourceLanguage, D),
-    CV_ENUM_ENT(SourceLanguage, Swift),
+    CV_ENUM_ENT(SourceLanguage, Swift),   CV_ENUM_ENT(SourceLanguage, Rust),
 };
 
 static const EnumEntry<uint32_t> CompileSym2FlagNames[] = {
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.392831.patch
Type: text/x-patch
Size: 3702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211208/77708803/attachment.bin>


More information about the llvm-commits mailing list