aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ADT/StringRef.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h
index 269d16af61..b07dcc12ce 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) { if (Str) Length = ::strlen(Str); else Length = 0; }
+ : Data(Str), Length(::strlen(Str)) {}
/// Construct a string ref from a pointer and length.
/*implicit*/ StringRef(const char *data, size_t length)