Index: llvm/trunk/include/llvm/ADT/StringRef.h =================================================================== --- llvm/trunk/include/llvm/ADT/StringRef.h +++ llvm/trunk/include/llvm/ADT/StringRef.h @@ -88,6 +88,10 @@ /*implicit*/ StringRef(const std::string &Str) : Data(Str.data()), Length(Str.length()) {} + static StringRef withNullAsEmpty(const char *data) { + return StringRef(data ? data : ""); + } + /// @} /// @name Iterators /// @{