]> granicus.if.org Git - llvm/commitdiff
=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 5d0aafc4683d3c749081e10ce78b5b02864f1e58..ff423e8a34090c6c5f400e1561ab29436d1edc00 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) {