[PATCH] D39398: [CFG][Analyzer] Add LoopExit element to the CFG in more cases

Peter Szecsi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 15:47:44 PST 2018

szepet updated this revision to Diff 130503.
szepet marked 2 inline comments as done.
szepet added a comment.

Added comments and removed indirect goto support from this patch.

>   This seems a bit scary because if there's no obvious one-to-once correspondence between entrances and exits along every path, how would we know when to pop loop contexts from the stack of location contexts? Like, if we attach variable lifetime checks to the loop exit, would we need to write additional code in the analyzer to see if the variable indeed goes out of scope on the current path.

Yepp, we should check if the current loop (one quick method on the LocationContext) belongs to the LoopExit. This was already necessary in the previous patch since cases like:


In the above example even if `Cond` is false the analyzer will encounter the LoopExit since it is the first element of the `breakBlock` of the loop. (So it is within the same block as stmt1 and stmt2)

I have removed IndirectGoto support since it was not precise enough and rather handle this in the analyzer. (`isPrecisableModelableLoop` function in the https://reviews.llvm.org/D41151)



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39398.130503.patch
Type: text/x-patch
Size: 15535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180118/8172e619/attachment-0001.bin>

More information about the cfe-commits mailing list