On Thu, Jan 08, 2015 at 03:57:17PM -0500, Jason Merrill wrote: > I noticed that we were repeating the same long test in lots of places and > factored it out into a separate function. I'm not attached to the name. > > Tested x86_64-pc-linux-gnu, OK for trunk?
As the predicate is very simple, wouldn't it be better to make it inline function in ubsan.h? I don't feel too strongly about it, so ok either way. > commit 5a5f850a4d40a25cc3b1fc0120e844b1ac3f3eb0 > Author: Jason Merrill <ja...@redhat.com> > Date: Wed Jan 7 17:29:36 2015 -0500 > > gcc/ > * ubsan.c (do_ubsan_in_current_function): New. > (pass_ubsan::gate): Use it. > * ubsan.h: Declare it. > * convert.c (convert_to_integer): Use it. > gcc/c-family/ > * c-ubsan.c (ubsan_maybe_instrument_array_ref): Use > do_ubsan_in_current_function. > (ubsan_maybe_instrument_reference_or_call): Likewise. > * c-ubsan.h: Declare it. > gcc/cp/ > * cp-gimplify.c (cp_genericize): Use do_ubsan_in_current_function. > * decl.c (compute_array_index_type): Likewise. > * init.c (build_vec_init): Likewise. > * typeck.c (cp_build_binary_op): Likewise. Jakub