[cfe-dev] CFG blocks and variable scope

Martin Doucha next_ghost at quick.cz
Sat Mar 28 12:19:41 PDT 2009


Ted Kremenek wrote:
> Hi Martin,
>
> There is currently no scope information in the CFG (or the AST for
> that matter).  Adding this information would be extremely useful, and
> would probably tie in for eventual support for encoding calls to C++
> destructors in the CFG as well.
>
> Ted

Great, so what's the preferable way of doing this? My idea is to have a
tree of scopes (corresponding to CompoundStmt), each scope containing a
complete list of variables declared inside it (not including
declarations in nested scopes) regardless of control flow. Then each CFG
block would have a single parent scope (the one directly above it) and a
list of scopes inside it with a statement iterator pair designating the
start and end of the scope in the block. Now the question is, can
different edges leaving the block leave different sets of scopes?

Regards,
Martin



More information about the cfe-dev mailing list