diff options
author | Nathan Sidwell <nathan@acm.org> | 2022-01-20 18:40:12 +0300 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2022-01-20 22:47:06 +0300 |
commit | 8105e404f186c6f31e08185b37f81e6da904f6d7 (patch) | |
tree | c198eff51b094f98cee09afd99768b58b6647fc8 /libcxxabi/src/demangle | |
parent | ba8eb31bd9542828f6424e15a3014f80f14522c8 (diff) |
[demangler][NFC] Small cleanups and sync
Some precursor work to adding module demangling.
* some mismatched comment and code in the demangler
* a const fn was not marked thusly
* we use std::islower. A direct range check is smaller code (no function call),
and we know we're in ASCII-land and later in that same function make the same
assumption about upper-case contiguity. Heck, maybe just drop the switch's
precondition and rely on the optimizer to do its thing?
* the directory is cloned in two places, which had gotten out of sync.
Differential Revision: https://reviews.llvm.org/D117800
Diffstat (limited to 'libcxxabi/src/demangle')
-rw-r--r-- | libcxxabi/src/demangle/ItaniumDemangle.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h index 85e1511346c0..b25139d8a72b 100644 --- a/libcxxabi/src/demangle/ItaniumDemangle.h +++ b/libcxxabi/src/demangle/ItaniumDemangle.h @@ -310,7 +310,7 @@ public: printRight(OB); } - // Print the "left" side of this Node into OutputString. + // Print the "left" side of this Node into OutputBuffer. virtual void printLeft(OutputBuffer &) const = 0; // Print the "right". This distinction is necessary to represent C++ types @@ -1210,7 +1210,8 @@ public: class ParameterPack final : public Node { NodeArray Data; - // Setup OutputString for a pack expansion unless we're already expanding one. + // Setup OutputBuffer for a pack expansion, unless we're already expanding + // one. void initializePackExpansion(OutputBuffer &OB) const { if (OB.CurrentPackMax == std::numeric_limits<unsigned>::max()) { OB.CurrentPackMax = static_cast<unsigned>(Data.size()); @@ -2473,7 +2474,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser { char consume() { return First != Last ? *First++ : '\0'; } - char look(unsigned Lookahead = 0) { + char look(unsigned Lookahead = 0) const { if (static_cast<size_t>(Last - First) <= Lookahead) return '\0'; return First[Lookahead]; @@ -5437,7 +5438,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseSubstitution() { if (!consumeIf('S')) return nullptr; - if (std::islower(look())) { + if (look() >= 'a' && look() <= 'z') { Node *SpecialSub; switch (look()) { case 'a': |