diff options
author | David Malcolm <dmalcolm@redhat.com> | 2025-08-12 21:46:41 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2025-08-12 21:46:41 -0400 |
commit | d6d1fa0039e68e52c3d787d90b545842cbb24d32 (patch) | |
tree | ddfa1d40feecbc307c49d7772e0b60fb8e20c083 | |
parent | 9e30860f8c77309c9f74742fe8866d2ca0d0fe7a (diff) | |
download | gcc-d6d1fa0039e68e52c3d787d90b545842cbb24d32.zip gcc-d6d1fa0039e68e52c3d787d90b545842cbb24d32.tar.gz gcc-d6d1fa0039e68e52c3d787d90b545842cbb24d32.tar.bz2 |
jit: don't use &vect[0] in libgccjit++.h [PR121516]
gcc/jit/ChangeLog:
PR jit/121516
* libgccjit++.h (context::new_struct_type): Replace use of
&fields[0] with fields.data ().
(context::new_function): Likewise for params.
(context::new_rvalue): Likewise for elements.
(context::new_call): Likewise for args.
(block::end_with_switch): Likewise for cases.
(block::end_with_extended_asm_goto): Likewise for goto_blocks.
(context::new_struct_ctor): Likewise for fields and values.
(context::new_array_ctor): Likewise for values.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
-rw-r--r-- | gcc/jit/libgccjit++.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/jit/libgccjit++.h b/gcc/jit/libgccjit++.h index 7ecd915..608c49d 100644 --- a/gcc/jit/libgccjit++.h +++ b/gcc/jit/libgccjit++.h @@ -841,7 +841,7 @@ context::new_struct_type (const std::string &name, location loc) { /* Treat std::vector as an array, relying on it not being resized: */ - field *as_array_of_wrappers = &fields[0]; + field *as_array_of_wrappers = fields.data (); /* Treat the array as being of the underlying pointers, relying on the wrapper type being such a pointer internally. */ @@ -885,7 +885,7 @@ context::new_function (enum gcc_jit_function_kind kind, location loc) { /* Treat std::vector as an array, relying on it not being resized: */ - param *as_array_of_wrappers = ¶ms[0]; + param *as_array_of_wrappers = params.data (); /* Treat the array as being of the underlying pointers, relying on the wrapper type being such a pointer internally. */ @@ -988,7 +988,7 @@ context::new_rvalue (type vector_type, std::vector<rvalue> elements) const { /* Treat std::vector as an array, relying on it not being resized: */ - rvalue *as_array_of_wrappers = &elements[0]; + rvalue *as_array_of_wrappers = elements.data (); /* Treat the array as being of the underlying pointers, relying on the wrapper type being such a pointer internally. */ @@ -1194,7 +1194,7 @@ context::new_call (function func, location loc) { /* Treat std::vector as an array, relying on it not being resized: */ - rvalue *as_array_of_wrappers = &args[0]; + rvalue *as_array_of_wrappers = args.data (); /* Treat the array as being of the underlying pointers, relying on the wrapper type being such a pointer internally. */ @@ -1615,7 +1615,7 @@ block::end_with_switch (rvalue expr, location loc) { /* Treat std::vector as an array, relying on it not being resized: */ - case_ *as_array_of_wrappers = &cases[0]; + case_ *as_array_of_wrappers = cases.data (); /* Treat the array as being of the underlying pointers, relying on the wrapper type being such a pointer internally. */ @@ -1645,7 +1645,7 @@ block::end_with_extended_asm_goto (const std::string &asm_template, location loc) { /* Treat std::vector as an array, relying on it not being resized: */ - block *as_array_of_wrappers = &goto_blocks[0]; + block *as_array_of_wrappers = goto_blocks.data (); /* Treat the array as being of the underlying pointers, relying on the wrapper type being such a pointer internally. */ @@ -1869,14 +1869,14 @@ context::new_struct_ctor (type type_, { field *pfields = nullptr; if (fields.size ()) - pfields = &fields[0]; + pfields = fields.data (); gcc_jit_field **fields_arr = reinterpret_cast<gcc_jit_field **> (pfields); rvalue *pvalues = nullptr; if (values.size ()) - pvalues = &values[0]; + pvalues = values.data (); gcc_jit_rvalue **values_arr = reinterpret_cast<gcc_jit_rvalue **> (pvalues); @@ -1898,7 +1898,7 @@ context::new_array_ctor (type type_, { rvalue *pvalues = nullptr; if (values.size ()) - pvalues = &values[0]; + pvalues = values.data (); gcc_jit_rvalue **values_arr = reinterpret_cast<gcc_jit_rvalue **> (pvalues); |