[cfe-commits] [PATCH] First step towards adding a parent map to the ASTContext.

Jordan Rose jordan_rose at apple.com
Wed Jan 16 09:19:05 PST 2013


  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



More information about the cfe-commits mailing list