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

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


nickdesaulniers updated this revision to Diff 513368.
nickdesaulniers added a comment.

- get rid of suffix entirely, skip substring if there's no .


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.513368.patch
Type: text/x-patch
Size: 684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/dd35f263/attachment.bin>


More information about the llvm-commits mailing list