ref should produce an empty std::string. This fixes PR7879.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111332
91177308-0d34-0410-b5e6-
96231b3b80d8
unsigned edit_distance(StringRef Other, bool AllowReplacements = true);
/// str - Get the contents as an std::string.
- std::string str() const { return std::string(Data, Length); }
+ std::string str() const {
+ if (Data == 0) return "";
+ return std::string(Data, Length);
+ }
/// @}
/// @name Operator Overloads