Index: include/llvm/ADT/StringRef.h
===================================================================
--- include/llvm/ADT/StringRef.h	(revision 129637)
+++ include/llvm/ADT/StringRef.h	(copie de travail)
@@ -27,6 +27,9 @@
   /// situations where the character data resides in some other buffer, whose
   /// lifetime extends past that of the StringRef. For this reason, it is not in
   /// general safe to store a StringRef.
+  ///
+  /// Invariant: Data is non-null
+  ///
   class StringRef {
   public:
     typedef const char *iterator;
@@ -52,15 +55,15 @@
     /// @{
 
     /// Construct an empty string ref.
-    /*implicit*/ StringRef() : Data(0), Length(0) {}
+    /*implicit*/ StringRef() : Data(""), Length(0) {}
 
     /// Construct a string ref from a cstring.
     /*implicit*/ StringRef(const char *Str)
-      : Data(Str), Length(::strlen(Str)) {}
+      : Data(Str ? Str : ""), Length(Str ? ::strlen(Str) : 0) {}
 
     /// Construct a string ref from a pointer and length.
     /*implicit*/ StringRef(const char *data, size_t length)
-      : Data(data), Length(length) {}
+      : Data(data ? data : ""), Length(length) {}
 
     /// Construct a string ref from an std::string.
     /*implicit*/ StringRef(const std::string &Str)
@@ -161,7 +164,6 @@
 
     /// str - Get the contents as an std::string.
     std::string str() const {
-      if (Data == 0) return std::string();
       return std::string(Data, Length);
     }
 
