[cfe-dev] CLang 2.1 doesn't catch assert within if

Don Quixote de la Mancha quixote at dulcineatech.com
Fri Oct 7 22:17:37 PDT 2011


Awesome!  Sort of.

On Fri, Oct 7, 2011 at 10:11 PM, Ted Kremenek <kremenek at apple.com> wrote:
> The analyzer doesn't find this, but it would be an interesting check to write.  Conditional code for branches are just asking for trouble.

It would be best if I didn't have to explicitly depend on the advance
knowledge that assert() is a macro that can be defined to NULL.

Better would be to preprocess a sample with NDEBUG defined and without
NDEBUG defined, then check that every line of code that is still
present in both cases is in the same basic block in both cases, while
allowing some of the lines to just disappear.

I will need some hand-holding here as I don't have the first clue yet
as to how to actually write an analyzer.

I've been trying to build LLVM on Ubuntu 11.04 by bootstrapping it
from scratch, without using a prebuild llvm-gcc.  I think it would
work better for this purpose if I built the SVN on Mac OS X without
trying to bootstrap it, but to instead use the llvm-gcc that comes
with Xcode 4.1.  I'll give that a try right now.

Don Quixote
-- 
Don Quixote de la Mancha
Dulcinea Technologies Corporation
Software of Elegance and Beauty
http://www.dulcineatech.com
quixote at dulcineatech.com




More information about the cfe-dev mailing list