[cfe-dev] Decl::dumpXML and -DNDEBUG
Alexander Kornienko
alexfh at google.com
Mon Jul 16 10:44:20 PDT 2012
Hi all,
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
Decl::dumpXML.
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:
* clang -cc1 mode has a command line option "-ast-dump-xml", which uses
dumpXML, and currently it won't work with -DNDEBUG (e.g. when builing with
CMake: Release configuration + LLVM_ASSERTIONS_ENABLED=OFF);
* clang-ast-dump tool uses it.
A comment in *DumpXML.cpp* states:
// Only pay for this in code size in assertions-enabled builds.
But having -ast-dump-xml 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 dumpXML implementation in them. The
third option would be to drop the -ast-dump-xml option completely and
instead use clang-ast-dump tool when needed. In this case we could only use
an implementation of Decl::dumpXML in the tool and exclude it from clang
binary.
--
Regards,
Alexander Kornienko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120716/1795f9b9/attachment.html>
More information about the cfe-dev
mailing list