On 07.12.2012, at 19:05, Ted Kremenek <[email protected]> wrote: > On Dec 7, 2012, at 9:47 AM, Jordan Rose <[email protected]> wrote: > >> Yuck. Can we push this up to ASTContext or AnalysisManager? > > It doesn't belong in ASTContext, unless it is a general optimization for all > clients. > > Pushing to AnalysisManager seems reasonable. > >> >> Also, it seems like a waste to double the size of every value in the map by >> using Optional, even if you would otherwise need to do two lookups (first >> find() and then insert()) in the slow case. > > Two lookups would be noticeably slower. I also suspect the memory overhead > is inconsequential. We are talking about a few kilobytes at most, on a very > complicated file. We can bit-mangle the pointer, if you like, to provide a > sentinel value.
Maybe we should specialize Optional on types that have pointerLikeTypeTraits and automatically enable bitmangling if it has a spare bit. OTOH Optional on pointers doesn't seem to be very common in clang so it may not be worth the effort. - Ben _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
