From 15bd6737cfc01bda6baddfd850ae9ef5ed2cf7fd Mon Sep 17 00:00:00 2001 From: Malcolm Parsons Date: Tue, 29 Nov 2016 10:53:18 +0000 Subject: [PATCH] [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288131 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/StringRef.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index d8e0732719f..09f9d658c9e 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -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) -- 2.50.1