[clang] 6ab6085 - Revert "DebugInfo: Add/support new DW_LANG codes for recent C and C++ versions"
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 6 14:52:59 PST 2022
Author: David Blaikie
Date: 2022-12-06T22:52:47Z
New Revision: 6ab6085c77ef9bcdabf842342f63fba4291791a4
URL: https://github.com/llvm/llvm-project/commit/6ab6085c77ef9bcdabf842342f63fba4291791a4
DIFF: https://github.com/llvm/llvm-project/commit/6ab6085c77ef9bcdabf842342f63fba4291791a4.diff
LOG: 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 3c312e48f325c1b1ee11404ee6cfa08ee00037b0.
Added:
Modified:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGen/debug-info-preprocessed-file.i
clang/test/CodeGenCXX/debug-info-programming-language.cpp
clang/test/PCH/debug-info-pch-container-path.c
Removed:
clang/test/CodeGen/debug-info-programming-language.c
################################################################################
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 3e370fb17b1d8..2a67f58d22ced 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -526,8 +526,7 @@ void CGDebugInfo::CreateCompileUnit() {
// Get absolute path name.
SourceManager &SM = CGM.getContext().getSourceManager();
- auto &CGO = CGM.getCodeGenOpts();
- std::string MainFileName = CGO.MainFileName;
+ std::string MainFileName = CGM.getCodeGenOpts().MainFileName;
if (MainFileName.empty())
MainFileName = "<stdin>";
@@ -563,11 +562,11 @@ void CGDebugInfo::CreateCompileUnit() {
if (LO.CPlusPlus) {
if (LO.ObjC)
LangTag = llvm::dwarf::DW_LANG_ObjC_plus_plus;
- else if (CGO.DebugStrictDwarf && CGO.DwarfVersion < 5)
- LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
- else if (LO.CPlusPlus14)
+ else if (LO.CPlusPlus14 && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
+ CGM.getCodeGenOpts().DwarfVersion >= 5))
LangTag = llvm::dwarf::DW_LANG_C_plus_plus_14;
- else if (LO.CPlusPlus11)
+ 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;
@@ -578,8 +577,6 @@ 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.C99) {
LangTag = llvm::dwarf::DW_LANG_C99;
} else {
diff --git a/clang/test/CodeGen/debug-info-preprocessed-file.i b/clang/test/CodeGen/debug-info-preprocessed-file.i
index d58cfe0124949..d231b45d67c2e 100644
--- a/clang/test/CodeGen/debug-info-preprocessed-file.i
+++ b/clang/test/CodeGen/debug-info-preprocessed-file.i
@@ -7,5 +7,5 @@
# 1 "preprocessed-input.c" 2
// RUN: %clang -g -c -S -emit-llvm -o - %s | FileCheck %s
-// CHECK: !DICompileUnit(language: DW_LANG_C11, file: ![[FILE:[0-9]+]]
+// CHECK: !DICompileUnit(language: DW_LANG_C99, file: ![[FILE:[0-9]+]]
// CHECK: ![[FILE]] = !DIFile(filename: "/foo/bar/preprocessed-input.c"
diff --git a/clang/test/CodeGen/debug-info-programming-language.c b/clang/test/CodeGen/debug-info-programming-language.c
deleted file mode 100644
index f81bab610d51e..0000000000000
--- a/clang/test/CodeGen/debug-info-programming-language.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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: | FileCheck --check-prefix=CHECK-C11 %s
-// 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
-
-// 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
-// encoding that avoids the risk of regression when describing a language
-// version newer than what the consumer is aware of.
-// CHECK-C17: !DICompileUnit(language: DW_LANG_C11
-
-void f1(void) { }
diff --git a/clang/test/CodeGenCXX/debug-info-programming-language.cpp b/clang/test/CodeGenCXX/debug-info-programming-language.cpp
index 69532661947a8..06873a7b5752a 100644
--- a/clang/test/CodeGenCXX/debug-info-programming-language.cpp
+++ b/clang/test/CodeGenCXX/debug-info-programming-language.cpp
@@ -4,12 +4,6 @@
// 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-CPP14 %s
-// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
-// RUN: -x c++ -std=c++17 -O0 -disable-llvm-passes -debug-info-kind=limited \
-// RUN: | FileCheck --check-prefix=CHECK-CPP17 %s
-// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
-// RUN: -x c++ -std=c++20 -O0 -disable-llvm-passes -debug-info-kind=limited \
-// RUN: | FileCheck --check-prefix=CHECK-CPP20 %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 - \
@@ -20,15 +14,5 @@ int main() {
return 0;
}
-// Update these tests once support for DW_LANG_C_plus_plus_17/20 is added - it's
-// a complicated tradeoff. The language codes are already published/blessed by
-// the DWARF committee, but haven't been released in a published standard yet,
-// so consumers might not be ready for these codes & could regress functionality
-// (because they wouldn't be able to identify that the language was C++). The
-// DWARFv6 language encoding, separating language from language version, would
-// remove this problem/not require new codes for new language versions and make
-// it possible to identify the base language irrespective of the version.
// CHECK-CPP14: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
-// CHECK-CPP17: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
-// CHECK-CPP20: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
// CHECK: distinct !DICompileUnit(language: DW_LANG_C_plus_plus,
diff --git a/clang/test/PCH/debug-info-pch-container-path.c b/clang/test/PCH/debug-info-pch-container-path.c
index 9f76a634f46a5..efe49e48e2dc5 100644
--- a/clang/test/PCH/debug-info-pch-container-path.c
+++ b/clang/test/PCH/debug-info-pch-container-path.c
@@ -14,7 +14,7 @@
// RUN: cat %t-container.ll | FileCheck %s
// CHECK: distinct !DICompileUnit(
-// CHECK-SAME: language: DW_LANG_C11,
+// CHECK-SAME: language: DW_LANG_C99,
// CHECK-SAME: file: ![[FILE:[0-9]+]],
// CHECK: ![[FILE]] = !DIFile(
// CHECK-SAME: filename: "SOURCE/debug-info-limited-struct.h",
More information about the cfe-commits
mailing list