1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Don't pass in a null pointer to std::string's ctor, an empty string

ref should produce an empty std::string.  This fixes PR7879.

llvm-svn: 111332
This commit is contained in:
Chris Lattner 2010-08-18 00:11:25 +00:00
parent 982a804b20
commit c27b10f80d

View File

@ -149,7 +149,10 @@ namespace llvm {
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