<div>Hi all,</div><div><br></div><div>I've recently implemented a tool named clang-ast-dump, which allows to dump selectively an AST of user-specified translation units. It's a really simple tool now, most of it's code is node filtering. The rest is done by <font face="courier new, monospace">Decl::dumpXML</font>.</div>

<div><br></div><div>Now the problem: Decl::dumpXML does nothing when compiled with -DNDEBUG. I assume that initially this method was meant to be only helpful during debugging of clang code, but now there are a couple of reasons to review this decision, I think:</div>
<div>  * clang -cc1 mode has a command line option "<font face="courier new, monospace">-ast-dump-xml</font>", which uses <font face="courier new, monospace">dumpXML</font>, and currently it won't work with <font face="courier new, monospace">-DNDEBUG</font> (e.g. when builing with CMake: Release configuration + <font face="courier new, monospace">LLVM_ASSERTIONS_ENABLED=OFF</font>);</div>
<div>  * clang-ast-dump tool uses it.</div><div><br></div><div>A comment in <font face="courier new, monospace"><b>DumpXML.cpp</b></font> states:</div><div><span style="color:rgb(136,0,0);font-family:monospace;font-size:medium;line-height:16.25px;white-space:pre">// Only pay for this in code size in assertions-enabled builds.</span><br>
</div><div><br></div><div>But having <font face="courier new, monospace">-ast-dump-xml</font> option conflicts with this idea: either we have to disable this option completely in non-assertion-enabled builds, or we have to drop this idea of not-having the <font face="courier new, monospace">dumpXML</font> implementation in them. The third option would be to drop the <font face="courier new, monospace">-ast-dump-xml</font> option completely and instead use <font face="courier new, monospace">clang-ast-dump</font> tool when needed. In this case we could only use an implementation of <font face="courier new, monospace">Decl::dumpXML</font> in the tool and exclude it from clang binary.</div>
<div><br></div>-- <div>Regards,</div><div>Alexander Kornienko </div>