diff options
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 49b871564d6..cc5c153c12b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6844,8 +6844,6 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, DECL_INITIAL (decl) = NULL_TREE; } - init = do_dependent_capture (init); - /* Generally, initializers in templates are expanded when the template is instantiated. But, if DECL is a variable constant then it can be used in future constant expressions, so its value @@ -7285,12 +7283,13 @@ get_tuple_decomp_init (tree decl, unsigned i) /* It's impossible to recover the decltype of a tuple decomposition variable based on the actual type of the variable, so store it in a hash table. */ -static GTY(()) hash_map<tree,tree> *decomp_type_table; + +static GTY((cache)) tree_cache_map *decomp_type_table; static void store_decomp_type (tree v, tree t) { if (!decomp_type_table) - decomp_type_table = hash_map<tree,tree>::create_ggc (13); + decomp_type_table = tree_cache_map::create_ggc (13); decomp_type_table->put (v, t); } @@ -14903,7 +14902,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) gcc_assert (TYPE_PTR_P (TREE_TYPE (t))); cp_function_chain->x_current_class_ref - = cp_build_indirect_ref (t, RO_NULL, tf_warning_or_error); + = cp_build_fold_indirect_ref (t); /* Set this second to avoid shortcut in cp_build_indirect_ref. */ cp_function_chain->x_current_class_ptr = t; @@ -15251,7 +15250,25 @@ begin_destructor_body (void) if (flag_lifetime_dse /* Clobbering an empty base is harmful if it overlays real data. */ && !is_empty_class (current_class_type)) - finish_decl_cleanup (NULL_TREE, build_clobber_this ()); + { + if (sanitize_flags_p (SANITIZE_VPTR) + && (flag_sanitize_recover & SANITIZE_VPTR) == 0 + && TYPE_CONTAINS_VPTR_P (current_class_type)) + { + tree binfo = TYPE_BINFO (current_class_type); + tree ref + = cp_build_fold_indirect_ref (current_class_ptr); + + tree vtbl_ptr = build_vfield_ref (ref, TREE_TYPE (binfo)); + tree vtbl = build_zero_cst (TREE_TYPE (vtbl_ptr)); + tree stmt = cp_build_modify_expr (input_location, vtbl_ptr, + NOP_EXPR, vtbl, + tf_warning_or_error); + finish_decl_cleanup (NULL_TREE, stmt); + } + else + finish_decl_cleanup (NULL_TREE, build_clobber_this ()); + } /* And insert cleanups for our bases and members so that they will be properly destroyed if we throw. */ |