[cfe-dev] Should dump methods be LLVM_ATTRIBUTE_USED only in debug builds?

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Jan 3 13:00:51 PST 2014


On Jan 3, 2014, at 11:38 AM, Chandler Carruth <chandlerc at google.com> wrote:

> I'm referring to the more narrow use of the term "dump method" which is specifically a method that accepts no arguments and prints as much state to stderr as might conceivably be useful from inside gdb. Decl::dump() is just such a function, but Decl::dump(raw_ostream &OS) is different. The somewhat consistent pattern in LLVM is to name the latter functions 'print' to avoid confusion, but that's neither here nor there.
> 
> My stance is essentially that the things which are only used either a) in GDB or b) inside of !NDEBUG regions (be they assert()s or the LLVM DEBUG macro) are the things which should be compiled away when NDEBUG (or the opt-in macro that several folks asked for in LLVM-land to get dump methods in no-asserts builds) and should be marked as noinline and used to make them easy to reach via the debugger.

Thanks for the clarification, SGTM.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140103/62e17ab3/attachment.html>


More information about the cfe-dev mailing list