[LLVMdev] [PATCH] Implement dbgs()
Chris Lattner
clattner at apple.com
Fri Dec 18 22:16:49 PST 2009
On Dec 18, 2009, at 6:36 PM, David Greene wrote:
>>> +// Signal handlers - dump debug output on termination.
>>> +static void debug_user_sig_handler(void *Cookie)
>>> +{
>>> + llvm::circular_raw_ostream *logout =
>>> + dynamic_cast<llvm::circular_raw_ostream *>(&llvm::dbgs());
>>
>> Please do not use dynamic_cast, we're trying to eliminate the last
>> RTTI use in the compiler.
>
> Do you want me to use dyn_cast? That means I'll have to add some more
> stuff to raw_ostream and circular_raw_ostream.
No, dyn_cast is only really suitable for static class hierarchies.
> Or I think I can just assume (Yikes!) that if the signal handler is
> invoked it will really be a circular_raw_ostream since the handler
> should (!) only be set up in debug mode.
>
> That scares me a bit, though.
Why don't you just check #ifndef NDEBUG like the code that sets it up?
-Chris
More information about the llvm-dev
mailing list