[Support] Add StringRef::withNullAsEmpty()
authorZachary Turner <zturner@google.com>
Mon, 19 Sep 2016 15:34:51 +0000 (15:34 +0000)
committerZachary Turner <zturner@google.com>
Mon, 19 Sep 2016 15:34:51 +0000 (15:34 +0000)
commit47d5614967e9b756d4fb3408c8eae99b980fc7af
tree46ed6a03802aafc82b63eedcc490cd5cff669c22
parent9be72675169ba3644b5e004e4ba9e704e5651585
[Support] Add StringRef::withNullAsEmpty()

When porting large bodies of code from using const char*
to StringRef, it is helpful to be able to treat nullptr
as an empty string, since that it is often what it is used
to indicate in C-style code.

Differential Revision: https://reviews.llvm.org/D24697

llvm-svn: 281906
llvm/include/llvm/ADT/StringRef.h