[cfe-dev] CFG blocks and variable scope
Martin Doucha
next_ghost at quick.cz
Tue Mar 31 12:05:05 PDT 2009
Ted Kremenek wrote:
> Ideally (1) comes from Sema. I don't want us to reconstruct scope.
> We should solicit comments from others on cfe-dev on the best way to
> query scope information (those working on the C++ side of things might
> have some specific thoughts).
Agreed.
> For (2), we need to think of how to deliver this information to
> existing clients. Do we introduce a new subclass of Stmt that is
> publicly visible in the ASTs (I don't think this is a great idea) or
> do we have CFGBlocks contain smart pointers that reference either
> Stmt* (the case right now) or Decl* (which would represent a variable
> going out of scope). If we choose the latter, we need to update the
> client interface for CFGs (and the clients themselves) before we start
> making changes to CFG construction. That way once we have CFGs that
> contain the "object is now dead" information our clients will be able
> to pick it up.
This decision is yours to make. But I'd prefer to keep CFG interface as
is. Adding virtual statements during flattening of AST into basic blocks
sounds like a good idea to me.
> Also, I think the compact representation in the CFG that we discussed
> should come last. I see it as an optimization. Once all the
> interfaces are in place we should be able to switch over to it. Doing
> it first would introduce one more implementation detail that would get
> in the way of having an end-to-end implementation.
Agreed.
Regards,
Martin
More information about the cfe-dev
mailing list