[cfe-commits] r169589 - /cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp

Benjamin Kramer benny.kra at gmail.com
Fri Dec 7 10:35:26 PST 2012


On 07.12.2012, at 19:05, Ted Kremenek <kremenek at apple.com> wrote:

> On Dec 7, 2012, at 9:47 AM, Jordan Rose <jordan_rose at apple.com> 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





More information about the cfe-commits mailing list