[PATCH] D149675: [Demangle] convert itaniumDemangle and nonMicrosoftDemangle to use std::string_view

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 15:44:03 PDT 2023


nickdesaulniers marked an inline comment as done.
nickdesaulniers added a comment.

In D149675#4313933 <https://reviews.llvm.org/D149675#4313933>, @efriedma wrote:

> Maybe it makes sense to revert D149104 <https://reviews.llvm.org/D149104> while you're fixing the various demanglers to correctly respect the input length?

This should fix-forwards the test. Sorry it took me so long to root cause.



================
Comment at: llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp:89-93
+  if (!Undecorated && DecoratedStr.substr(6) == "__imp_") {
     Prefix = "import thunk for ";
-    Undecorated = itaniumDemangle(DecoratedStr + 6, nullptr, nullptr, nullptr);
+    Undecorated =
+        itaniumDemangle(DecoratedStr.substr(6), nullptr, nullptr, nullptr);
   }
----------------
efriedma wrote:
> nickdesaulniers wrote:
> > This needs a bounds check; otherwise a few lllvm-cxxfilt tests fail an assertion.
> `DecoratedStr.substr(6) == "__imp_"` looks wrong.  Can we not just use `DecoratedStr.starts_with("__imp_")`?
mid-air collision on your comment, PTAL. also phab is being slow for me today.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149675



More information about the llvm-commits mailing list