[PATCH] D59231: Add Swift enumerator value for CodeView::SourceLanguage

Nathan Lanza via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 14:48:32 PDT 2019


lanza created this revision.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.
lanza accepted this revision.
This revision is now accepted and ready to land.

Swift now generates PDBs for debugging on Windows. llvm and lldb
need a language enumerator value too properly handle the output
emitted by swiftc.


Repository:
  rL LLVM

https://reviews.llvm.org/D59231

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


Index: tools/llvm-pdbutil/MinimalSymbolDumper.cpp
===================================================================
--- tools/llvm-pdbutil/MinimalSymbolDumper.cpp
+++ tools/llvm-pdbutil/MinimalSymbolDumper.cpp
@@ -206,6 +206,7 @@
     RETURN_CASE(SourceLanguage, MSIL, "msil");
     RETURN_CASE(SourceLanguage, HLSL, "hlsl");
     RETURN_CASE(SourceLanguage, D, "d");
+    RETURN_CASE(SourceLanguage, Swift, "swift");
   }
   return formatUnknownEnum(Lang);
 }
Index: lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
===================================================================
--- lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
+++ lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
@@ -90,16 +90,16 @@
   PDB_Lang Lang = Details ? Details->getLanguage() : PDB_Lang::Cpp;
   auto SrcFiles = Session.getSourceFilesForCompiland(*this);
   if (SrcFiles) {
-    bool LangC = (Lang == PDB_Lang::Cpp || Lang == PDB_Lang::C);
     while (auto File = SrcFiles->getNext()) {
       std::string FileName = File->getFileName();
       auto file_extension = sys::path::extension(FileName);
       if (StringSwitch<bool>(file_extension.lower())
-              .Case(".cpp", LangC)
-              .Case(".c", LangC)
-              .Case(".cc", LangC)
-              .Case(".cxx", LangC)
+              .Case(".cpp", Lang == PDB_Lang::Cpp) //
+              .Case(".c", Lang == PDB_Lang::C)
+              .Case(".cc", Lang == PDB_Lang::Cpp)
+              .Case(".cxx", Lang == PDB_Lang::Cpp)
               .Case(".asm", Lang == PDB_Lang::Masm)
+              .Case(".swift", Lang == PDB_Lang::Swift)
               .Default(false))
         return File->getFileName();
     }
Index: lib/DebugInfo/PDB/PDBExtras.cpp
===================================================================
--- lib/DebugInfo/PDB/PDBExtras.cpp
+++ lib/DebugInfo/PDB/PDBExtras.cpp
@@ -192,6 +192,7 @@
     CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, MSIL, OS)
     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)
   }
   return OS;
 }
Index: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -699,6 +699,8 @@
     return SourceLanguage::Java;
   case dwarf::DW_LANG_D:
     return SourceLanguage::D;
+  case dwarf::DW_LANG_Swift:
+    return SourceLanguage::Swift;
   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: include/llvm/DebugInfo/CodeView/CodeView.h
===================================================================
--- include/llvm/DebugInfo/CodeView/CodeView.h
+++ include/llvm/DebugInfo/CodeView/CodeView.h
@@ -159,9 +159,10 @@
   MSIL = 0x0f,
   HLSL = 0x10,
 
-  /// The DMD compiler emits 'D' for the CV source language. Microsoft doesn't
-  /// have an enumerator for it yet.
+  /// The DMD & Swift compilers emit 'D' and 'S', respectively, for the CV
+  /// source language. Microsoft does not have enumerators for them yet.
   D = 'D',
+  Swift = 'S',
 };
 
 /// These values correspond to the CV_call_e enumeration, and are documented


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59231.190159.patch
Type: text/x-patch
Size: 3275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190311/5f473705/attachment.bin>


More information about the llvm-commits mailing list