[llvm] r308890 - [codeview] Emit 'D' as the cv source language for D code
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 09:16:42 PDT 2017
Author: rnk
Date: Mon Jul 24 09:16:42 2017
New Revision: 308890
URL: http://llvm.org/viewvc/llvm-project?rev=308890&view=rev
Log:
[codeview] Emit 'D' as the cv source language for D code
This matches DMD:
https://github.com/dlang/dmd/blob/522263965cf3a27ed16b31f3c3562db86cdeabec/src/ddmd/backend/cv8.c#L199
Fixes PR33899.
Added:
llvm/trunk/test/DebugInfo/COFF/dlang.ll
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h
llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp
llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h?rev=308890&r1=308889&r2=308890&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h Mon Jul 24 09:16:42 2017
@@ -158,7 +158,11 @@ enum SourceLanguage : uint8_t {
Java = 0x0d,
JScript = 0x0e,
MSIL = 0x0f,
- HLSL = 0x10
+ HLSL = 0x10,
+
+ /// The DMD compiler emits 'D' for the CV source language. Microsoft doesn't
+ /// have an enumerator for it yet.
+ D = 'D',
};
/// These values correspond to the CV_call_e enumeration, and are documented
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=308890&r1=308889&r2=308890&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Mon Jul 24 09:16:42 2017
@@ -570,6 +570,8 @@ static SourceLanguage MapDWLangToCVLang(
return SourceLanguage::Cobol;
case dwarf::DW_LANG_Java:
return SourceLanguage::Java;
+ case dwarf::DW_LANG_D:
+ return SourceLanguage::D;
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,
Modified: llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp?rev=308890&r1=308889&r2=308890&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/EnumTables.cpp Mon Jul 24 09:16:42 2017
@@ -132,7 +132,7 @@ static const EnumEntry<codeview::SourceL
CV_ENUM_ENT(SourceLanguage, CSharp), CV_ENUM_ENT(SourceLanguage, VB),
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, HLSL), CV_ENUM_ENT(SourceLanguage, D),
};
static const EnumEntry<uint32_t> CompileSym2FlagNames[] = {
Added: llvm/trunk/test/DebugInfo/COFF/dlang.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/dlang.ll?rev=308890&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/COFF/dlang.ll (added)
+++ llvm/trunk/test/DebugInfo/COFF/dlang.ll Mon Jul 24 09:16:42 2017
@@ -0,0 +1,41 @@
+; RUN: llc < %s | FileCheck %s --check-prefix=ASM
+; RUN: llc -filetype=obj < %s | llvm-readobj -codeview | FileCheck %s --check-prefix=OBJ
+
+; ASM: .short 4412 # Record kind: S_COMPILE3
+; ASM-NEXT: .long 68 # Flags and language
+; ASM-NEXT: .short 208 # CPUType
+
+; OBJ-LABEL: Compile3Sym {
+; OBJ-NEXT: Kind: S_COMPILE3 (0x113C)
+; OBJ-NEXT: Language: D (0x44)
+; OBJ-NEXT: Flags [ (0x0)
+; OBJ-NEXT: ]
+; OBJ-NEXT: Machine: X64 (0xD0)
+; OBJ-NEXT: FrontendVersion: 6.0.0.0
+; OBJ-NEXT: BackendVersion: 6000.0.0.0
+; OBJ-NEXT: VersionName: LDC version 6.0.0
+; OBJ-NEXT: }
+
+
+; ModuleID = 't.c'
+source_filename = "t.c"
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc19.0.24215"
+
+define void @f() !dbg !8 {
+entry:
+ ret void, !dbg !11
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_D, file: !1, producer: "LDC version 6.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
+!1 = !DIFile(filename: "t.d", directory: "asdf")
+!2 = !{}
+!3 = !{i32 2, !"CodeView", i32 1}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, variables: !2)
+!9 = !DISubroutineType(types: !10)
+!10 = !{null}
+!11 = !DILocation(line: 1, column: 11, scope: !8)
Modified: llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp?rev=308890&r1=308889&r2=308890&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp Mon Jul 24 09:16:42 2017
@@ -216,6 +216,7 @@ static std::string formatSourceLanguage(
RETURN_CASE(SourceLanguage, JScript, "javascript");
RETURN_CASE(SourceLanguage, MSIL, "msil");
RETURN_CASE(SourceLanguage, HLSL, "hlsl");
+ RETURN_CASE(SourceLanguage, D, "d");
}
return formatUnknownEnum(Lang);
}
More information about the llvm-commits
mailing list