[cfe-dev] CFGElement changes and initializers addition (with patch)

Ted Kremenek kremenek at apple.com
Wed Aug 18 00:14:58 PDT 2010


On Aug 17, 2010, at 10:47 PM, Jordy Rose wrote:

> 
> - I like the single enum rather than kind and subkind, but there are 7
> elements, not 6. So it won't fit in a PointerIntPair anyway, though having
> a Stmt* field (or void*) and an enum field would be preferable to two
> PointerIntPairs.
> I'm still not totally convinced we need scope markers in the CFG, though.

I don't think we need the scope markers either, and would actually prefer we took them out.

> 
> - Why don't we make this a static type hierarchy like SVal or MemRegion?
> We'd have CFGStmt, CFGInitializer, CFGDestructor, and CFGScope(Marker)
> inheriting from CFGElement. That way we can have, among other things, a
> CFGStmt that simplifies to a Stmt. Instead of asserts, we can just have the
> type-specific methods on the subclasses.

I had this thought as well.  The approach would be closer to SVal than MemRegion; I'd prefer we didn't have virtual functions in these classes, and keep the size of CFGElement object constant.  The nice thing about this approach is that it (a) uses strong-typing to enforce the APIs and (b) we can associate accessor (e.g., 'isLValue()') with only the appropriate CFGElement sub-class (e.g., CFGStmt).





More information about the cfe-dev mailing list