Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2022-03-01 19:36:24 +0300
committerNathan Sidwell <nathan@acm.org>2022-03-28 21:19:55 +0300
commit1066e397fa907629f0da370f9721821c838ed30a (patch)
treefe0c8f680df1ec22eb5643b2703b987f94227780 /libcxxabi/src/demangle
parentb6dab4ebac595c61ed00c8559307a15fd3b9d077 (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.h2
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_;