From b119c05542a9574a1c27f9bba63efbafc12b248b Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 3 May 2019 14:37:22 +0200 Subject: Come up with is_empty for hash_{table,map,set}. 2019-05-03 Martin Liska * hash-map.h: Add is_empty function. * hash-set.h: Likewise. * hash-table.h: Likewise. * dwarf2out.c (dwarf2out_finish): Use is_empty instead of elements () == 0 (and similar usages). * gimple-ssa-store-merging.c (pass_store_merging::terminate_and_process_all_chains): Likewise. * gimplify.c (gimplify_bind_expr): Likewise. (gimplify_switch_expr): Likewise. * hash-map-tests.c (test_map_of_strings_to_int): Likewise. * ipa-icf.c (sem_item_optimizer::remove_symtab_node): Likewise. * postreload-gcse.c (dump_hash_table): Likewise. (gcse_after_reload_main): Likewise. * predict.c (combine_predictions_for_bb): Likewise. * tree-parloops.c (reduction_phi): Likewise. (separate_decls_in_region): Likewise. (transform_to_exit_first_loop): Likewise. (gen_parallel_loop): Likewise. (gather_scalar_reductions): Likewise. (try_create_reduction_list): Likewise. * var-tracking.c (dump_vars): Likewise. (emit_notes_for_changes): Likewise. (vt_emit_notes): Likewise. 2019-05-03 Martin Liska * call.c (build_aggr_conv): Use is_empty instead of elements () == 0 (and similar usages). * parser.c (cp_parser_lambda_introducer): Likewise. From-SVN: r270851 --- gcc/hash-table.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/hash-table.h') diff --git a/gcc/hash-table.h b/gcc/hash-table.h index 7ba6356..4178616 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -402,6 +402,9 @@ public: /* This function clears all entries in this hash table. */ void empty () { if (elements ()) empty_slow (); } + /* Return true when there are no elements in this hash table. */ + bool is_empty () const { return elements () == 0; } + /* This function clears a specified SLOT in a hash table. It is useful when you've already done the lookup and don't want to do it again. */ -- cgit v1.1