Skip to content

Commit c8144ee

Browse files
[RustDemangle] remove StringView::dropFront
Toward the goal of replacing llvm::StringView with std::string_view, first replacing users of llvm::StringView::dropFront, this case in the Rust demangling scheme seemed worth its own commit+review. Reviewed By: erichkeane, MaskRay Differential Revision: https://reviews.llvm.org/D148272
1 parent 6cdfa29 commit c8144ee

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Demangle/RustDemangle.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ bool Demangler::demangle(StringView Mangled) {
202202
return false;
203203
}
204204
size_t Dot = Mangled.find('.');
205-
Input = Mangled.substr(0, Dot);
206-
StringView Suffix = Mangled.dropFront(Dot);
205+
Input = Dot == StringView::npos ? Mangled : Mangled.substr(0, Dot);
207206

208207
demanglePath(IsInType::No);
209208

@@ -215,9 +214,9 @@ bool Demangler::demangle(StringView Mangled) {
215214
if (Position != Input.size())
216215
Error = true;
217216

218-
if (!Suffix.empty()) {
217+
if (Dot != StringView::npos) {
219218
print(" (");
220-
print(Suffix);
219+
print(Mangled.substr(Dot));
221220
print(")");
222221
}
223222

0 commit comments

Comments
 (0)