[LLVMdev] Compilation Failure

David Greene dag at cray.com
Tue Sep 25 11:29:48 PDT 2007


On Monday 24 September 2007 17:23, Bill Wendling wrote:

> Weird. I see a potential problem, though. The code is like this:
>
> void dumpToDOUT(SparseBitVector<> *bitmap) {
>    dump(*bitmap, DOUT);
> }
>
> where dump expects an llvm::OStream& for the second argument.
> However, when NDEBUG is #defined, DOUT is "llvm::OStream(0)", so it
> can't be passed by reference.

We ran into a similar problem in our custom code here.  To work around
it I modified Debug.h like this:

#ifdef NDEBUG
static llvm::OStream NullStream(0);
#define DOUT llvm::NullStream
#else
#define DOUT llvm::getErrorOutputStream(DEBUG_TYPE)
#endif

                                             -Dave



More information about the llvm-dev mailing list