diff --git a/llvm/include/llvm/Demangle/Utility.h b/llvm/include/llvm/Demangle/Utility.h --- a/llvm/include/llvm/Demangle/Utility.h +++ b/llvm/include/llvm/Demangle/Utility.h @@ -108,7 +108,7 @@ OutputBuffer &operator+=(std::string_view R) { if (size_t Size = R.size()) { grow(Size); - std::memcpy(Buffer + CurrentPosition, R.begin(), Size); + std::memcpy(Buffer + CurrentPosition, &R.front(), Size); CurrentPosition += Size; } return *this; @@ -125,7 +125,7 @@ grow(Size); std::memmove(Buffer + Size, Buffer, CurrentPosition); - std::memcpy(Buffer, R.begin(), Size); + std::memcpy(Buffer, &R.front(), Size); CurrentPosition += Size; return *this; diff --git a/llvm/lib/Demangle/ItaniumDemangle.cpp b/llvm/lib/Demangle/ItaniumDemangle.cpp --- a/llvm/lib/Demangle/ItaniumDemangle.cpp +++ b/llvm/lib/Demangle/ItaniumDemangle.cpp @@ -79,7 +79,7 @@ void printStr(const char *S) { fprintf(stderr, "%s", S); } void print(std::string_view SV) { - fprintf(stderr, "\"%.*s\"", (int)SV.size(), SV.begin()); + fprintf(stderr, "\"%.*s\"", (int)SV.size(), &SV.front()); } void print(const Node *N) { if (N) diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp --- a/llvm/lib/Demangle/MicrosoftDemangle.cpp +++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp @@ -267,7 +267,7 @@ // This is not a micro-optimization, it avoids UB, should Borrowed be an null // buffer. if (Borrowed.size()) - std::memcpy(Stable, Borrowed.begin(), Borrowed.size()); + std::memcpy(Stable, &Borrowed.front(), Borrowed.size()); return {Stable, Borrowed.size()}; } @@ -791,7 +791,7 @@ Error = true; return nullptr; } - const char *Start = MangledName.begin(); + const char *Start = &MangledName.front(); MangledName.remove_prefix(MD5Last + 1); // There are two additional special cases for MD5 names: @@ -2377,7 +2377,7 @@ T->output(OB, OF_Default); std::string_view B = OB; - std::printf(" [%d] - %.*s\n", (int)I, (int)B.size(), B.begin()); + std::printf(" [%d] - %.*s\n", (int)I, (int)B.size(), &B.front()); } std::free(OB.getBuffer()); @@ -2386,7 +2386,7 @@ std::printf("%d name backreferences\n", (int)Backrefs.NamesCount); for (size_t I = 0; I < Backrefs.NamesCount; ++I) { std::printf(" [%d] - %.*s\n", (int)I, (int)Backrefs.Names[I]->Name.size(), - Backrefs.Names[I]->Name.begin()); + &Backrefs.Names[I]->Name.front()); } if (Backrefs.NamesCount > 0) std::printf("\n"); @@ -2400,7 +2400,7 @@ std::string_view Name{MangledName}; SymbolNode *AST = D.parse(Name); if (!D.Error && NMangled) - *NMangled = Name.begin() - MangledName; + *NMangled = Name.begin() - &*MangledName; if (Flags & MSDF_DumpBackrefs) D.dumpBackReferences();