From: Devang Patel Date: Tue, 29 Sep 2009 18:39:56 +0000 (+0000) Subject: Create empty StringRef is incoming cstring is NULL. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=1e9a727f1058c9e8f90eae9ac656214265244f7f;p=oota-llvm.git Create empty StringRef is incoming cstring is NULL. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83082 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index e4fd258cb87..30379a38f46 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -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)