summaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-18 02:54:30 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-18 02:54:30 +0000
commitf1f41a6cdc47d5123dd30ab110cc35c90f8189cb (patch)
tree1b9f930d315fa3e0a5ed7fa6e27ec5bd0a3436a4 /gcc/cp/call.c
parent85ed3b5a235c79e565d04354e67c979abdc66057 (diff)
downloadgcc-f1f41a6cdc47d5123dd30ab110cc35c90f8189cb.tar.gz
This patch rewrites the old VEC macro-based interface into a new one
based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193595 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c218
1 files changed, 107 insertions, 111 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 77bd28882d6..35a3f919997 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -169,14 +169,14 @@ static tree build_this (tree);
static struct z_candidate *splice_viable (struct z_candidate *, bool, bool *);
static bool any_strictly_viable (struct z_candidate *);
static struct z_candidate *add_template_candidate
- (struct z_candidate **, tree, tree, tree, tree, const VEC(tree,gc) *,
+ (struct z_candidate **, tree, tree, tree, tree, const vec<tree, va_gc> *,
tree, tree, tree, int, unification_kind_t, tsubst_flags_t);
static struct z_candidate *add_template_candidate_real
- (struct z_candidate **, tree, tree, tree, tree, const VEC(tree,gc) *,
+ (struct z_candidate **, tree, tree, tree, tree, const vec<tree, va_gc> *,
tree, tree, tree, int, tree, unification_kind_t, tsubst_flags_t);
static struct z_candidate *add_template_conv_candidate
- (struct z_candidate **, tree, tree, tree, const VEC(tree,gc) *, tree,
- tree, tree, tsubst_flags_t);
+ (struct z_candidate **, tree, tree, tree, const vec<tree, va_gc> *,
+ tree, tree, tree, tsubst_flags_t);
static void add_builtin_candidates
(struct z_candidate **, enum tree_code, enum tree_code,
tree, tree *, int, tsubst_flags_t);
@@ -188,10 +188,10 @@ static void build_builtin_candidate
(struct z_candidate **, tree, tree, tree, tree *, tree *,
int, tsubst_flags_t);
static struct z_candidate *add_conv_candidate
- (struct z_candidate **, tree, tree, tree, const VEC(tree,gc) *, tree,
+ (struct z_candidate **, tree, tree, tree, const vec<tree, va_gc> *, tree,
tree, tsubst_flags_t);
static struct z_candidate *add_function_candidate
- (struct z_candidate **, tree, tree, tree, const VEC(tree,gc) *, tree,
+ (struct z_candidate **, tree, tree, tree, const vec<tree, va_gc> *, tree,
tree, int, tsubst_flags_t);
static conversion *implicit_conversion (tree, tree, tree, bool, int,
tsubst_flags_t);
@@ -205,7 +205,7 @@ static bool is_subseq (conversion *, conversion *);
static conversion *maybe_handle_ref_bind (conversion **);
static void maybe_handle_implicit_object (conversion **);
static struct z_candidate *add_candidate
- (struct z_candidate **, tree, tree, const VEC(tree,gc) *, size_t,
+ (struct z_candidate **, tree, tree, const vec<tree, va_gc> *, size_t,
conversion **, tree, tree, int, struct rejection_reason *);
static tree source_type (conversion *);
static void add_warning (struct z_candidate *, struct z_candidate *);
@@ -215,8 +215,8 @@ static bool promoted_arithmetic_type_p (tree);
static conversion *conditional_conversion (tree, tree, tsubst_flags_t);
static char *name_as_c_string (tree, tree, bool *);
static tree prep_operand (tree);
-static void add_candidates (tree, tree, const VEC(tree,gc) *, tree, tree, bool,
- tree, tree, int, struct z_candidate **,
+static void add_candidates (tree, tree, const vec<tree, va_gc> *, tree, tree,
+ bool, tree, tree, int, struct z_candidate **,
tsubst_flags_t);
static conversion *merge_conversion_sequences (conversion *, conversion *);
static bool magic_varargs_p (tree);
@@ -511,7 +511,7 @@ struct z_candidate {
/* The rest of the arguments to use when calling this function. If
there are no further arguments this may be NULL or it may be an
empty vector. */
- const VEC(tree,gc) *args;
+ const vec<tree, va_gc> *args;
/* The implicit conversion sequences for each of the arguments to
FN. */
conversion **convs;
@@ -1772,7 +1772,7 @@ implicit_conversion (tree to, tree from, tree expr, bool c_cast_p,
static struct z_candidate *
add_candidate (struct z_candidate **candidates,
- tree fn, tree first_arg, const VEC(tree,gc) *args,
+ tree fn, tree first_arg, const vec<tree, va_gc> *args,
size_t num_convs, conversion **convs,
tree access_path, tree conversion_path,
int viable, struct rejection_reason *reason)
@@ -1822,7 +1822,7 @@ remaining_arguments (tree arg)
static struct z_candidate *
add_function_candidate (struct z_candidate **candidates,
tree fn, tree ctype, tree first_arg,
- const VEC(tree,gc) *args, tree access_path,
+ const vec<tree, va_gc> *args, tree access_path,
tree conversion_path, int flags,
tsubst_flags_t complain)
{
@@ -1855,7 +1855,7 @@ add_function_candidate (struct z_candidate **candidates,
else
skip = 0;
- len = VEC_length (tree, args) - skip + (first_arg != NULL_TREE ? 1 : 0);
+ len = vec_safe_length (args) - skip + (first_arg != NULL_TREE ? 1 : 0);
convs = alloc_conversions (len);
/* 13.3.2 - Viable functions [over.match.viable]
@@ -1927,8 +1927,7 @@ add_function_candidate (struct z_candidate **candidates,
arg = first_arg;
else
arg = CONST_CAST_TREE (
- VEC_index (tree, args,
- i + skip - (first_arg != NULL_TREE ? 1 : 0)));
+ (*args)[i + skip - (first_arg != NULL_TREE ? 1 : 0)]);
argtype = lvalue_type (arg);
is_this = (i == 0 && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
@@ -2032,7 +2031,7 @@ add_function_candidate (struct z_candidate **candidates,
static struct z_candidate *
add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
- tree first_arg, const VEC(tree,gc) *arglist,
+ tree first_arg, const vec<tree, va_gc> *arglist,
tree access_path, tree conversion_path,
tsubst_flags_t complain)
{
@@ -2046,7 +2045,7 @@ add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
parmlist = TREE_TYPE (parmlist);
parmlist = TYPE_ARG_TYPES (parmlist);
- len = VEC_length (tree, arglist) + (first_arg != NULL_TREE ? 1 : 0) + 1;
+ len = vec_safe_length (arglist) + (first_arg != NULL_TREE ? 1 : 0) + 1;
convs = alloc_conversions (len);
parmnode = parmlist;
viable = 1;
@@ -2067,8 +2066,7 @@ add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
else if (i == 1 && first_arg != NULL_TREE)
arg = first_arg;
else
- arg = VEC_index (tree, arglist,
- i - (first_arg != NULL_TREE ? 1 : 0) - 1);
+ arg = (*arglist)[i - (first_arg != NULL_TREE ? 1 : 0) - 1];
argtype = lvalue_type (arg);
if (i == 0)
@@ -2676,7 +2674,7 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
tree type, argtypes[3], t;
/* TYPES[i] is the set of possible builtin-operator parameter types
we will consider for the Ith argument. */
- VEC(tree,gc) *types[2];
+ vec<tree, va_gc> *types[2];
unsigned ix;
for (i = 0; i < 3; ++i)
@@ -2758,11 +2756,9 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
if (code == COND_EXPR)
{
if (real_lvalue_p (args[i]))
- VEC_safe_push (tree, gc, types[i],
- build_reference_type (argtypes[i]));
+ vec_safe_push (types[i], build_reference_type (argtypes[i]));
- VEC_safe_push (tree, gc, types[i],
- TYPE_MAIN_VARIANT (argtypes[i]));
+ vec_safe_push (types[i], TYPE_MAIN_VARIANT (argtypes[i]));
}
else if (! convs)
@@ -2778,49 +2774,48 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
continue;
if (code == COND_EXPR && TREE_CODE (type) == REFERENCE_TYPE)
- VEC_safe_push (tree, gc, types[i], type);
+ vec_safe_push (types[i], type);
type = non_reference (type);
if (i != 0 || ! ref1)
{
type = cv_unqualified (type_decays_to (type));
if (enum_p && TREE_CODE (type) == ENUMERAL_TYPE)
- VEC_safe_push (tree, gc, types[i], type);
+ vec_safe_push (types[i], type);
if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
type = type_promotes_to (type);
}
if (! vec_member (type, types[i]))
- VEC_safe_push (tree, gc, types[i], type);
+ vec_safe_push (types[i], type);
}
}
else
{
if (code == COND_EXPR && real_lvalue_p (args[i]))
- VEC_safe_push (tree, gc, types[i],
- build_reference_type (argtypes[i]));
+ vec_safe_push (types[i], build_reference_type (argtypes[i]));
type = non_reference (argtypes[i]);
if (i != 0 || ! ref1)
{
type = cv_unqualified (type_decays_to (type));
if (enum_p && UNSCOPED_ENUM_P (type))
- VEC_safe_push (tree, gc, types[i], type);
+ vec_safe_push (types[i], type);
if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
type = type_promotes_to (type);
}
- VEC_safe_push (tree, gc, types[i], type);
+ vec_safe_push (types[i], type);
}
}
/* Run through the possible parameter types of both arguments,
creating candidates with those parameter types. */
- FOR_EACH_VEC_ELT_REVERSE (tree, types[0], ix, t)
+ FOR_EACH_VEC_ELT_REVERSE (*(types[0]), ix, t)
{
unsigned jx;
tree u;
- if (!VEC_empty (tree, types[1]))
- FOR_EACH_VEC_ELT_REVERSE (tree, types[1], jx, u)
+ if (!types[1]->is_empty ())
+ FOR_EACH_VEC_ELT_REVERSE (*(types[1]), jx, u)
add_builtin_candidate
(candidates, code, code2, fnname, t,
u, args, argtypes, flags, complain);
@@ -2848,14 +2843,14 @@ add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
static struct z_candidate*
add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
tree ctype, tree explicit_targs, tree first_arg,
- const VEC(tree,gc) *arglist, tree return_type,
+ const vec<tree, va_gc> *arglist, tree return_type,
tree access_path, tree conversion_path,
int flags, tree obj, unification_kind_t strict,
tsubst_flags_t complain)
{
int ntparms = DECL_NTPARMS (tmpl);
tree targs = make_tree_vec (ntparms);
- unsigned int len = VEC_length (tree, arglist);
+ unsigned int len = vec_safe_length (arglist);
unsigned int nargs = (first_arg == NULL_TREE ? 0 : 1) + len;
unsigned int skip_without_in_chrg = 0;
tree first_arg_without_in_chrg = first_arg;
@@ -2901,7 +2896,7 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
++ia;
}
for (ix = skip_without_in_chrg;
- VEC_iterate (tree, arglist, ix, arg);
+ vec_safe_iterate (arglist, ix, &arg);
++ix)
{
args_without_in_chrg[ia] = arg;
@@ -3002,7 +2997,7 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
static struct z_candidate *
add_template_candidate (struct z_candidate **candidates, tree tmpl, tree ctype,
tree explicit_targs, tree first_arg,
- const VEC(tree,gc) *arglist, tree return_type,
+ const vec<tree, va_gc> *arglist, tree return_type,
tree access_path, tree conversion_path, int flags,
unification_kind_t strict, tsubst_flags_t complain)
{
@@ -3017,7 +3012,7 @@ add_template_candidate (struct z_candidate **candidates, tree tmpl, tree ctype,
static struct z_candidate *
add_template_conv_candidate (struct z_candidate **candidates, tree tmpl,
tree obj, tree first_arg,
- const VEC(tree,gc) *arglist,
+ const vec<tree, va_gc> *arglist,
tree return_type, tree access_path,
tree conversion_path, tsubst_flags_t complain)
{
@@ -3336,7 +3331,7 @@ merge_conversion_sequences (conversion *user_seq, conversion *std_seq)
non-list constructor.
Parameters are as for add_candidates, except that the arguments are in
- the form of a CONSTRUCTOR (the initializer list) rather than a VEC, and
+ the form of a CONSTRUCTOR (the initializer list) rather than a vector, and
the RETURN_TYPE parameter is replaced by TOTYPE, the desired type. */
static void
@@ -3348,7 +3343,7 @@ add_list_candidates (tree fns, tree first_arg,
struct z_candidate **candidates,
tsubst_flags_t complain)
{
- VEC(tree,gc) *args;
+ vec<tree, va_gc> *args;
gcc_assert (*candidates == NULL);
@@ -3403,7 +3398,7 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags,
tree conv_fns = NULL_TREE;
conversion *conv = NULL;
tree first_arg = NULL_TREE;
- VEC(tree,gc) *args = NULL;
+ vec<tree, va_gc> *args = NULL;
bool any_viable_p;
int convflags;
@@ -3734,13 +3729,13 @@ build_integral_nontype_arg_conv (tree type, tree expr, tsubst_flags_t complain)
/* Do any initial processing on the arguments to a function call. */
-static VEC(tree,gc) *
-resolve_args (VEC(tree,gc) *args, tsubst_flags_t complain)
+static vec<tree, va_gc> *
+resolve_args (vec<tree, va_gc> *args, tsubst_flags_t complain)
{
unsigned int ix;
tree arg;
- FOR_EACH_VEC_ELT (tree, args, ix, arg)
+ FOR_EACH_VEC_SAFE_ELT (args, ix, arg)
{
if (error_operand_p (arg))
return NULL;
@@ -3770,7 +3765,7 @@ resolve_args (VEC(tree,gc) *args, tsubst_flags_t complain)
static struct z_candidate *
perform_overload_resolution (tree fn,
- const VEC(tree,gc) *args,
+ const vec<tree, va_gc> *args,
struct z_candidate **candidates,
bool *any_viable_p, tsubst_flags_t complain)
{
@@ -3823,7 +3818,7 @@ perform_overload_resolution (tree fn,
functions. */
static void
-print_error_for_call_failure (tree fn, VEC(tree,gc) *args, bool any_viable_p,
+print_error_for_call_failure (tree fn, vec<tree, va_gc> *args, bool any_viable_p,
struct z_candidate *candidates)
{
tree name = DECL_NAME (OVL_CURRENT (fn));
@@ -3844,7 +3839,7 @@ print_error_for_call_failure (tree fn, VEC(tree,gc) *args, bool any_viable_p,
ARGS. */
tree
-build_new_function_call (tree fn, VEC(tree,gc) **args, bool koenig_p,
+build_new_function_call (tree fn, vec<tree, va_gc> **args, bool koenig_p,
tsubst_flags_t complain)
{
struct z_candidate *candidates, *cand;
@@ -3929,7 +3924,7 @@ build_new_function_call (tree fn, VEC(tree,gc) **args, bool koenig_p,
function called. */
tree
-build_operator_new_call (tree fnname, VEC(tree,gc) **args,
+build_operator_new_call (tree fnname, vec<tree, va_gc> **args,
tree *size, tree *cookie_size, tree size_check,
tree *fn, tsubst_flags_t complain)
{
@@ -3945,7 +3940,7 @@ build_operator_new_call (tree fnname, VEC(tree,gc) **args,
if (size_check != NULL_TREE)
*size = fold_build3 (COND_EXPR, sizetype, size_check,
original_size, TYPE_MAX_VALUE (sizetype));
- VEC_safe_insert (tree, gc, *args, 0, *size);
+ vec_safe_insert (*args, 0, *size);
*args = resolve_args (*args, complain);
if (*args == NULL)
return error_mark_node;
@@ -3985,9 +3980,8 @@ build_operator_new_call (tree fnname, VEC(tree,gc) **args,
/* In G++ 3.2, the check was implemented incorrectly; it
looked at the placement expression, rather than the
type of the function. */
- if (VEC_length (tree, *args) == 2
- && same_type_p (TREE_TYPE (VEC_index (tree, *args, 1)),
- ptr_type_node))
+ if ((*args)->length () == 2
+ && same_type_p (TREE_TYPE ((**args)[1]), ptr_type_node))
use_cookie = false;
}
else
@@ -4014,7 +4008,7 @@ build_operator_new_call (tree fnname, VEC(tree,gc) **args,
*size = fold_build3 (COND_EXPR, sizetype, size_check,
*size, TYPE_MAX_VALUE (sizetype));
/* Update the argument list to reflect the adjusted size. */
- VEC_replace (tree, *args, 0, *size);
+ (**args)[0] = *size;
}
else
*cookie_size = NULL_TREE;
@@ -4031,7 +4025,7 @@ build_operator_new_call (tree fnname, VEC(tree,gc) **args,
/* Build a new call to operator(). This may change ARGS. */
static tree
-build_op_call_1 (tree obj, VEC(tree,gc) **args, tsubst_flags_t complain)
+build_op_call_1 (tree obj, vec<tree, va_gc> **args, tsubst_flags_t complain)
{
struct z_candidate *candidates = 0, *cand;
tree fns, convs, first_mem_arg = NULL_TREE;
@@ -4165,7 +4159,7 @@ build_op_call_1 (tree obj, VEC(tree,gc) **args, tsubst_flags_t complain)
/* Wrapper for above. */
tree
-build_op_call (tree obj, VEC(tree,gc) **args, tsubst_flags_t complain)
+build_op_call (tree obj, vec<tree, va_gc> **args, tsubst_flags_t complain)
{
tree ret;
bool subtime = timevar_cond_start (TV_OVERLOAD);
@@ -4899,7 +4893,7 @@ prep_operand (tree operand)
add_function_candidate. */
static void
-add_candidates (tree fns, tree first_arg, const VEC(tree,gc) *args,
+add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args,
tree return_type,
tree explicit_targs, bool template_only,
tree conversion_path, tree access_path,
@@ -4908,7 +4902,7 @@ add_candidates (tree fns, tree first_arg, const VEC(tree,gc) *args,
tsubst_flags_t complain)
{
tree ctype;
- const VEC(tree,gc) *non_static_args;
+ const vec<tree, va_gc> *non_static_args;
bool check_list_ctor;
bool check_converting;
unification_kind_t strict;
@@ -4964,7 +4958,7 @@ add_candidates (tree fns, tree first_arg, const VEC(tree,gc) *args,
for (; fns; fns = OVL_NEXT (fns))
{
tree fn_first_arg;
- const VEC(tree,gc) *fn_args;
+ const vec<tree, va_gc> *fn_args;
fn = OVL_CURRENT (fns);
@@ -4982,12 +4976,12 @@ add_candidates (tree fns, tree first_arg, const VEC(tree,gc) *args,
{
unsigned int ix;
tree arg;
- VEC(tree,gc) *tempvec
- = VEC_alloc (tree, gc, VEC_length (tree, args) - 1);
- for (ix = 1; VEC_iterate (tree, args, ix, arg); ++ix)
- VEC_quick_push (tree, tempvec, arg);
+ vec<tree, va_gc> *tempvec;
+ vec_alloc (tempvec, args->length () - 1);
+ for (ix = 1; args->iterate (ix, &arg); ++ix)
+ tempvec->quick_push (arg);
non_static_args = tempvec;
- first_arg = build_this (VEC_index (tree, args, 0));
+ first_arg = build_this ((*args)[0]);
}
fn_first_arg = first_arg;
@@ -5031,7 +5025,7 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
tree arg2, tree arg3, tree *overload, tsubst_flags_t complain)
{
struct z_candidate *candidates = 0, *cand;
- VEC(tree,gc) *arglist;
+ vec<tree, va_gc> *arglist;
tree fnname;
tree args[3];
tree result = NULL_TREE;
@@ -5098,12 +5092,12 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR)
arg2 = integer_zero_node;
- arglist = VEC_alloc (tree, gc, 3);
- VEC_quick_push (tree, arglist, arg1);
+ vec_alloc (arglist, 3);
+ arglist->quick_push (arg1);
if (arg2 != NULL_TREE)
- VEC_quick_push (tree, arglist, arg2);
+ arglist->quick_push (arg2);
if (arg3 != NULL_TREE)
- VEC_quick_push (tree, arglist, arg3);
+ arglist->quick_push (arg3);
/* Get the high-water mark for the CONVERSION_OBSTACK. */
p = conversion_obstack_alloc (0);
@@ -5645,12 +5639,13 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
else
{
tree ret;
- VEC(tree,gc) *args = VEC_alloc (tree, gc, 2);
- VEC_quick_push (tree, args, addr);
+ vec<tree, va_gc> *args;
+ vec_alloc (args, 2);
+ args->quick_push (addr);
if (FUNCTION_ARG_CHAIN (fn) != void_list_node)
- VEC_quick_push (tree, args, size);
+ args->quick_push (size);
ret = cp_build_function_call_vec (fn, &args, complain);
- VEC_free (tree, gc, args);
+ vec_free (args);
return ret;
}
}
@@ -5715,7 +5710,7 @@ build_temp (tree expr, tree type, int flags,
diagnostic_t *diagnostic_kind, tsubst_flags_t complain)
{
int savew, savee;
- VEC(tree,gc) *args;
+ vec<tree, va_gc> *args;
savew = warningcount, savee = errorcount;
args = make_tree_vector_single (expr);
@@ -5965,7 +5960,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
tree new_ctor = build_constructor (init_list_type_node, NULL);
unsigned len = CONSTRUCTOR_NELTS (expr);
tree array, val, field;
- VEC(constructor_elt,gc) *vec = NULL;
+ vec<constructor_elt, va_gc> *vec = NULL;
unsigned ix;
/* Convert all the elements. */
@@ -6340,13 +6335,14 @@ cxx_type_promotes_to (tree type)
zero-based argument number. Do any required conversions. Return
the converted value. */
-static GTY(()) VEC(tree,gc) *default_arg_context;
+static GTY(()) vec<tree, va_gc> *default_arg_context;
void
push_defarg_context (tree fn)
-{ VEC_safe_push (tree, gc, default_arg_context, fn); }
+{ vec_safe_push (default_arg_context, fn); }
+
void
pop_defarg_context (void)
-{ VEC_pop (tree, default_arg_context); }
+{ default_arg_context->pop (); }
tree
convert_default_arg (tree type, tree arg, tree fn, int parmnum,
@@ -6359,7 +6355,7 @@ convert_default_arg (tree type, tree arg, tree fn, int parmnum,
fn = DECL_ORIGIN (fn);
/* Detect recursion. */
- FOR_EACH_VEC_ELT (tree, default_arg_context, i, t)
+ FOR_EACH_VEC_SAFE_ELT (default_arg_context, i, t)
if (t == fn)
{
if (complain & tf_error)
@@ -6581,7 +6577,7 @@ static tree
build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
{
tree fn = cand->fn;
- const VEC(tree,gc) *args = cand->args;
+ const vec<tree, va_gc> *args = cand->args;
tree first_arg = cand->first_arg;
conversion **convs = cand->convs;
conversion *conv;
@@ -6608,9 +6604,9 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
unsigned int nargs;
return_type = TREE_TYPE (TREE_TYPE (fn));
- nargs = VEC_length (tree, args);
+ nargs = vec_safe_length (args);
if (first_arg == NULL_TREE)
- argarray = VEC_address (tree, CONST_CAST (VEC(tree,gc) *, args));
+ argarray = args->address ();
else
{
tree *alcarray;
@@ -6620,7 +6616,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
++nargs;
alcarray = XALLOCAVEC (tree, nargs);
alcarray[0] = first_arg;
- FOR_EACH_VEC_ELT (tree, args, ix, arg)
+ FOR_EACH_VEC_SAFE_ELT (args, ix, arg)
alcarray[ix + 1] = arg;
argarray = alcarray;
}
@@ -6705,7 +6701,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
/* Find maximum size of vector to hold converted arguments. */
parmlen = list_length (parm);
- nargs = VEC_length (tree, args) + (first_arg != NULL_TREE ? 1 : 0);
+ nargs = vec_safe_length (args) + (first_arg != NULL_TREE ? 1 : 0);
if (parmlen > nargs)
nargs = parmlen;
argarray = XALLOCAVEC (tree, nargs);
@@ -6721,7 +6717,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
}
else
{
- argarray[j++] = VEC_index (tree, args, arg_index);
+ argarray[j++] = (*args)[arg_index];
++arg_index;
}
parm = TREE_CHAIN (parm);
@@ -6730,7 +6726,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
if (DECL_HAS_VTT_PARM_P (fn))
{
- argarray[j++] = VEC_index (tree, args, arg_index);
+ argarray[j++] = (*args)[arg_index];
++arg_index;
parm = TREE_CHAIN (parm);
}
@@ -6741,7 +6737,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
tree parmtype = TREE_VALUE (parm);
tree arg = (first_arg != NULL_TREE
? first_arg
- : VEC_index (tree, args, arg_index));
+ : (*args)[arg_index]);
tree argtype = TREE_TYPE (arg);
tree converted_arg;
tree base_binfo;
@@ -6800,11 +6796,11 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
}
gcc_assert (first_arg == NULL_TREE);
- for (; arg_index < VEC_length (tree, args) && parm;
+ for (; arg_index < vec_safe_length (args) && parm;
parm = TREE_CHAIN (parm), ++arg_index, ++i)
{
tree type = TREE_VALUE (parm);
- tree arg = VEC_index (tree, args, arg_index);
+ tree arg = (*args)[arg_index];
bool conversion_warning = true;
conv = convs[i];
@@ -6889,9 +6885,9 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
}
/* Ellipsis */
- for (; arg_index < VEC_length (tree, args); ++arg_index)
+ for (; arg_index < vec_safe_length (args); ++arg_index)
{
- tree a = VEC_index (tree, args, arg_index);
+ tree a = (*args)[arg_index];
if (magic_varargs_p (fn))
/* Do no conversions for magic varargs. */
a = mark_type_use (a);
@@ -7221,13 +7217,13 @@ in_charge_arg_for_name (tree name)
store the newly constructed object into a VAR_DECL. */
tree
-build_special_member_call (tree instance, tree name, VEC(tree,gc) **args,
+build_special_member_call (tree instance, tree name, vec<tree, va_gc> **args,
tree binfo, int flags, tsubst_flags_t complain)
{
tree fns;
/* The type of the subobject to be constructed or destroyed. */
tree class_type;
- VEC(tree,gc) *allocated = NULL;
+ vec<tree, va_gc> *allocated = NULL;
tree ret;
gcc_assert (name == complete_ctor_identifier
@@ -7260,7 +7256,7 @@ build_special_member_call (tree instance, tree name, VEC(tree,gc) **args,
if (name == complete_dtor_identifier
|| name == base_dtor_identifier
|| name == deleting_dtor_identifier)
- gcc_assert (args == NULL || VEC_empty (tree, *args));
+ gcc_assert (args == NULL || vec_safe_is_empty (*args));
/* Convert to the base class, if necessary. */
if (!same_type_ignoring_top_level_qualifiers_p
@@ -7318,7 +7314,7 @@ build_special_member_call (tree instance, tree name, VEC(tree,gc) **args,
args = &allocated;
}
- VEC_safe_insert (tree, gc, *args, 0, sub_vtt);
+ vec_safe_insert (*args, 0, sub_vtt);
}
ret = build_new_method_call (instance, fns, args,
@@ -7382,7 +7378,7 @@ name_as_c_string (tree name, tree type, bool *free_p)
This may change ARGS. */
static tree
-build_new_method_call_1 (tree instance, tree fns, VEC(tree,gc) **args,
+build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args,
tree conversion_path, int flags,
tree *fn_p, tsubst_flags_t complain)
{
@@ -7395,14 +7391,14 @@ build_new_method_call_1 (tree instance, tree fns, VEC(tree,gc) **args,
tree instance_ptr;
tree name;
bool skip_first_for_error;
- VEC(tree,gc) *user_args;
+ vec<tree, va_gc> *user_args;
tree call;
tree fn;
int template_only = 0;
bool any_viable_p;
tree orig_instance;
tree orig_fns;
- VEC(tree,gc) *orig_args = NULL;
+ vec<tree, va_gc> *orig_args = NULL;
void *p;
gcc_assert (instance != NULL_TREE);
@@ -7522,14 +7518,14 @@ build_new_method_call_1 (tree instance, tree fns, VEC(tree,gc) **args,
/* If CONSTRUCTOR_IS_DIRECT_INIT is set, this was a T{ } form
initializer, not T({ }). */
- if (DECL_CONSTRUCTOR_P (fn) && args != NULL && !VEC_empty (tree, *args)
- && BRACE_ENCLOSED_INITIALIZER_P (VEC_index (tree, *args, 0))
- && CONSTRUCTOR_IS_DIRECT_INIT (VEC_index (tree, *args, 0)))
+ if (DECL_CONSTRUCTOR_P (fn) && args != NULL && !vec_safe_is_empty (*args)
+ && BRACE_ENCLOSED_INITIALIZER_P ((**args)[0])
+ && CONSTRUCTOR_IS_DIRECT_INIT ((**args)[0]))
{
- tree init_list = VEC_index (tree, *args, 0);
+ tree init_list = (**args)[0];
tree init = NULL_TREE;
- gcc_assert (VEC_length (tree, *args) == 1
+ gcc_assert ((*args)->length () == 1
&& !(flags & LOOKUP_ONLYCONVERTING));
/* If the initializer list has no elements and T is a class type with
@@ -7732,7 +7728,7 @@ build_new_method_call_1 (tree instance, tree fns, VEC(tree,gc) **args,
/* Wrapper for above. */
tree
-build_new_method_call (tree instance, tree fns, VEC(tree,gc) **args,
+build_new_method_call (tree instance, tree fns, vec<tree, va_gc> **args,
tree conversion_path, int flags,
tree *fn_p, tsubst_flags_t complain)
{
@@ -8896,7 +8892,7 @@ perform_direct_initialization_if_possible (tree type,
ill-formed. */
if (CLASS_TYPE_P (type))
{
- VEC(tree,gc) *args = make_tree_vector_single (expr);
+ vec<tree, va_gc> *args = make_tree_vector_single (expr);
expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,
&args, type, LOOKUP_NORMAL, complain);
release_tree_vector (args);
@@ -9003,7 +8999,7 @@ make_temporary_var_for_ref_to_temp (tree decl, tree type)
code to initialize the new variable is returned through INITP. */
static tree
-set_up_extended_ref_temp (tree decl, tree expr, VEC(tree,gc) **cleanups,
+set_up_extended_ref_temp (tree decl, tree expr, vec<tree, va_gc> **cleanups,
tree *initp)
{
tree init;
@@ -9076,7 +9072,7 @@ set_up_extended_ref_temp (tree decl, tree expr, VEC(tree,gc) **cleanups,
{
tree cleanup = cxx_maybe_build_cleanup (var, tf_warning_or_error);
if (cleanup)
- VEC_safe_push (tree, gc, *cleanups, cleanup);
+ vec_safe_push (*cleanups, cleanup);
}
/* We must be careful to destroy the temporary only
@@ -9170,7 +9166,7 @@ initialize_reference (tree type, tree expr,
which is bound either to a reference or a std::initializer_list. */
static tree
-extend_ref_init_temps_1 (tree decl, tree init, VEC(tree,gc) **cleanups)
+extend_ref_init_temps_1 (tree decl, tree init, vec<tree, va_gc> **cleanups)
{
tree sub = init;
tree *p;
@@ -9201,7 +9197,7 @@ extend_ref_init_temps_1 (tree decl, tree init, VEC(tree,gc) **cleanups)
lifetime to match that of DECL. */
tree
-extend_ref_init_temps (tree decl, tree init, VEC(tree,gc) **cleanups)
+extend_ref_init_temps (tree decl, tree init, vec<tree, va_gc> **cleanups)
{
tree type = TREE_TYPE (init);
if (processing_template_decl)
@@ -9226,8 +9222,8 @@ extend_ref_init_temps (tree decl, tree init, VEC(tree,gc) **cleanups)
{
unsigned i;
constructor_elt *p;
- VEC(constructor_elt,gc) *elts = CONSTRUCTOR_ELTS (init);
- FOR_EACH_VEC_ELT (constructor_elt, elts, i, p)
+ vec<constructor_elt, va_gc> *elts = CONSTRUCTOR_ELTS (init);
+ FOR_EACH_VEC_SAFE_ELT (elts, i, p)
p->value = extend_ref_init_temps (decl, p->value, cleanups);
}