[llvm] r288131 - [StringRef] Use default member initializers and = default.

Malcolm Parsons via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 02:53:18 PST 2016


Author: malcolm.parsons
Date: Tue Nov 29 04:53:18 2016
New Revision: 288131

URL: http://llvm.org/viewvc/llvm-project?rev=288131&view=rev
Log:
[StringRef] Use default member initializers and = default.

Summary: This makes the default constructor implicitly constexpr and noexcept.

Reviewers: zturner, beanz

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D27094

Modified:
    llvm/trunk/include/llvm/ADT/StringRef.h

Modified: llvm/trunk/include/llvm/ADT/StringRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=288131&r1=288130&r2=288131&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringRef.h (original)
+++ llvm/trunk/include/llvm/ADT/StringRef.h Tue Nov 29 04:53:18 2016
@@ -53,10 +53,10 @@ namespace llvm {
 
   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 @@ namespace llvm {
     /// @{
 
     /// 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)




More information about the llvm-commits mailing list