llvm-project/libcxxabi/test
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
..
configs [libc++][tests] Use CMake provided paths for includes and libdir instead of hardcoding them 2022-03-16 12:35:06 -04:00
libcxxabi [libc++abi] Change LIBCXXABI_NO_TIMER to LIBCXXABI_USE_TIMER 2021-10-13 08:02:31 -04:00
native/arm-linux-eabi [libc++] Move handling of the target triple to the DSL 2021-05-08 11:10:53 -04:00
support [libc++abi] Change LIBCXXABI_NO_TIMER to LIBCXXABI_USE_TIMER 2021-10-13 08:02:31 -04:00
vendor [libc++][tests] Use CMake provided paths for includes and libdir instead of hardcoding them 2022-03-16 12:35:06 -04:00
CMakeLists.txt [runtimes] Remove FOO_TARGET_TRIPLE, FOO_SYSROOT and FOO_GCC_TOOLCHAIN 2022-03-01 08:39:42 -05:00
backtrace_test.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_array_01.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_array_02.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_class_01.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_class_02.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_class_03.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_class_04.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_const_pointer_nullptr.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_function_01.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_function_02.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_function_03.pass.cpp [libc++] [test] Eliminate libcpp-no-noexcept-function-type and libcpp-no-structured-bindings. 2021-11-20 11:44:57 -05:00
catch_in_noexcept.pass.cpp [runtimes] Use int main(int, char**) consistently in tests 2020-10-08 14:28:13 -04:00
catch_member_data_pointer_01.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_member_function_pointer_01.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_member_function_pointer_02.pass.cpp [libc++] [test] Eliminate libcpp-no-noexcept-function-type and libcpp-no-structured-bindings. 2021-11-20 11:44:57 -05:00
catch_member_pointer_nullptr.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_multi_level_pointer.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_pointer_nullptr.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_pointer_reference.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_ptr.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_ptr_02.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
catch_reference_nullptr.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cxa_bad_cast.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cxa_bad_typeid.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cxa_thread_atexit_test.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cxa_vec_new_overflow_PR41395.pass.cpp [runtimes] Simplify how we specify XFAIL & friends based on the triple 2021-07-01 14:03:30 -04:00
dynamic_cast.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
dynamic_cast3.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
dynamic_cast5.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
dynamic_cast14.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
dynamic_cast_stress.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
exception_object_alignment.2.pass.cpp [runtimes] Use int main(int, char**) consistently in tests 2020-10-08 14:28:13 -04:00
exception_object_alignment.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
forced_unwind1.pass.cpp [Unwind] Harmonise exception class for EHABI spec. 2021-09-02 11:31:03 +02:00
forced_unwind2.pass.cpp [Unwind] Harmonise exception class for EHABI spec. 2021-09-02 11:31:03 +02:00
forced_unwind3.pass.cpp [libunwind][ARM] Handle end of stack during unwind 2021-11-26 13:26:49 +01:00
guard_test_basic.pass.cpp [libcxxabi] Added convenience classes to cxa_guard 2022-01-12 17:31:36 -05:00
guard_threaded_test.pass.cpp [NFC][libcxxabi] Rename GlobalLock to GlobalMutex 2022-01-12 17:29:17 -05:00
incomplete_type.sh.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
inherited_exception.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
lit.cfg.py [libc++abi] Allow specifying custom Lit config files 2020-06-25 12:15:15 -04:00
lit.site.cfg.in [runtimes] Remove FOO_TARGET_TRIPLE, FOO_SYSROOT and FOO_GCC_TOOLCHAIN 2022-03-01 08:39:42 -05:00
noexception1.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
noexception2.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
noexception3.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
noexception4.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
test_aux_runtime.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
test_aux_runtime_op_array_new.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
test_demangle.pass.cpp [demangler] Add operator precedence 2022-03-28 06:17:57 -07:00
test_exception_address_alignment.pass.cpp [libc++abi] Add a from-scratch testing config for Apple backdeployment 2022-02-14 15:36:50 -05:00
test_exception_storage.pass.cpp [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
test_fallback_malloc.pass.cpp [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
test_guard.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
test_vector1.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
test_vector2.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
test_vector3.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
thread_local_destruction_order.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
uncaught_exception.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
uncaught_exceptions.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
unittest_demangle.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
unwind_01.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
unwind_02.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
unwind_03.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
unwind_04.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
unwind_05.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
unwind_06.pass.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00