Skip to content

Commit 6ab6085

Browse files
committed
Revert "DebugInfo: Add/support new DW_LANG codes for recent C and C++ versions"
Some buildbots are failing in Clang and LLDB tests. (I guess the LLDB failure is due to the explicit C language tests in DwarfUnit.cpp that need to be updated - not sure what the Clang failures are about, they seem to be still emitting C99 when we're expecting C11 and I checked those tests pass... maybe systems with a different C language version default?) This reverts commit 3c312e4.
1 parent 2563fd6 commit 6ab6085

File tree

5 files changed

+7
-41
lines changed

5 files changed

+7
-41
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,7 @@ void CGDebugInfo::CreateCompileUnit() {
526526

527527
// Get absolute path name.
528528
SourceManager &SM = CGM.getContext().getSourceManager();
529-
auto &CGO = CGM.getCodeGenOpts();
530-
std::string MainFileName = CGO.MainFileName;
529+
std::string MainFileName = CGM.getCodeGenOpts().MainFileName;
531530
if (MainFileName.empty())
532531
MainFileName = "<stdin>";
533532

@@ -563,11 +562,11 @@ void CGDebugInfo::CreateCompileUnit() {
563562
if (LO.CPlusPlus) {
564563
if (LO.ObjC)
565564
LangTag = llvm::dwarf::DW_LANG_ObjC_plus_plus;
566-
else if (CGO.DebugStrictDwarf && CGO.DwarfVersion < 5)
567-
LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
568-
else if (LO.CPlusPlus14)
565+
else if (LO.CPlusPlus14 && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
566+
CGM.getCodeGenOpts().DwarfVersion >= 5))
569567
LangTag = llvm::dwarf::DW_LANG_C_plus_plus_14;
570-
else if (LO.CPlusPlus11)
568+
else if (LO.CPlusPlus11 && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
569+
CGM.getCodeGenOpts().DwarfVersion >= 5))
571570
LangTag = llvm::dwarf::DW_LANG_C_plus_plus_11;
572571
else
573572
LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
@@ -578,8 +577,6 @@ void CGDebugInfo::CreateCompileUnit() {
578577
LangTag = llvm::dwarf::DW_LANG_OpenCL;
579578
} else if (LO.RenderScript) {
580579
LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
581-
} else if (LO.C11) {
582-
LangTag = llvm::dwarf::DW_LANG_C11;
583580
} else if (LO.C99) {
584581
LangTag = llvm::dwarf::DW_LANG_C99;
585582
} else {

clang/test/CodeGen/debug-info-preprocessed-file.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
# 1 "preprocessed-input.c" 2
88

99
// RUN: %clang -g -c -S -emit-llvm -o - %s | FileCheck %s
10-
// CHECK: !DICompileUnit(language: DW_LANG_C11, file: ![[FILE:[0-9]+]]
10+
// CHECK: !DICompileUnit(language: DW_LANG_C99, file: ![[FILE:[0-9]+]]
1111
// CHECK: ![[FILE]] = !DIFile(filename: "/foo/bar/preprocessed-input.c"

clang/test/CodeGen/debug-info-programming-language.c

Lines changed: 0 additions & 15 deletions
This file was deleted.

clang/test/CodeGenCXX/debug-info-programming-language.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
55
// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
66
// RUN: | FileCheck --check-prefix=CHECK-CPP14 %s
7-
// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
8-
// RUN: -x c++ -std=c++17 -O0 -disable-llvm-passes -debug-info-kind=limited \
9-
// RUN: | FileCheck --check-prefix=CHECK-CPP17 %s
10-
// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
11-
// RUN: -x c++ -std=c++20 -O0 -disable-llvm-passes -debug-info-kind=limited \
12-
// RUN: | FileCheck --check-prefix=CHECK-CPP20 %s
137
// RUN: %clang_cc1 -dwarf-version=3 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
148
// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited | FileCheck %s
159
// RUN: %clang_cc1 -dwarf-version=5 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
@@ -20,15 +14,5 @@ int main() {
2014
return 0;
2115
}
2216

23-
// Update these tests once support for DW_LANG_C_plus_plus_17/20 is added - it's
24-
// a complicated tradeoff. The language codes are already published/blessed by
25-
// the DWARF committee, but haven't been released in a published standard yet,
26-
// so consumers might not be ready for these codes & could regress functionality
27-
// (because they wouldn't be able to identify that the language was C++). The
28-
// DWARFv6 language encoding, separating language from language version, would
29-
// remove this problem/not require new codes for new language versions and make
30-
// it possible to identify the base language irrespective of the version.
3117
// CHECK-CPP14: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
32-
// CHECK-CPP17: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
33-
// CHECK-CPP20: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
3418
// CHECK: distinct !DICompileUnit(language: DW_LANG_C_plus_plus,

clang/test/PCH/debug-info-pch-container-path.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// RUN: cat %t-container.ll | FileCheck %s
1515

1616
// CHECK: distinct !DICompileUnit(
17-
// CHECK-SAME: language: DW_LANG_C11,
17+
// CHECK-SAME: language: DW_LANG_C99,
1818
// CHECK-SAME: file: ![[FILE:[0-9]+]],
1919
// CHECK: ![[FILE]] = !DIFile(
2020
// CHECK-SAME: filename: "SOURCE/debug-info-limited-struct.h",

0 commit comments

Comments
 (0)