<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 25, 2016, at 6:10 AM, Zachary Turner via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><div class=""><div dir="ltr" class=""><div class="">With that out of the way, here are some reasons I can see to allow StringRef accept null to its constructor which are independent of LLDB and stand on their own merit.</div><div class=""><br class=""></div><div class="">1) std::string_view<> can be constructed with null.  I don't know when we will be able to use std::string_view<>, but there's a chance that at some point in the future we may wish to remove StringRef in favor of string_view.  That day isn't soon, but in any case, it will be easier if our assumptions are the same.</div><div class=""><br class=""></div><div class="">2) [nullptr, nullptr+0) is a valid range.  Why shouldn't we be able to construct a StringRef from an otherwise perfectly valid range?</div><div class=""><br class=""></div><div class="">3) StringRef() can <b class="">already</b> be constructed from nullptr (!)  Surprised?  That's what happens when you invoke the default constructor.  It happily initializes the internal Data with null.  So why not allow the same behavior when invoking the const char * constructor?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thoughts?</div></div></div></blockquote><br class=""></div><div>Seems fine to me, I think the default constructor behavior makes it clear that this is fine.  I don’t recall why the assert was originally added, but I don’t think it has added much (if any) value over the years.</div><div><br class=""></div><div>-Chris</div><br class=""></body></html>