[clang] 4590b40 - [Debug-Info] guard DW_LANG_C_plus_plus_14 under strict dwarf
Chen Zheng via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 15 20:18:12 PDT 2021
Author: Chen Zheng
Date: 2021-06-16T03:17:56Z
New Revision: 4590b406c02e4e6803d2644195dbb78bc09c25c7
URL: https://github.com/llvm/llvm-project/commit/4590b406c02e4e6803d2644195dbb78bc09c25c7
DIFF: https://github.com/llvm/llvm-project/commit/4590b406c02e4e6803d2644195dbb78bc09c25c7.diff
LOG: [Debug-Info] guard DW_LANG_C_plus_plus_14 under strict dwarf
Reviewed By: stuart
Differential Revision: https://reviews.llvm.org/D104291
Added:
Modified:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/debug-info-programming-language.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 080d494a28306..08d15bef93800 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -568,9 +568,11 @@ void CGDebugInfo::CreateCompileUnit() {
if (LO.CPlusPlus) {
if (LO.ObjC)
LangTag = llvm::dwarf::DW_LANG_ObjC_plus_plus;
- else if (LO.CPlusPlus14 && CGM.getCodeGenOpts().DwarfVersion >= 5)
+ else if (LO.CPlusPlus14 && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
+ CGM.getCodeGenOpts().DwarfVersion >= 5))
LangTag = llvm::dwarf::DW_LANG_C_plus_plus_14;
- else if (LO.CPlusPlus11 && CGM.getCodeGenOpts().DwarfVersion >= 5)
+ else if (LO.CPlusPlus11 && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
+ CGM.getCodeGenOpts().DwarfVersion >= 5))
LangTag = llvm::dwarf::DW_LANG_C_plus_plus_11;
else
LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
diff --git a/clang/test/CodeGenCXX/debug-info-programming-language.cpp b/clang/test/CodeGenCXX/debug-info-programming-language.cpp
index 82a6db6445f36..06873a7b5752a 100644
--- a/clang/test/CodeGenCXX/debug-info-programming-language.cpp
+++ b/clang/test/CodeGenCXX/debug-info-programming-language.cpp
@@ -1,13 +1,18 @@
-// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple %itanium_abi_triple %s -o - \
// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
-// RUN: | FileCheck --check-prefix=CHECK-DWARF5 %s
-// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN: | FileCheck --check-prefix=CHECK-CPP14 %s
+// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
-// RUN: | FileCheck --check-prefix=CHECK-DWARF3 %s
+// RUN: | FileCheck --check-prefix=CHECK-CPP14 %s
+// RUN: %clang_cc1 -dwarf-version=3 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited | FileCheck %s
+// RUN: %clang_cc1 -dwarf-version=5 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN: | FileCheck --check-prefix=CHECK-CPP14 %s
int main() {
return 0;
}
-// CHECK-DWARF5: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
-// CHECK-DWARF3: distinct !DICompileUnit(language: DW_LANG_C_plus_plus,
+// CHECK-CPP14: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
+// CHECK: distinct !DICompileUnit(language: DW_LANG_C_plus_plus,
More information about the cfe-commits
mailing list