[llvm-commits] [llvm] r83082 - /llvm/trunk/include/llvm/ADT/StringRef.h

Dan Gohman gohman at apple.com
Thu Oct 1 10:39:00 PDT 2009


On Sep 29, 2009, at 11:57 AM, Devang Patel wrote:

>
> On Sep 29, 2009, at 11:53 AM, Chris Lattner wrote:
>
>>
>> On Sep 29, 2009, at 11:39 AM, Devang Patel wrote:
>>
>>> Author: dpatel
>>> Date: Tue Sep 29 13:39:56 2009
>>> New Revision: 83082
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=83082&view=rev
>>> Log:
>>> Create empty StringRef is incoming cstring is NULL.
>>
>> I don't think this is correct, StringRef shouldn't allow null  
>> cstrings to be passed in.
>
> I'm using it to pass optional strings. For example, linkage name in  
> debug info.
> Note, one can create empty StringRef by say
> 	SringRef foo;
> If this is not desirable then I'll update DebugInfo interface.

Hi Devang,

Can you use the StringRef(const char *data, unsigned length)  
constructor for
this purpose, passing in a length of 0?  That way the StringRef(const  
char *data)
constructor doesn't need to check for null.

Dan




More information about the llvm-commits mailing list