forked from OSchip/llvm-project
Create empty StringRef is incoming cstring is NULL.
llvm-svn: 83082
This commit is contained in:
parent
a4a7f44cb5
commit
73e8d43588
|
@ -46,7 +46,7 @@ namespace llvm {
|
|||
|
||||
/// Construct a string ref from a cstring.
|
||||
/*implicit*/ StringRef(const char *Str)
|
||||
: Data(Str), Length(::strlen(Str)) {}
|
||||
: Data(Str) { if (Str) Length = ::strlen(Str); else Length = 0; }
|
||||
|
||||
/// Construct a string ref from a pointer and length.
|
||||
/*implicit*/ StringRef(const char *_Data, unsigned _Length)
|
||||
|
|
Loading…
Reference in New Issue