[llvm] c8144ee - [RustDemangle] remove StringView::dropFront
Nick Desaulniers via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 14 09:23:39 PDT 2023
Author: Nick Desaulniers
Date: 2023-04-14T09:18:07-07:00
New Revision: c8144eea9eff03a6a803d8e5dc45776f035486af
URL: https://github.com/llvm/llvm-project/commit/c8144eea9eff03a6a803d8e5dc45776f035486af
DIFF: https://github.com/llvm/llvm-project/commit/c8144eea9eff03a6a803d8e5dc45776f035486af.diff
LOG: [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
Added:
Modified:
llvm/lib/Demangle/RustDemangle.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Demangle/RustDemangle.cpp b/llvm/lib/Demangle/RustDemangle.cpp
index 8c01155127d8..0063f415ff8b 100644
--- a/llvm/lib/Demangle/RustDemangle.cpp
+++ b/llvm/lib/Demangle/RustDemangle.cpp
@@ -202,8 +202,7 @@ bool Demangler::demangle(StringView Mangled) {
return false;
}
size_t Dot = Mangled.find('.');
- Input = Mangled.substr(0, Dot);
- StringView Suffix = Mangled.dropFront(Dot);
+ Input = Dot == StringView::npos ? Mangled : Mangled.substr(0, Dot);
demanglePath(IsInType::No);
@@ -215,9 +214,9 @@ bool Demangler::demangle(StringView Mangled) {
if (Position != Input.size())
Error = true;
- if (!Suffix.empty()) {
+ if (Dot != StringView::npos) {
print(" (");
- print(Suffix);
+ print(Mangled.substr(Dot));
print(")");
}
More information about the llvm-commits
mailing list