[PATCH] D148546: Reland: [Demangle] replace use of llvm::StringView w/ std::string_view

David Spickett via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 01:42:17 PDT 2023


DavidSpickett added a comment.

I am confused why startswith is in the itanium demangle namespace but I could be confusing a specialised function with the generic one that works for any string view. Otherwise looks fine at a glance.



================
Comment at: llvm/include/llvm/Demangle/ItaniumDemangle.h:1586
       // The instantiations are typedefs that drop the "basic_" prefix.
-      assert(SV.startsWith("basic_"));
+      assert(llvm::itanium_demangle::starts_with(SV, "basic_"));
       SV.remove_prefix(sizeof("basic_") - 1);
----------------
Is this right? Not sure `itanium_demangle` makes sense here.


================
Comment at: llvm/include/llvm/Demangle/ItaniumDemangle.h:2486
+  bool consumeIf(std::string_view S) {
+    if (llvm::itanium_demangle::starts_with(std::string_view(First, Last - First), S)) {
       First += S.size();
----------------
Same here, namespace doesn't sound right.


================
Comment at: llvm/include/llvm/Demangle/MicrosoftDemangle.h:14
 
+#include <cassert>
+#include <string_view>
----------------
Needed because llvm's stringview included assert?


================
Comment at: llvm/include/llvm/Demangle/Utility.h:19
 
-#include "StringView.h"
+#include "DemangleConfig.h"
+
----------------
Why does this change?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148546



More information about the llvm-commits mailing list