diff options
author | David Malcolm <dmalcolm@redhat.com> | 2020-11-12 17:27:28 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-11-12 17:27:28 -0500 |
commit | fec573408310139e1ffc42741fbe46b4f2947592 (patch) | |
tree | ce6484550e5cb83a3abdf83e8a9817a5231d047d /gcc/tree-vrp.c | |
parent | 8948a5715b00fe36d20c03b6c4c4397b74cc6282 (diff) | |
download | gcc-fec573408310139e1ffc42741fbe46b4f2947592.zip gcc-fec573408310139e1ffc42741fbe46b4f2947592.tar.gz gcc-fec573408310139e1ffc42741fbe46b4f2947592.tar.bz2 |
jit: fix string escaping
This patch fixes a bug in recording::string::make_debug_string in which
'\t' and '\n' were "escaped" by simply prepending a '\', thus emitting
'\' then '\n', rather than '\' then 'n'. It also removes a hack that
determined if a string is to be escaped by checking for a leading '"',
by instead adding a flag.
gcc/jit/ChangeLog:
* jit-recording.c (recording::context::new_string): Add "escaped"
param and use it when creating the new recording::string instance.
(recording::string::string): Add "escaped" param and use it to
initialize m_escaped.
(recording::string::make_debug_string): Replace check that first
char is double-quote with use of m_escaped. Fix escaping of
'\t' and '\n'. Set "escaped" on the result.
* jit-recording.h (recording::context::new_string): Add "escaped"
param.
(recording::string::string): Add "escaped" param.
(recording::string::m_escaped): New field.
gcc/testsuite/ChangeLog:
* jit.dg/test-debug-strings.c (create_code): Add tests of
string literal escaping.
Diffstat (limited to 'gcc/tree-vrp.c')
0 files changed, 0 insertions, 0 deletions