This is an archive of the discontinued LLVM Phabricator instance.

[Damangle] convert rustDemangle to use std::string_view
ClosedPublic

Authored by nickdesaulniers on May 3 2023, 2:03 PM.

Details

Summary

I was doing this API conversion to use std::string_view top-down in
D149104, but this exposed issues in individual demanglers that needed to
get fixed first. There's no issue with the conversion for the Rust
demangler, so convert it first.

Diff Detail

Event Timeline

nickdesaulniers created this revision.May 3 2023, 2:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 3 2023, 2:03 PM
nickdesaulniers requested review of this revision.May 3 2023, 2:03 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 3 2023, 2:03 PM
nickdesaulniers added a subscriber: erichkeane.
nickdesaulniers added inline comments.
lldb/source/Core/Mangled.cpp
263

oh, I meant to remove this now that I provide operator std::string_view() on class ConstString.

  • remove GetStringRef call
MaskRay accepted this revision.May 3 2023, 2:09 PM
MaskRay added a subscriber: labath.
MaskRay added inline comments.
lldb/include/lldb/Utility/ConstString.h
186

Perhaps I find the previous comment not useful as well Implicitly convert \class ConstString instances to \class StringRef.

If we want to emphasize that they are implicit conversions instead of explicit conversions (https://en.cppreference.com/w/cpp/language/cast_operator), a single comment // Implicit conversion functions. should suffice, covering all conversion functions.

@JDevlieghere @labath

This revision is now accepted and ready to land.May 3 2023, 2:09 PM
  • update llvm-rust-demangle-fuzzer.cpp call site
  • rebase, reformat for presubmit tests
nickdesaulniers marked an inline comment as done.
  • rebase for presubmits
MaskRay added inline comments.Jun 2 2023, 12:07 PM
llvm/lib/Demangle/RustDemangle.cpp
150

I see that this patch drops if (MangledName == nullptr) (D101444). This is a right direction.

  • rebase on top of D149675 (I wasn't sure which would land first)
This revision was landed with ongoing or failed builds.Jun 2 2023, 3:11 PM
This revision was automatically updated to reflect the committed changes.