diff options
author | Nathan Sidwell <nathan@acm.org> | 2022-03-01 19:36:24 +0300 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2022-03-28 21:19:55 +0300 |
commit | 1066e397fa907629f0da370f9721821c838ed30a (patch) | |
tree | fe0c8f680df1ec22eb5643b2703b987f94227780 /libcxxabi/src/demangle | |
parent | b6dab4ebac595c61ed00c8559307a15fd3b9d077 (diff) |
[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
Diffstat (limited to 'libcxxabi/src/demangle')
-rw-r--r-- | libcxxabi/src/demangle/Utility.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libcxxabi/src/demangle/Utility.h b/libcxxabi/src/demangle/Utility.h index 76330851d21b..1390f14b10d4 100644 --- a/libcxxabi/src/demangle/Utility.h +++ b/libcxxabi/src/demangle/Utility.h @@ -75,6 +75,8 @@ public: OutputBuffer(const OutputBuffer &) = delete; OutputBuffer &operator=(const OutputBuffer &) = delete; + operator StringView() const { return StringView(Buffer, CurrentPosition); } + void reset(char *Buffer_, size_t BufferCapacity_) { CurrentPosition = 0; Buffer = Buffer_; |