From bafd8b1add1e0871a4cc568bd40bf6bbfc175762 Mon Sep 17 00:00:00 2001 From: Brock Wyma Date: Wed, 22 Sep 2021 19:41:05 -0400 Subject: [PATCH] [CodeView] Recognize Fortran95 as Fortran instead of MASM Map Fortran95 sources to Fortran so the CodeView language is not emitted as MASM. Differential Revision: https://reviews.llvm.org/D110330 --- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 1 + llvm/test/DebugInfo/COFF/language.ll | 67 +++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 llvm/test/DebugInfo/COFF/language.ll diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index bbb0504..827863c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -746,6 +746,7 @@ static SourceLanguage MapDWLangToCVLang(unsigned DWLang) { return SourceLanguage::Cpp; case dwarf::DW_LANG_Fortran77: case dwarf::DW_LANG_Fortran90: + case dwarf::DW_LANG_Fortran95: case dwarf::DW_LANG_Fortran03: case dwarf::DW_LANG_Fortran08: return SourceLanguage::Fortran; diff --git a/llvm/test/DebugInfo/COFF/language.ll b/llvm/test/DebugInfo/COFF/language.ll new file mode 100644 index 0000000..a7a4f4e --- /dev/null +++ b/llvm/test/DebugInfo/COFF/language.ll @@ -0,0 +1,67 @@ +; RUN: sed -e 's//DW_LANG_C/;s//C/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_C89/;s//C/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_C99/;s//C/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_C11/;s//C/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_C_plus_plus/;s//Cpp/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_C_plus_plus_03/;s//Cpp/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_C_plus_plus_11/;s//Cpp/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_C_plus_plus_14/;s//Cpp/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_Fortran77/;s//Fortran/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_Fortran90/;s//Fortran/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_Fortran95/;s//Fortran/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_Fortran03/;s//Fortran/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t +; +; RUN: sed -e 's//DW_LANG_Fortran08/;s//Fortran/' %s > %t +; RUN: llc -filetype=obj -o - %t | llvm-readobj --codeview - | FileCheck %t + +; CHECK: CodeViewDebugInfo [ +; CHECK: Subsection [ +; CHECK: SubSectionType: Symbols (0xF1) +; CHECK: Compile3Sym { +; CHECK-NEXT: Kind: S_COMPILE3 (0x113C) +; CHECK-NEXT: Language: +; CHECK-NEXT: Flags [ (0x0) +; CHECK-NEXT: ] +; CHECK-NEXT: Machine: X64 (0xD0) +; CHECK-NEXT: FrontendVersion: {{[0-9.]*}} +; CHECK-NEXT: BackendVersion: {{[0-9.]*}} +; CHECK-NEXT: VersionName: clang +; CHECK-NEXT: } +; CHECK: ] +; CHECK: ] + +; ModuleID = 'empty' +source_filename = "empty" +target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-windows-msvc19.0.24215" + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!2, !3} + +!0 = distinct !DICompileUnit(language: , file: !1, producer: "clang") +!1 = !DIFile(filename: "empty", directory: "path/to") +!2 = !{i32 2, !"CodeView", i32 1} +!3 = !{i32 2, !"Debug Info Version", i32 3} -- 2.7.4