]> granicus.if.org Git - clang/commit
[analyzer] Treat C++ 'throw' as a sink.
authorJordan Rose <jordan_rose@apple.com>
Sat, 18 Aug 2012 00:30:23 +0000 (00:30 +0000)
committerJordan Rose <jordan_rose@apple.com>
Sat, 18 Aug 2012 00:30:23 +0000 (00:30 +0000)
commitc32a453e40b2c8878fed10512fb2f570b7aba576
treec2478526f43d1daba84c62d04fa57e9a78db9a5e
parent19275bdec34b2ec5d77a78c0ea393a45ab05e128
[analyzer] Treat C++ 'throw' as a sink.

Our current handling of 'throw' is all CFG-based: it jumps to a 'catch' block
if there is one and the function exit block if not. But this doesn't really
get the right behavior when a function is inlined: execution will continue on
the caller's side, which is always the wrong thing to do.

Even within a single function, 'throw' completely skips any destructors that
are to be run. This is essentially the same problem as @finally -- a CFGBlock
that can have multiple entry points, whose exit points depend on whether it
was entered normally or exceptionally.

Representing 'throw' as a sink matches our current (non-)handling of @throw.
It's not a perfect solution, but it's better than continuing analysis in an
inconsistent or even impossible state.

<rdar://problem/12113713>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162157 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Core/ExprEngine.cpp
test/Analysis/exceptions.mm
test/Analysis/misc-ps-region-store.cpp