Index: clang/test/Sema/attr-nodebug.c =================================================================== --- clang/test/Sema/attr-nodebug.c (revision 165971) +++ clang/test/Sema/attr-nodebug.c (working copy) @@ -1,11 +0,0 @@ -// RUN: %clang_cc1 %s -verify -fsyntax-only - -int a __attribute__((nodebug)); - -void b() { - int b __attribute__((nodebug)); // expected-warning {{'nodebug' only applies to variables with static storage duration and functions}} -} - -void t1() __attribute__((nodebug)); - -void t2() __attribute__((nodebug(2))); // expected-error {{attribute takes no arguments}} Index: clang/test/Sema/attr-nodebug.cpp =================================================================== --- clang/test/Sema/attr-nodebug.cpp (revision 165971) +++ clang/test/Sema/attr-nodebug.cpp (working copy) @@ -9,3 +9,7 @@ void t1() __attribute__((nodebug)); void t2() __attribute__((nodebug(2))); // expected-error {{attribute takes no arguments}} + +class c { + void t3() __attribute__((nodebug)); +}; Index: clang/test/CodeGen/attr-nodebug.cpp =================================================================== --- clang/test/CodeGen/attr-nodebug.cpp (revision 165971) +++ clang/test/CodeGen/attr-nodebug.cpp (working copy) @@ -1,5 +1,6 @@ -// RUN: %clang_cc1 -g -emit-llvm -o %t %s -// RUN: not grep 'call void @llvm.dbg.func.start' %t +// RUN: %clang_cc1 -g -emit-llvm %s -o - | FileCheck %s +// CHECK-NOT: call void @llvm.dbg.func.start +// CHECK-NOT: DW_TAG_subprogram void t1() __attribute__((nodebug)); @@ -10,3 +11,14 @@ a++; } +class C { + void t2() __attribute__((nodebug)); +}; + +void C::t2() +{ + int a = 10; + a++; +} + +C obj; Index: clang/test/CodeGen/attr-nodebug.c =================================================================== --- clang/test/CodeGen/attr-nodebug.c (revision 165971) +++ clang/test/CodeGen/attr-nodebug.c (working copy) @@ -1,12 +0,0 @@ -// RUN: %clang_cc1 -g -emit-llvm -o %t %s -// RUN: not grep 'call void @llvm.dbg.func.start' %t - -void t1() __attribute__((nodebug)); - -void t1() -{ - int a = 10; - - a++; -} - Index: clang/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- clang/lib/CodeGen/CGDebugInfo.cpp (revision 165971) +++ clang/lib/CodeGen/CGDebugInfo.cpp (working copy) @@ -1024,9 +1024,9 @@ continue; if (const CXXMethodDecl *Method = dyn_cast(D)) { - // Only emit debug information for user provided functions, we're - // unlikely to want info for artificial functions. - if (Method->isUserProvided()) + // Only emit debug information for user provided functions + // not marked with 'nodebug'. No artificial functions. + if (Method->isUserProvided() && !Method->hasAttr()) EltTys.push_back(CreateCXXMemberFunction(Method, Unit, RecordTy)); } else if (FunctionTemplateDecl *FTD = dyn_cast(D))