[llvm-commits] [PATCH] review request: implementation of bounded StringRef::compare

Chris Lattner clattner at apple.com
Fri Apr 15 10:52:59 PDT 2011


On Apr 15, 2011, at 10:38 AM, Lenny Maiorani wrote:

> On 04/15/2011 11:29 AM, Chris Lattner wrote:
>> On Apr 15, 2011, at 9:43 AM, Lenny Maiorani wrote:
>> 
>>> On 04/15/2011 12:40 AM, Duncan Sands wrote:
>>>> Hi Lenny, this function seems a bit big to be declared inline.
>>>> 
>>>> Ciao, Duncan.
>>> Thanks for checking it out Duncan. I figured since it was only slightly larger than the original compare() it wouldn't be an issue, but you are correct, it is getting a little long. Attached is a new patch which implements the same thing, but not inlined.
>> I'm not opposed to this, but why is this needed?  StringRef carries a length, so you could just substr() the strings and then compare them?
>> 
>> -Chris
> I had thought about doing it that way. This way seems cleaner. I am implementing strncmp checker in Clang SA. I could substr() each of the strings then compare them with the one that is already there. Six of one and half dozen of the other. Is there any reason to prefer one method or the other?

Ok, I'm fine with it going in.  Thanks,

-Chris



More information about the llvm-commits mailing list