[PATCH] D148348: [StringView] remove dropFront
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 14 09:39:36 PDT 2023
MaskRay added inline comments.
================
Comment at: llvm/include/llvm/Demangle/ItaniumDemangle.h:1586
assert(SV.startsWith("basic_"));
- SV = SV.dropFront(sizeof("basic_") - 1);
+ assert(sizeof("basic_") - 1 <= SV.size());
+ SV = SV.substr(sizeof("basic_") - 1);
----------------
The second assert is made redundant by `assert(SV.startsWith("basic_"));`
================
Comment at: llvm/include/llvm/Demangle/ItaniumDemangle.h:2269
+ if (Integer[0] == 'n') {
+ assert(1 <= Integer.size());
+ OB << "-" << Integer.substr(1);
----------------
The assert is unnecessary. `Integer[0]` expresses the intention.
================
Comment at: llvm/include/llvm/Demangle/ItaniumDemangle.h:2295
OB += '-';
- OB += Value.dropFront(1);
+ assert(1 <= Value.size());
+ OB += Value.substr(1);
----------------
The assert is unnecessary. Value[0] expresses the intention.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148348/new/
https://reviews.llvm.org/D148348
More information about the llvm-commits
mailing list