OSDN Git Service

=delete the StringRef(nullptr_t) constructor.
authorZachary Turner <zturner@google.com>
Wed, 21 Sep 2016 22:29:36 +0000 (22:29 +0000)
committerZachary Turner <zturner@google.com>
Wed, 21 Sep 2016 22:29:36 +0000 (22:29 +0000)
It's a guaranteed crash if you construct a StringRef with
nullptr, so might as well delete the constructor that allows
it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282116 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/StringRef.h

index 5d0aafc..ff423e8 100644 (file)
@@ -68,6 +68,8 @@ namespace llvm {
     /// Construct an empty string ref.
     /*implicit*/ StringRef() : Data(nullptr), Length(0) {}
 
+    StringRef(std::nullptr_t) = delete;
+
     /// Construct a string ref from a cstring.
     /*implicit*/ StringRef(const char *Str)
       : Data(Str) {