Index: lib/CodeGen/CGDebugInfo.cpp =================================================================== --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -1179,12 +1179,13 @@ // 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()) continue; if (Method->getType()->getAs()->getContainedAutoType()) Index: test/CodeGenCXX/debug-info-method-nodebug.cpp =================================================================== --- test/CodeGenCXX/debug-info-method-nodebug.cpp +++ test/CodeGenCXX/debug-info-method-nodebug.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s + +class C { + void present(); + void absent() __attribute__((nodebug)); + int i; +}; + +C c; + +// CHECK-NOT: name: "absent" +// CHECK: name: "present" +// CHECK-NOT: name: "absent"