[cfe-dev] CFG blocks and variable scope
Ted Kremenek
kremenek at apple.com
Tue Mar 31 12:18:13 PDT 2009
On Mar 31, 2009, at 12:05 PM, Martin Doucha wrote:
>> 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.
A virtual statement would indeed be simpler from the client's
perspective (and much simpler to implement). I only suggested the
second approach because it is less invasive to the AST data
structures. Such a statement class would have to be declared in
Stmt.h, and we would need to include comments that instances of that
class will not usually be created in the AST itself. This is probably
the better approach unless others have strong objections.
More information about the cfe-dev
mailing list