Hm. I'm worried about the expense of looking up a single parent for an 
arbitrary Stmt* here. In the current libAST version of ParentMap, It's just a 
simple DenseMap lookup. Now, it's a wrap/unwrap in a DynTypedNode, followed by 
a lookup, followed by a "get first" or "get last" on the ParentVector.

  I'm not saying this isn't necessary in the general case, but it is a hot part 
of the analyzer. I'd feel better if we were sure the wrap/unwrap could be 
optimized away.

  Also, what's the motivation behind returning the ParentVector by value? How 
about an ArrayRef? That way there's no permanence implied, but it still takes 
constant time and doesn't copy anything.

  As far as the interface goes, well, you can see all the convenience methods 
we have on the current ParentMap. `isConsumedExpr` is the most important, but 
the recursive `getParentIgnore*` methods are also useful.

  Like I said before, ParentMap is mostly used for location info and to see 
whether or not an expression is top-level, so we can //probably// get away with 
using an arbitrary instantiation parent most of the time in both the analyzer 
and the migrator(s).

http://llvm-reviews.chandlerc.com/D267
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to