Towards converting our use of llvm::StringView to std::string_view,
remove a method that std::string_view doesn't have.
llvm::StringView::dropFront is semantically similar to
std::string_view::substr but with the input clamped to the size. No code
was relying on clamping other than the rust demangler, which I fixed in
https://reviews.llvm.org/D148272. Removing this method makes it easier
to switch over code later.
Details
- Reviewers
MaskRay erichkeane - Commits
- rGf198e0b594aa: [StringView] remove dropFront
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/Demangle/ItaniumDemangle.h | ||
---|---|---|
1587 | anywhere we assign the result back to the string view object we should probably use StringView::remove_prefix instead. |
llvm/include/llvm/Demangle/ItaniumDemangle.h | ||
---|---|---|
1587 | Nevermind; there is no StringView::remove_prefix. These can be changed to std::string_view::remove_prefix after conversion. |
So I think most of your asserts are actually unnecessary. I only made it about 1/2 way down, but dont see any that are obviously necessary.
llvm/include/llvm/Demangle/ItaniumDemangle.h | ||
---|---|---|
1841 | I think this assert is actually ALSO unnecessary, we already know that we're not in Offset.empty, line 1837 (and even if we weren't, line 1839 would probably be UB?). | |
2634 | See above assert that checks startsWith, so also probably unnecessary. | |
3708 | This assert is also redundant. | |
llvm/lib/Demangle/MicrosoftDemangle.cpp | ||
172 | index of zero above these makes this assert 'too late', since it would already be UB. | |
489 | startswith above this. |
llvm/include/llvm/Demangle/StringView.h | ||
---|---|---|
66–70 | needs a rebase on 3ece37b3fa2c14157ad02967b867570c6a0c08e8 |
llvm/include/llvm/Demangle/ItaniumDemangle.h | ||
---|---|---|
1587 | ah @MaskRay added that in 3ece37b3fa2c14157ad02967b867570c6a0c08e8 |
- rebase on 3ece37b3fa2c14157ad02967b867570c6a0c08e8, use more StringView::remove_prefix
The second assert is made redundant by assert(SV.startsWith("basic_"));