Skip to content
Snippets Groups Projects
Commit 03e17f83 authored by Chris Lattner's avatar Chris Lattner
Browse files

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
parent b1995dff
No related branches found
No related tags found
No related merge requests found
...@@ -149,7 +149,10 @@ namespace llvm { ...@@ -149,7 +149,10 @@ namespace llvm {
unsigned edit_distance(StringRef Other, bool AllowReplacements = true); unsigned edit_distance(StringRef Other, bool AllowReplacements = true);
/// str - Get the contents as an std::string. /// 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 /// @name Operator Overloads
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment