Attached is a fix for https://llvm.org/bugs/show_bug.cgi?id=15212 .
Summary: Tighten up some of the results for __builtin_object_size(ptr, type) when given type == 1 or type == 3 + fixed a bug where we would report incorrect results for type == 3.
90% of the patch is courtesy of Richard Smith. 
George
builtin_object_size_initial.diff (9.87 KB)
Attached is a fix for https://llvm.org/bugs/show_bug.cgi?id=15212 .
Summary: Tighten up some of the results for __builtin_object_size(ptr,
type) when given type == 1 or type == 3 + fixed a bug where we would report
incorrect results for type == 3.
> 90% of the patch is courtesy of Richard Smith. 
Thanks for working on this. Patches to clang should be sent to the
clang-commits list. Also, please consider using phabricator, it would make
the patch easier to review (for me at least).