[Demangle] replace std::string_view::substr which may throw
authorNick Desaulniers <ndesaulniers@google.com>
Fri, 21 Apr 2023 22:51:29 +0000 (15:51 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Fri, 21 Apr 2023 22:56:55 +0000 (15:56 -0700)
commit3a30cf212d12cc5013ec67e54530b69ee2cfc7c9
treea9541da2318a572a7a4f531cc6e0b942df516122
parentc2709fcb0a5b32e42a35661fab4d5744e11d04c0
[Demangle] replace std::string_view::substr which may throw

llvm/Demangle copies the implementation from libcxxabi/src/demangle/.
libcxxabi/ cannot use potentially-throwing std::string_view::substr, so
change llvm/Demangle to avoid these function calls.

I ran into linkage failures stemming from the usage of
std::string_view::substr. substr does a bounds check and may throw.

Fixes: f198e0b594aa ("[StringView] remove dropFront")

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D148959
llvm/include/llvm/Demangle/ItaniumDemangle.h