[llvm] r176408 - recommit r172363 & r171325 (reverted in r172756)
Nuno Lopes
nunoplopes at sapo.pt
Mon Mar 4 10:33:14 PST 2013
> On Mar 4, 2013, at 11:27 AM, Nuno Lopes <nunoplopes at sapo.pt> wrote:
>
>>>> Shuxin: I'm not breaking any assumption here.
>>> If you don't think you break the assumption, tell us your immediate
>>> reaction to
>>> the class name "ObjectSizeOffsetVisitor".
>>>
>>> It seem so odd to me that xxx_ObjectWhatever() return a meaningful
>>> value however we have no idea which
>>> object it is talking about.
>>>
>
> Nuno,
>
> I think, the issue is mostly one of naming things as precisely as possible
> or at least have the documentation describe it as accurate as possible.
>
> If we call a function "getObjectSize" vs.
> "getPtrAdjustedSizeOfPointedToByObject(s)", this can make a big
> difference. I claim it could have prevented the basicaa bug we had: I
> think it was probably due to the misconception that getObjectSize will
> always return the size of the pointed to underlying object - as it turns
> out this was not the case - or it has evolved over time not to be the
> case anymore. Either way, by naming things more precisely we can avoid
> future bugs.
Well, I see that the naming may not be the best, but your proposed name is
way too big, IMHO :) And "adjusted size" doesn't really mean much.
LLVM is just following gcc's convention here (from __builtin_object_size).
Also, I believe that computing the size of an object and deciding whether a
pointer points to a single object are separate functionality. I don't think
we need to differentiate between getObjectSize() and getObjectsSize().
Just FYI, I implemented getObjectSize() myself and I introduced the bug in
BasicAA. This was simply an oversight (mine) when I did a bunch of code
cleanup at the time. It was not because a misconception by someone else.
Regarding your previous email, please commit the patch to the documentation.
Thanks for handling that!
Nuno
More information about the llvm-commits
mailing list