projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6bedb30
)
StringRef(const char*) should not be used to turn null pointers into empty
author
Daniel Dunbar
<daniel@zuster.org>
Thu, 12 Nov 2009 21:26:11 +0000
(21:26 +0000)
committer
Daniel Dunbar
<daniel@zuster.org>
Thu, 12 Nov 2009 21:26:11 +0000
(21:26 +0000)
strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87031
91177308
-0d34-0410-b5e6-
96231b3b80d8
include/llvm/ADT/StringRef.h
patch
|
blob
|
history
diff --git
a/include/llvm/ADT/StringRef.h
b/include/llvm/ADT/StringRef.h
index 269d16af6187add1c9dac9849a5b9f9fbb3dc20b..b07dcc12ced310f5ac4a3079590deb1b0a5ea28f 100644
(file)
--- 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)