[PATCH] D27094: [StringRef] Use default member initializers and = default.

Malcolm Parsons via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 03:03:20 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL288131: [StringRef] Use default member initializers and = default. (authored by malcolm.parsons).

Changed prior to commit:
  https://reviews.llvm.org/D27094?vs=79216&id=79529#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27094

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
@@ -53,10 +53,10 @@
 
   private:
     /// The start of the string, in an external buffer.
-    const char *Data;
+    const char *Data = nullptr;
 
     /// The length of the string.
-    size_t Length;
+    size_t Length = 0;
 
     // Workaround memcmp issue with null pointers (undefined behavior)
     // by providing a specialized version
@@ -71,7 +71,7 @@
     /// @{
 
     /// Construct an empty string ref.
-    /*implicit*/ StringRef() : Data(nullptr), Length(0) {}
+    /*implicit*/ StringRef() = default;
 
     /// Disable conversion from nullptr.  This prevents things like
     /// if (S == nullptr)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27094.79529.patch
Type: text/x-patch
Size: 819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161129/de7ffba1/attachment.bin>


More information about the llvm-commits mailing list