[PATCH] D148272: [RustDemangle] remove StringView::dropFront

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 14:42:03 PDT 2023


nickdesaulniers created this revision.
nickdesaulniers added reviewers: erichkeane, MaskRay, dblaikie, tmiasko.
Herald added subscribers: JDevlieghere, hiraditya.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148272

Files:
  llvm/lib/Demangle/RustDemangle.cpp


Index: llvm/lib/Demangle/RustDemangle.cpp
===================================================================
--- llvm/lib/Demangle/RustDemangle.cpp
+++ llvm/lib/Demangle/RustDemangle.cpp
@@ -203,7 +203,9 @@
   }
   size_t Dot = Mangled.find('.');
   Input = Mangled.substr(0, Dot);
-  StringView Suffix = Mangled.dropFront(Dot);
+  StringView Suffix;
+  if (Dot != StringView::npos)
+    Suffix = Mangled.substr(Dot);
 
   demanglePath(IsInType::No);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148272.513367.patch
Type: text/x-patch
Size: 454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/bf926356/attachment.bin>


More information about the llvm-commits mailing list