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

Ted Kremenek kremenek at apple.com
Fri Dec 7 10:48:41 PST 2012


On Dec 7, 2012, at 10:35 AM, Benjamin Kramer <benny.kra at gmail.com> wrote:

>> 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.

I had the same thought.  We'd need to be careful about alignment, but it seems completely doable.

> 
> OTOH Optional on pointers doesn't seem to be very common in clang so it may not be worth the effort.

It might be more common if it was implemented more efficiently.  It's a nice type-safe abstraction in the places where it is useful.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121207/62392fb8/attachment.html>


More information about the cfe-commits mailing list