From 73e8d435885066e7dc1f9d543e567b556cd0fc69 Mon Sep 17 00:00:00 2001 From: Devang Patel <dpatel@apple.com> Date: Tue, 29 Sep 2009 18:39:56 +0000 Subject: [PATCH] Create empty StringRef is incoming cstring is NULL. llvm-svn: 83082 --- llvm/include/llvm/ADT/StringRef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h index e4fd258cb871..30379a38f46f 100644 --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/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)