]> granicus.if.org Git - clang/commitdiff
Omit 'nodebug' methods from the class description.
authorPaul Robinson <paul_robinson@playstation.sony.com>
Thu, 25 Jun 2015 17:50:43 +0000 (17:50 +0000)
committerPaul Robinson <paul_robinson@playstation.sony.com>
Thu, 25 Jun 2015 17:50:43 +0000 (17:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240664 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenCXX/debug-info-method-nodebug.cpp [new file with mode: 0644]

index 8a7d3af61fd223e8ecdb80a4ee45d151147f48b5..a139ce0e07363871ea6f5de6a0658fa06f0159b1 100644 (file)
@@ -1179,12 +1179,13 @@ void CGDebugInfo::CollectCXXMemberFunctions(
     // the member being added to type units by LLVM, while still allowing it
     // to be emitted into the type declaration/reference inside the compile
     // unit.
+    // Ditto 'nodebug' methods, for consistency with CodeGenFunction.cpp.
     // FIXME: Handle Using(Shadow?)Decls here to create
     // DW_TAG_imported_declarations inside the class for base decls brought into
     // derived classes. GDB doesn't seem to notice/leverage these when I tried
     // it, so I'm not rushing to fix this. (GCC seems to produce them, if
     // referenced)
-    if (!Method || Method->isImplicit())
+    if (!Method || Method->isImplicit() || Method->hasAttr<NoDebugAttr>())
       continue;
 
     if (Method->getType()->getAs<FunctionProtoType>()->getContainedAutoType())
diff --git a/test/CodeGenCXX/debug-info-method-nodebug.cpp b/test/CodeGenCXX/debug-info-method-nodebug.cpp
new file mode 100644 (file)
index 0000000..474053a
--- /dev/null
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
+
+class C {
+  void present();
+  void absent() __attribute__((nodebug));
+};
+
+C c;
+
+// CHECK-NOT: name: "absent"
+// CHECK:     name: "present"
+// CHECK-NOT: name: "absent"