[PATCH] D104118: [OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C

Stuart Brady via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 25 03:51:20 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe47027d091de: [OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C (authored by stuart).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104118

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


Index: clang/test/CodeGenOpenCL/debug-info-programming-language.cl
===================================================================
--- /dev/null
+++ clang/test/CodeGenOpenCL/debug-info-programming-language.cl
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+// RUN: %clang_cc1 -dwarf-version=3 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-C99 %s
+// RUN: %clang_cc1 -dwarf-version=5 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
+// RUN:   -x cl -O0 -disable-llvm-passes -debug-info-kind=limited \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENCL %s
+
+kernel void empty() {}
+
+// CHECK-OPENCL: distinct !DICompileUnit(language: DW_LANG_OpenCL,
+// CHECK-C99: distinct !DICompileUnit(language: DW_LANG_C99,
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -578,6 +578,9 @@
       LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
   } else if (LO.ObjC) {
     LangTag = llvm::dwarf::DW_LANG_ObjC;
+  } else if (LO.OpenCL && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
+                           CGM.getCodeGenOpts().DwarfVersion >= 5)) {
+    LangTag = llvm::dwarf::DW_LANG_OpenCL;
   } else if (LO.RenderScript) {
     LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
   } else if (LO.C99) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104118.354464.patch
Type: text/x-patch
Size: 1873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210625/21a814b0/attachment-0001.bin>


More information about the cfe-commits mailing list