Makes an empty stringref have a valid Data pointer (#28)

Now acts similar to std::string, where an empty construction string is valid.
This commit is contained in:
Thad House
2017-08-26 10:04:11 -07:00
committed by Peter Johnson
parent 8416b4e42c
commit 5d403a7b49

View File

@@ -76,7 +76,9 @@ namespace llvm {
/// @{
/// Construct an empty string ref.
/*implicit*/ StringRef() : Data(nullptr), Length(0) {}
/*implicit*/ StringRef() : Data(""), Length(0) {
set_null_terminated(true);
}
/// Construct a string ref from a cstring.
/*implicit*/ StringRef(const char *Str)