This is an archive of the discontinued LLVM Phabricator instance.

[StringView] remove ctor incompatible with std::string_view
ClosedPublic

Authored by nickdesaulniers on Apr 14 2023, 9:57 AM.

Details

Summary

Towards replacing llvm::StringView with std::string_view, remove ctor
that std::string_view doesn't have an analog for.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2023, 9:57 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
nickdesaulniers requested review of this revision.Apr 14 2023, 9:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2023, 9:57 AM
nickdesaulniers added inline comments.
llvm/include/llvm/Demangle/StringView.h
55–56

Nevermind this change and the addition of iterator. I'll remove that once I rebase on top of D148348.

erichkeane accepted this revision.Apr 14 2023, 9:59 AM

I think this is the right direction.

This revision is now accepted and ready to land.Apr 14 2023, 9:59 AM
MaskRay accepted this revision.Apr 14 2023, 10:26 AM
MaskRay added inline comments.
llvm/include/llvm/Demangle/ItaniumDemangle.h
2481

size_t n = std::distance(First, Last); can be removed.

3474
nickdesaulniers planned changes to this revision.Apr 14 2023, 10:46 AM
nickdesaulniers marked 2 inline comments as done.

hmm...a few tests are failing with this diff. Will take a look.

llvm/include/llvm/Demangle/Utility.h
67

This is the change that's breaking the tests...

llvm/include/llvm/Demangle/Utility.h
67

probably should be Temp.data() + Temp.size() - TempPtr

erichkeane added inline comments.Apr 14 2023, 10:55 AM
llvm/include/llvm/Demangle/Utility.h
67

TempPtr is not necessarily the Temp.data location, it looks like it is modified a h andful of times on line 59 and 65.

So this is meant to be a 'rest' kinda thing, but the code you changed it to is using the whole 'size'. I think you need to make Temp.size() be Temp.size() - std::distance(Temp.data(), TempPtr); (check for off-by-1 please :D).

  • remove std::distance, fix test failures
This revision is now accepted and ready to land.Apr 14 2023, 11:05 AM
llvm/include/llvm/Demangle/Utility.h
67

(check for off-by-1 please :D).

was there some additional check you wanted me to add here?

erichkeane added inline comments.Apr 14 2023, 11:10 AM
llvm/include/llvm/Demangle/Utility.h
67

Ah, no, just check for an off-by-1 error in my suggestion (don't just use it).

nickdesaulniers marked 2 inline comments as done.Apr 14 2023, 11:11 AM
nickdesaulniers added inline comments.
llvm/include/llvm/Demangle/Utility.h
67

LGTM

This revision was landed with ongoing or failed builds.Apr 14 2023, 11:16 AM
This revision was automatically updated to reflect the committed changes.
nickdesaulniers marked an inline comment as done.