[PATCH] D24697: [support] Add StringRef::withNullAsEmpty
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 19 08:43:28 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL281906: [Support] Add StringRef::withNullAsEmpty() (authored by zturner).
Changed prior to commit:
https://reviews.llvm.org/D24697?vs=71724&id=71833#toc
Repository:
rL LLVM
https://reviews.llvm.org/D24697
Files:
llvm/trunk/include/llvm/ADT/StringRef.h
Index: llvm/trunk/include/llvm/ADT/StringRef.h
===================================================================
--- llvm/trunk/include/llvm/ADT/StringRef.h
+++ llvm/trunk/include/llvm/ADT/StringRef.h
@@ -88,6 +88,10 @@
/*implicit*/ StringRef(const std::string &Str)
: Data(Str.data()), Length(Str.length()) {}
+ static StringRef withNullAsEmpty(const char *data) {
+ return StringRef(data ? data : "");
+ }
+
/// @}
/// @name Iterators
/// @{
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24697.71833.patch
Type: text/x-patch
Size: 486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160919/9d4d1ab5/attachment.bin>
More information about the llvm-commits
mailing list