[llvm] r282116 - =delete the StringRef(nullptr_t) constructor.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 21 15:29:37 PDT 2016


Author: zturner
Date: Wed Sep 21 17:29:36 2016
New Revision: 282116

URL: http://llvm.org/viewvc/llvm-project?rev=282116&view=rev
Log:
=delete the StringRef(nullptr_t) constructor.

It's a guaranteed crash if you construct a StringRef with
nullptr, so might as well delete the constructor that allows
it.

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=282116&r1=282115&r2=282116&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringRef.h (original)
+++ llvm/trunk/include/llvm/ADT/StringRef.h Wed Sep 21 17:29:36 2016
@@ -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) {




More information about the llvm-commits mailing list