Skip to content

Commit dff922f

Browse files
author
Esme-Yi
committed
Reland [DebugInfo] Fix the mismatching between C++ language tags and Dwarf versions.""
This reverts commit c965e14.
1 parent c965e14 commit dff922f

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,9 @@ void CGDebugInfo::CreateCompileUnit() {
568568
if (LO.CPlusPlus) {
569569
if (LO.ObjC)
570570
LangTag = llvm::dwarf::DW_LANG_ObjC_plus_plus;
571-
else if (LO.CPlusPlus14)
571+
else if (LO.CPlusPlus14 && CGM.getCodeGenOpts().DwarfVersion >= 5)
572572
LangTag = llvm::dwarf::DW_LANG_C_plus_plus_14;
573-
else if (LO.CPlusPlus11)
573+
else if (LO.CPlusPlus11 && CGM.getCodeGenOpts().DwarfVersion >= 5)
574574
LangTag = llvm::dwarf::DW_LANG_C_plus_plus_11;
575575
else
576576
LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple %itanium_abi_triple %s -o - \
2+
// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
3+
// RUN: | FileCheck --check-prefix=CHECK-DWARF5 %s
4+
// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
5+
// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
6+
// RUN: | FileCheck --check-prefix=CHECK-DWARF3 %s
7+
8+
int main() {
9+
return 0;
10+
}
11+
12+
// CHECK-DWARF5: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
13+
// CHECK-DWARF3: distinct !DICompileUnit(language: DW_LANG_C_plus_plus,

clang/test/Modules/ModuleDebugInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// CHECK-MOD: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus,
2424

2525
// CHECK: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus,
26-
// CHECK-CXX: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_11,
26+
// CHECK-CXX: distinct !DICompileUnit(language: DW_LANG_C_plus_plus,
2727
// CHECK-SAME: isOptimized: false,
2828
// CHECK-NOT: splitDebugFilename:
2929
// CHECK-SAME: dwoId:

0 commit comments

Comments
 (0)