PR jit/66539: Add parentheses as needed to gcc_jit_object_get_debug_string
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 16 Jun 2015 18:13:44 +0000 (18:13 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Tue, 16 Jun 2015 18:13:44 +0000 (18:13 +0000)
commitbd93aa1a976dca96267efb36d6d909ff9813a414
tree00d13dc4a930d4f40d356e647478fa1189c80329
parent0dc3cba1bd0a9310fc53325cfa26be9537ea5369
PR jit/66539: Add parentheses as needed to gcc_jit_object_get_debug_string

gcc/jit/ChangeLog:
PR jit/66539
* jit-recording.c: Within namespace gcc::jit::recording::
(rvalue::get_debug_string_parens): New function.
(binary_op::make_debug_string): Update to mimic C precedence
rules.
(binary_op_precedence): New array.
(binary_op::get_precedence): New function.
(comparison::make_debug_string): Update to mimic C precedence
rules.
(comparison_precedence): New array.
(comparison::get_precedence): New function.
(cast::make_debug_string): Update to mimic C precedence rules.
(call::make_debug_string): Likewise.
(call_through_ptr::make_debug_string): Likewise.
(array_access::make_debug_string): Likewise.
(access_field_of_lvalue::make_debug_string): Likewise.
(access_field_rvalue::make_debug_string): Likewise.
(dereference_field_rvalue::make_debug_string): Likewise.
(dereference_rvalue::make_debug_string): Likewise.
(get_address_of_lvalue::make_debug_string): Likewise.
* jit-recording.h: Within namespace gcc::jit::recording::
(precedence): New enum.
(rvalue::rvalue): Initialize field "m_parenthesized_string".
(rvalue::get_debug_string_parens): New method.
(rvalue::get_precedence): New pure virtual function.
(rvalue::m_parenthesized_string): New field.
(param::get_precedence): New function.
(global::get_precedence): New function.
(memento_of_new_rvalue_from_const::get_precedence): New function.
(memento_of_new_string_literal::get_precedence): New function.
(unary_op::get_precedence): New function.
(binary_op::get_precedence): New function.
(comparison::get_precedence): New function.
(cast::get_precedence): New function.
(call::get_precedence): New function.
(call_through_ptr::get_precedence): New function.
(array_access::get_precedence): New function.
(access_field_of_lvalue::get_precedence): New function.
(access_field_rvalue::get_precedence): New function.
(dereference_field_rvalue::get_precedence): New function.
(dereference_rvalue::get_precedence): New function.
(get_address_of_lvalue::get_precedence): New function.
(local::get_precedence): New function.

gcc/testsuite/ChangeLog:
PR jit/66539
* jit.dg/all-non-failing-tests.h: Add test-debug-strings.c.
* jit.dg/test-debug-strings.c: New test case.
* jit.dg/test-quadratic.c (make_calc_discriminant): Verify that
the discriminant has a sane debug string.

From-SVN: r224531
gcc/jit/ChangeLog
gcc/jit/jit-recording.c
gcc/jit/jit-recording.h
gcc/testsuite/ChangeLog
gcc/testsuite/jit.dg/all-non-failing-tests.h
gcc/testsuite/jit.dg/test-debug-strings.c [new file with mode: 0644]
gcc/testsuite/jit.dg/test-quadratic.c