diff options
author | Devang Patel <dpatel@apple.com> | 2009-09-29 18:39:56 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-09-29 18:39:56 +0000 |
commit | e4002bc8194a36ff425f37829d6fb04a56ef1358 (patch) | |
tree | 0cee552e94f7c8c637888ee995d6f5314dee91ae | |
parent | 428fa81b068032e70a4df96a9bf95aea8647bae7 (diff) | |
download | external_llvm-e4002bc8194a36ff425f37829d6fb04a56ef1358.zip external_llvm-e4002bc8194a36ff425f37829d6fb04a56ef1358.tar.gz external_llvm-e4002bc8194a36ff425f37829d6fb04a56ef1358.tar.bz2 |
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
-rw-r--r-- | include/llvm/ADT/StringRef.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index e4fd258..30379a3 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) |