Disable pubnames in NVPTX debug info using metadata
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 16 Aug 2018 23:56:32 +0000 (23:56 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 16 Aug 2018 23:56:32 +0000 (23:56 +0000)
llvm-svn: 339968

clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGen/debug-nvptx.c [new file with mode: 0644]

index e6136d5..c7637ef 100644 (file)
@@ -579,8 +579,11 @@ void CGDebugInfo::CreateCompileUnit() {
       CGOpts.DwarfDebugFlags, RuntimeVers,
       CGOpts.EnableSplitDwarf ? "" : CGOpts.SplitDwarfFile, EmissionKind,
       0 /* DWOid */, CGOpts.SplitDwarfInlining, CGOpts.DebugInfoForProfiling,
-      CGOpts.GnuPubnames ? llvm::DICompileUnit::DebugNameTableKind::GNU
-                         : llvm::DICompileUnit::DebugNameTableKind::Default);
+      CGM.getTarget().getTriple().isNVPTX()
+          ? llvm::DICompileUnit::DebugNameTableKind::None
+          : CGOpts.GnuPubnames
+                ? llvm::DICompileUnit::DebugNameTableKind::GNU
+                : llvm::DICompileUnit::DebugNameTableKind::Default);
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
diff --git a/clang/test/CodeGen/debug-nvptx.c b/clang/test/CodeGen/debug-nvptx.c
new file mode 100644 (file)
index 0000000..ceff300
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -S -o - -debug-info-kind=limited %s -emit-llvm | FileCheck %s
+
+// CHECK: DICompileUnit({{.*}}, nameTableKind: None)
+
+void f1(void) {
+}