Fix bad CFG construction bug when handling C++ 'try' statements.
authorTed Kremenek <kremenek@apple.com>
Tue, 13 Nov 2012 00:12:13 +0000 (00:12 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 13 Nov 2012 00:12:13 +0000 (00:12 +0000)
commite6ee671e16ee75829db13b3146da5c59423bdaec
treea108dd1572d7c879c465d2cf6f1ac1a44cc66b56
parentc94c3bb5d024eff189cccbe31d10e8e0dfdd7341
Fix bad CFG construction bug when handling C++ 'try' statements.

This code assigned the last created CFGBlock* to the variable 'Block',
which is a scratch variable which is null'ed out after a block is
completed.  By assigning the last created block to 'Block', we start
editing a completed block, inserting CFGStmts that should be in
another block.  This was the case with 'try'.  The test case that
showed this had a while loop inside a 'try', and the logic before
the while loop was being included as part of the "condition block"
for the loop.  This showed up as a bogus dead store, but could
have lots of implications.

Turns out this bug was replicated a few times within CFG.cpp, so
I went and fixed up those as well.

llvm-svn: 167788
clang/lib/Analysis/CFG.cpp
clang/test/Analysis/dead-stores.cpp