[PATCH] D140544: [DebugInfo] make DW_LANG_C11 respect -gstrict-dwarf

ChenZheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 25 18:01:23 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
shchenz marked an inline comment as done.
Closed by commit rGb1d7010caa43: [DebugInfo] make DW_LANG_C11 respect -gstrict-dwarf (authored by shchenz).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140544/new/

https://reviews.llvm.org/D140544

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-programming-language.c


Index: clang/test/CodeGen/debug-info-programming-language.c
===================================================================
--- clang/test/CodeGen/debug-info-programming-language.c
+++ 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
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -578,8 +578,8 @@
     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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140544.485257.patch
Type: text/x-patch
Size: 1799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221226/acee3b03/attachment-0001.bin>


More information about the cfe-commits mailing list