llvm-project/libcxxabi
Nathan Sidwell b3b4113a23 [demangler] Add operator precedence
The demangler had no concept of operator precendence, and would
parenthesize many more subexpressions than necessary.  In particular
it would parenthesize primary-expressions, such as '4', which just
looks strange.  It would also parenthesize '>' expressions, just in
case they were inside a template parameter list.

This patch fixes both issues.

* Add operator precedence to the OpInfo structure, and add a
  subexpression helper that will parenthesize a lower precedence
  subexpression.

* Add a 'greater-than is greater-than' indicator to the output buffer,
  so the expression printer knows whether it is immediately inside a
  template parameter list (and must therefore parenthesize 'expr >
  expr').  This is a counter, so that ...

* Add open and close printers to the output buffer, that increment and
  decrement the gt-is-gt indicator.

* Parenthesize comma operators inside comma-separated lists. (probably
  a rare case, but still).

This dramatically reduces the extraneous parentheses being printed.

Reviewed By: dblaikie, bruno

Differential Revision: https://reviews.llvm.org/D120905
2022-03-28 06:17:57 -07:00
..
cmake [libc++] Disable coverage with sanitize-coverage=0 2022-01-07 17:53:21 -08:00
fuzz
include [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -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] Add operator precedence 2022-03-28 06:17:57 -07:00
test [demangler] Add operator precedence 2022-03-28 06:17:57 -07:00
www [runtimes] Remove support for standalone builds 2022-02-09 08:55:31 -05:00
.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 [libcxxabi] Fix cmake order dependency wrt dllexporting 2022-03-07 15:36:04 -05: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