<div>Their are a pair of debug macros I use in almost every project I work on and I would like to add them to LLVM if acceptable.</div><div><br></div><div>The existing DEBUG macro is good for a lot of things, but inadequate for certain situations. The may be cases where you wan't to run calculations in the debug version that lead up to assertions. In a scenario like this, you will likely need a temporary variable, and you calculations need to execute unconditionally. </div>
<div><br></div><div>For this type of scenario I use the _dbg macro:</div><br><div>#ifndef NDEBUG</div><div>#define _dbg(x)  x</div><div>#else</div><div>#define _dbg(x)</div><div>#endif</div><div><br></div><div>The other macro is just a slight variation on the existing DEBUG macro, but for the common case of printing something out to the debug console, its simpler to write, and in my opinion easier to read.</div>
<div><br></div><div><div>#define dbgout(x) DEBUG(dbgs()<<x)</div><div>#define dbgoutc(y,x) DEBUG_WITH_TYPE(x,dbgs()<<y)</div><div><br></div><div>-Nathan</div></div>