[PATCH] D16403: Add scope information to CFG

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 24 23:17:46 PDT 2017


NoQ added a comment.

Maxim, totally thanks for picking this up!

Could you explain the idea behind `shouldDeferScopeEnd`, maybe in a code comment before the function?

In https://reviews.llvm.org/D16403#788926, @m.ostapenko wrote:

> Current patch should support basic {If, While, For, Compound, Switch}Stmts as well as their interactions with {Break, Continue, Return}Stmts.
>  GotoStmt and CXXForRangeStmt are not supported at this moment.


`SwitchStmt` isn't much easier than `GotoStmt`; it doesn't jump backwards, but it can still jump into multiple different scopes. Does your code handle Duff's device (1) <https://www.lysator.liu.se/c/duffs-device.html> (2) <https://en.wikipedia.org/wiki/Duff's_device> correctly? We should probably add it as a test, or split out switch support into a separate patch together with goto, if such test isn't yet supported.


Repository:
  rL LLVM

https://reviews.llvm.org/D16403





More information about the cfe-commits mailing list