[cfe-commits] [PATCH] PR14097, no debug info for artificial/'nodebug' methods

Robinson, Paul Paul.Robinson at am.sony.com
Tue Oct 16 11:51:42 PDT 2012

Patch #1: Suppress debug info associated with the body of an
artificial method. We already suppress debug info for its declaration
inside the class description.
Fixes PR14097.

Patch #2: Suppress debug info for the declaration of a class method
marked __attribute__((nodebug)). We already suppress debug info for
the body of the method.

Here's the story:
r158009 suppressed debug-info entries for artificial (compiler
generated) methods, typically constructors and destructors, from the
debug info for a class. The idea is that these aren't interesting or
useful. Which is pretty much true.

Unfortunately, the method _definitions_ still get debug info, and if
there's no declaration in the class for it to refer to, Clang
spontaneously generates debug info for a declaration.  If a ctor has
multiple definitions, which they sometimes do (e.g. when there's a
virtual base class), each instance produces its own separate
declaration.  And so the total debug info size _increases_. Patch #1
suppresses debug-info on the definitions as well.

While finding the fix, I noticed that the 'nodebug' attribute will
suppress debug info for a method definition, but we don't suppress
debug info for the corresponding declaration inside a class. 
(Non-class functions don't have this problem because Clang doesn't
emit debug info for a function declaration anyway.)  Patch #2
addresses that oversight.

I renamed the Sema and CodeGen tests for the 'nodebug' attribute from
.c to .cpp and added test points for methods, rather than add whole
new test files. Hope that's okay.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 01-no-info-for-artificial.txt
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121016/31ab2c7f/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 02-no-info-for-nodebug.txt
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121016/31ab2c7f/attachment-0001.txt>

More information about the cfe-commits mailing list