[LLVMdev] Old DOUT
clattner at apple.com
Fri Dec 11 09:35:30 PST 2009
On Dec 11, 2009, at 9:03 AM, David Greene wrote:
>> If you're asking if a new dbgs() might be useful, "yes if specified well".
>> If you're asking if you can convert everything to using it, "no".
> I'm not sure what you mean here. It's not ok to convert code under DEBUG() or
> #ifndef NDEBUG to use dbgs()?
> Then what's the point of providing it?
I don't know what dbgs does, so I don't know!
> My intent is to have dbgs() == errs() when debug mode is disabled.
Do you know why DOUT was removed? The problem is that things like this:
DOUT << foo();
evaluate foo even when assertions are disabled. This is bad, and bringing it back with a new name is not good.
>>> There are some tricky cases where dump routines are used either to
>>> print error messages or to print debug information. In those cases
>>> I may have to parameterize the dump routine with the stream.
>> What do you mean?
> For example, SDNode::dump() is used to both print out debug information
> and to do dumps in error context (cannot select, etc.).
> One option is to make the signature SDNode::dump(raw_ostream &) or create
> a new overload.
The normal pattern is to define print(raw_ostream&) and have dump() call print(errs()).
More information about the llvm-dev