[PATCH] D152177: [Demangle] refactor DLangDemangle to use std::string_view
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 5 10:41:46 PDT 2023
efriedma added inline comments.
================
Comment at: llvm/lib/Demangle/DLangDemangle.cpp:242
- while (std::isalpha(*Mangled)) {
+ while (std::isalpha(Mangled.front())) {
// Check for overflow
----------------
`std::isalpha(Mangled.front())` is potentially out-of-bounds?
================
Comment at: llvm/lib/Demangle/DLangDemangle.cpp:378
+void Demangler::parseMangle(OutputBuffer *Demangled,
+ std::string_view &Mangled) {
// A D mangled symbol is comprised of both scope and type information.
----------------
Indentation?
================
Comment at: llvm/lib/Demangle/DLangDemangle.cpp:469
// parent in the form `__Sddd' is added to the symbol.
if (Len >= 4 && Mangled[0] == '_' && Mangled[1] == '_' && Mangled[2] == 'S') {
+ const char *NumPtr = Mangled.substr(3).data();
----------------
`Mangled[0]` is potentially out-of-bounds?
================
Comment at: llvm/lib/Demangle/DLangDemangle.cpp:470
if (Len >= 4 && Mangled[0] == '_' && Mangled[1] == '_' && Mangled[2] == 'S') {
- const char *NumPtr = Mangled + 3;
- while (NumPtr < (Mangled + Len) && std::isdigit(*NumPtr))
+ const char *NumPtr = Mangled.substr(3).data();
+ while (NumPtr < Mangled.substr(Len) && std::isdigit(*NumPtr))
----------------
Maybe convert this char* to a string_view?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152177/new/
https://reviews.llvm.org/D152177
More information about the llvm-commits
mailing list