[demangler] Add StringView conversion operator
authorNathan Sidwell <nathan@acm.org>
Tue, 1 Mar 2022 16:36:24 +0000 (08:36 -0800)
committerNathan Sidwell <nathan@acm.org>
Mon, 28 Mar 2022 18:19:55 +0000 (11:19 -0700)
commit1066e397fa907629f0da370f9721821c838ed30a
treefe0c8f680df1ec22eb5643b2703b987f94227780
parentb6dab4ebac595c61ed00c8559307a15fd3b9d077
[demangler] Add StringView conversion operator

The OutputBuffer class tries to present a NUL-terminated string API to
consumers.  But several of them would prefer a StringView.  In
particular the Microsoft demangler, juggles between NUL-terminated and
StringView, which is confusing.

This adds a StringView conversion, and adjusts the Demanglers that can
benefit from that.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D120990
libcxxabi/src/demangle/Utility.h
llvm/include/llvm/Demangle/Utility.h
llvm/lib/Demangle/MicrosoftDemangle.cpp
llvm/lib/Demangle/MicrosoftDemangleNodes.cpp
llvm/unittests/Demangle/ItaniumDemangleTest.cpp
llvm/unittests/Demangle/OutputBufferTest.cpp