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

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 14 09:23:44 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc8144eea9eff: [RustDemangle] remove StringView::dropFront (authored by nickdesaulniers).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148272/new/

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
@@ -202,8 +202,7 @@
     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 @@
   if (Position != Input.size())
     Error = true;
 
-  if (!Suffix.empty()) {
+  if (Dot != StringView::npos) {
     print(" (");
-    print(Suffix);
+    print(Mangled.substr(Dot));
     print(")");
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148272.513628.patch
Type: text/x-patch
Size: 684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230414/68af8f32/attachment.bin>


More information about the llvm-commits mailing list