+2000-12-28 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (register_local_specialization): Don't return a value.
+ (lookup_template_class): Use move-to-front heuristic when looking
+ up template instantiations.
+ (instantiate_decl): Only push_to_top_level when we're actually
+ going to instantiate the template.
+
2000-12-29 Hans-Peter Nilsson <hp@bitrange.com>
* search.c (binfo_for_vtable): Return least derived class, not
static tree retrieve_specialization PARAMS ((tree, tree));
static tree retrieve_local_specialization PARAMS ((tree));
static tree register_specialization PARAMS ((tree, tree, tree));
-static tree register_local_specialization PARAMS ((tree, tree));
+static void register_local_specialization PARAMS ((tree, tree));
static int unregister_specialization PARAMS ((tree, tree));
static tree reduce_template_parm_level PARAMS ((tree, tree, int));
static tree build_template_decl PARAMS ((tree, tree));
/* Like register_specialization, but for local declarations. We are
registering SPEC, an instantiation of TMPL. */
-static tree
+static void
register_local_specialization (spec, tmpl)
tree spec;
tree tmpl;
slot = htab_find_slot (local_specializations, tmpl, INSERT);
*slot = spec;
-
- return spec;
}
/* Print the list of candidate FNS in an error message. */
tree gen_tmpl;
tree type_decl;
tree found = NULL_TREE;
+ tree *tp;
int arg_depth;
int parm_depth;
int is_partial_instantiation;
}
if (found)
return found;
-
- for (found = DECL_TEMPLATE_INSTANTIATIONS (template);
- found; found = TREE_CHAIN (found))
- if (comp_template_args (TREE_PURPOSE (found), arglist))
- return TREE_VALUE (found);
+
+ for (tp = &DECL_TEMPLATE_INSTANTIATIONS (template);
+ *tp;
+ tp = &TREE_CHAIN (*tp))
+ if (comp_template_args (TREE_PURPOSE (*tp), arglist))
+ {
+ found = *tp;
+ *tp = TREE_CHAIN (*tp);
+ TREE_CHAIN (found)
+ = DECL_TEMPLATE_INSTANTIATIONS (template);
+ DECL_TEMPLATE_INSTANTIATIONS (template) = found;
+ return TREE_VALUE (found);
+ }
/* This type is a "partial instantiation" if any of the template
arguments still involve template parameters. Note that we set
else
pattern_defined = ! DECL_IN_AGGR_P (code_pattern);
- push_to_top_level ();
lineno = DECL_SOURCE_LINE (d);
input_filename = DECL_SOURCE_FILE (d);
goto out;
}
+ push_to_top_level ();
+
/* We're now committed to instantiating this template. Mark it as
instantiated so that recursive calls to instantiate_decl do not
try to instantiate it again. */
/* We're not deferring instantiation any more. */
TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0;
+ pop_from_top_level ();
+
out:
lineno = line;
input_filename = file;
- pop_from_top_level ();
pop_tinst_level ();
timevar_pop (TV_PARSE);