[clang] b1d7010 - [DebugInfo] make DW_LANG_C11 respect -gstrict-dwarf
Chen Zheng via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 25 18:01:08 PST 2022
Author: Chen Zheng
Date: 2022-12-25T21:01:02-05:00
New Revision: b1d7010caa4394e7f5b41c627702f6acabe0cec5
URL: https://github.com/llvm/llvm-project/commit/b1d7010caa4394e7f5b41c627702f6acabe0cec5
DIFF: https://github.com/llvm/llvm-project/commit/b1d7010caa4394e7f5b41c627702f6acabe0cec5.diff
LOG: [DebugInfo] make DW_LANG_C11 respect -gstrict-dwarf
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D140544
Added:
Modified:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGen/debug-info-programming-language.c
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 576a97b66859c..62ea222fade67 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -578,8 +578,8 @@ void CGDebugInfo::CreateCompileUnit() {
LangTag = llvm::dwarf::DW_LANG_OpenCL;
} else if (LO.RenderScript) {
LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
- } else if (LO.C11) {
- LangTag = llvm::dwarf::DW_LANG_C11;
+ } else if (LO.C11 && !(CGO.DebugStrictDwarf && CGO.DwarfVersion < 5)) {
+ LangTag = llvm::dwarf::DW_LANG_C11;
} else if (LO.C99) {
LangTag = llvm::dwarf::DW_LANG_C99;
} else {
diff --git a/clang/test/CodeGen/debug-info-programming-language.c b/clang/test/CodeGen/debug-info-programming-language.c
index f81bab610d51e..02e45d89ca15e 100644
--- a/clang/test/CodeGen/debug-info-programming-language.c
+++ b/clang/test/CodeGen/debug-info-programming-language.c
@@ -4,7 +4,14 @@
// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
// RUN: -x c -std=c17 -O0 -disable-llvm-passes -debug-info-kind=limited \
// RUN: | FileCheck --check-prefix=CHECK-C17 %s
+// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN: -x c -std=c11 -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN: -gstrict-dwarf | FileCheck --check-prefix=CHECK-STRICT %s
+// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN: -x c -std=c11 -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN: -gstrict-dwarf | FileCheck --check-prefix=CHECK-C11 %s
+// CHECK-STRICT: !DICompileUnit(language: DW_LANG_C99
// CHECK-C11: !DICompileUnit(language: DW_LANG_C11
// Update this check once support for DW_LANG_C17 is broadly supported/known in
// consumers. Maybe we'll skip this and go to the DWARFv6 language+version
More information about the cfe-commits
mailing list