llvm-project/libcxxabi
Nathan Sidwell 6184e565ad [demangler][NFC] Refactor some parsing
There's some unnecessary code duplication in the parser.  This
refactors that and deploys boolean variables to avoid the duplication.
These also happen to help adding module demangling (with an updated
mangling scheme).

1a) The grammar requires some lookahead concerning <template-args>. We
may discover an <unscoped-name> is actually <unscoped-template-name>
<template-args>.  (When <unscoped-name> was a substitution, there must
be a following <template-args>.)  Refactor parseName to only have one
code path looking for the 'I' indicating <template-args>.

1b) While there I altered the control flow to hold the result in a
variable, rather than tail call.  Made it easier to debug (and of
course an optimizer will DTRT here anyway).

2a) An <unscoped-name> can have an St or StL prefix.  No need for
completely separate code paths handling the following unqualified-name
though.

2b) Also no need to look for both 'St' and 'StL' separately.  Look for
'St' and then conditionally swallow an 'L'.

3) We get a similar issue as #1a when parsing a typeName.  Here I just
change the control flow slightly to bring the 'break' out to the end
of the 'S' block and embed the early return inside an if.  That's more
in keeping with the code style.

4) Although NFC, there's a new testcase as that's not covered by the
existing demangler tests and is significant in the #1a case above.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D117879
2022-01-24 05:28:38 -08:00
..
cmake [libc++] Disable coverage with sanitize-coverage=0 2022-01-07 17:53:21 -08:00
fuzz
include [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
lib [libc++/abi] Revert "[libc++] Move the weak symbols list to libc++abi" 2020-10-05 11:42:13 -04:00
src [demangler][NFC] Refactor some parsing 2022-01-24 05:28:38 -08:00
test [demangler][NFC] Refactor some parsing 2022-01-24 05:28:38 -08:00
www [Branch-Rename] Fix some links 2021-02-01 16:43:21 +05:30
.clang-format [NFC][libcxxabi] Run clang-format on libcxxabi/src/cxa_guard_impl.h 2021-08-18 19:09:16 -04:00
.gitignore
CMakeLists.txt [cmake] Make include(GNUInstallDirs) always below project(..) 2022-01-20 18:59:17 +00:00
CREDITS.TXT
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00