Commit d15bac21 by Janus Weil

class.c (gfc_add_component_ref,gfc_class_null_initializer, [...]): Moved here from other places.

2010-05-17  Janus Weil  <janus@gcc.gnu.org>

	* class.c (gfc_add_component_ref,gfc_class_null_initializer,
	gfc_build_class_symbol,add_proc_component,add_proc_comps, 
	add_procs_to_declared_vtab1,copy_vtab_proc_comps,
	add_procs_to_declared_vtab,add_generic_specifics, 
	add_generics_to_declared_vtab,gfc_find_derived_vtab,
	find_typebound_proc_uop,gfc_find_typebound_proc,
	gfc_find_typebound_user_op,gfc_find_typebound_intrinsic_op, 
	gfc_get_tbp_symtree): Moved here from other places.
	* expr.c (gfc_add_component_ref,gfc_class_null_initializer): Move to
	class.c.
	* gfortran.h (gfc_build_class_symbol,gfc_find_derived_vtab,
	gfc_find_typebound_proc,gfc_find_typebound_user_op,
	gfc_find_typebound_intrinsic_op,gfc_get_tbp_symtree,
	gfc_add_component_ref, gfc_class_null_initializer): Moved to class.c.
	* Make-lang.in: Add class.o.
	* symbol.c (gfc_build_class_symbol,add_proc_component,add_proc_comps,
	add_procs_to_declared_vtab1,copy_vtab_proc_comps,
	add_procs_to_declared_vtab,add_generic_specifics,
	add_generics_to_declared_vtab,gfc_find_derived_vtab,
	find_typebound_proc_uop,gfc_find_typebound_proc,
	gfc_find_typebound_user_op,gfc_find_typebound_intrinsic_op,
	gfc_get_tbp_symtree): Move to class.c.

From-SVN: r159506
parent d5d74497
2010-05-17 Janus Weil <janus@gcc.gnu.org>
* class.c (gfc_add_component_ref,gfc_class_null_initializer,
gfc_build_class_symbol,add_proc_component,add_proc_comps,
add_procs_to_declared_vtab1,copy_vtab_proc_comps,
add_procs_to_declared_vtab,add_generic_specifics,
add_generics_to_declared_vtab,gfc_find_derived_vtab,
find_typebound_proc_uop,gfc_find_typebound_proc,
gfc_find_typebound_user_op,gfc_find_typebound_intrinsic_op,
gfc_get_tbp_symtree): Moved here from other places.
* expr.c (gfc_add_component_ref,gfc_class_null_initializer): Move to
class.c.
* gfortran.h (gfc_build_class_symbol,gfc_find_derived_vtab,
gfc_find_typebound_proc,gfc_find_typebound_user_op,
gfc_find_typebound_intrinsic_op,gfc_get_tbp_symtree,
gfc_add_component_ref, gfc_class_null_initializer): Moved to class.c.
* Make-lang.in: Add class.o.
* symbol.c (gfc_build_class_symbol,add_proc_component,add_proc_comps,
add_procs_to_declared_vtab1,copy_vtab_proc_comps,
add_procs_to_declared_vtab,add_generic_specifics,
add_generics_to_declared_vtab,gfc_find_derived_vtab,
find_typebound_proc_uop,gfc_find_typebound_proc,
gfc_find_typebound_user_op,gfc_find_typebound_intrinsic_op,
gfc_get_tbp_symtree): Move to class.c.
2010-05-17 Nathan Froyd <froydnj@codesourcery.com>
* trans-types.c (gfc_init_types): Use build_function_type_list.
......
......@@ -53,13 +53,13 @@ fortran-warn = $(STRICT_WARN)
# from the parse tree to GENERIC
F95_PARSER_OBJS = fortran/arith.o fortran/array.o fortran/bbt.o \
fortran/check.o fortran/constructor.o fortran/cpp.o fortran/data.o \
fortran/decl.o fortran/dump-parse-tree.o fortran/error.o fortran/expr.o \
fortran/interface.o fortran/intrinsic.o fortran/io.o fortran/iresolve.o \
fortran/match.o fortran/matchexp.o fortran/misc.o fortran/module.o \
fortran/openmp.o fortran/options.o fortran/parse.o fortran/primary.o \
fortran/resolve.o fortran/scanner.o fortran/simplify.o fortran/st.o \
fortran/symbol.o fortran/target-memory.o
fortran/check.o fortran/class.o fortran/constructor.o fortran/cpp.o \
fortran/data.o fortran/decl.o fortran/dump-parse-tree.o fortran/error.o \
fortran/expr.o fortran/interface.o fortran/intrinsic.o fortran/io.o \
fortran/iresolve.o fortran/match.o fortran/matchexp.o fortran/misc.o \
fortran/module.o fortran/openmp.o fortran/options.o fortran/parse.o \
fortran/primary.o fortran/resolve.o fortran/scanner.o fortran/simplify.o \
fortran/st.o fortran/symbol.o fortran/target-memory.o
F95_OBJS = $(F95_PARSER_OBJS) $(FORTRAN_TARGET_OBJS) \
fortran/convert.o fortran/dependency.o fortran/f95-lang.o \
......
......@@ -676,36 +676,6 @@ gfc_has_vector_index (gfc_expr *e)
}
/* Insert a reference to the component of the given name.
Only to be used with CLASS containers. */
void
gfc_add_component_ref (gfc_expr *e, const char *name)
{
gfc_ref **tail = &(e->ref);
gfc_ref *next = NULL;
gfc_symbol *derived = e->symtree->n.sym->ts.u.derived;
while (*tail != NULL)
{
if ((*tail)->type == REF_COMPONENT)
derived = (*tail)->u.c.component->ts.u.derived;
if ((*tail)->type == REF_ARRAY && (*tail)->next == NULL)
break;
tail = &((*tail)->next);
}
if (*tail != NULL && strcmp (name, "$data") == 0)
next = *tail;
(*tail) = gfc_get_ref();
(*tail)->next = next;
(*tail)->type = REF_COMPONENT;
(*tail)->u.c.sym = derived;
(*tail)->u.c.component = gfc_find_component (derived, name, true, true);
gcc_assert((*tail)->u.c.component);
if (!next)
e->ts = (*tail)->u.c.component->ts;
}
/* Copy a shape array. */
mpz_t *
......@@ -3628,32 +3598,6 @@ gfc_default_initializer (gfc_typespec *ts)
}
/* Build a NULL initializer for CLASS pointers,
initializing the $data and $vptr components to zero. */
gfc_expr *
gfc_class_null_initializer (gfc_typespec *ts)
{
gfc_expr *init;
gfc_component *comp;
init = gfc_get_structure_constructor_expr (ts->type, ts->kind,
&ts->u.derived->declared_at);
init->ts = *ts;
for (comp = ts->u.derived->components; comp; comp = comp->next)
{
gfc_constructor *ctor = gfc_constructor_get();
ctor->expr = gfc_get_expr ();
ctor->expr->expr_type = EXPR_NULL;
ctor->expr->ts = comp->ts;
gfc_constructor_append (&init->value.constructor, ctor);
}
return init;
}
/* Given a symbol, create an expression node with that symbol as a
variable. If the symbol is array valued, setup a reference of the
whole array. */
......
......@@ -2512,22 +2512,11 @@ void gfc_free_dt_list (void);
gfc_gsymbol *gfc_get_gsymbol (const char *);
gfc_gsymbol *gfc_find_gsymbol (gfc_gsymbol *, const char *);
gfc_try gfc_build_class_symbol (gfc_typespec *, symbol_attribute *,
gfc_array_spec **, bool);
gfc_symbol *gfc_find_derived_vtab (gfc_symbol *, bool);
gfc_typebound_proc* gfc_get_typebound_proc (void);
gfc_symbol* gfc_get_derived_super_type (gfc_symbol*);
gfc_symbol* gfc_get_ultimate_derived_super_type (gfc_symbol*);
bool gfc_type_is_extension_of (gfc_symbol *, gfc_symbol *);
bool gfc_type_compatible (gfc_typespec *, gfc_typespec *);
gfc_symtree* gfc_find_typebound_proc (gfc_symbol*, gfc_try*,
const char*, bool, locus*);
gfc_symtree* gfc_find_typebound_user_op (gfc_symbol*, gfc_try*,
const char*, bool, locus*);
gfc_typebound_proc* gfc_find_typebound_intrinsic_op (gfc_symbol*, gfc_try*,
gfc_intrinsic_op, bool,
locus*);
gfc_symtree* gfc_get_tbp_symtree (gfc_symtree**, const char*);
void gfc_copy_formal_args (gfc_symbol *, gfc_symbol *);
void gfc_copy_formal_args_intr (gfc_symbol *, gfc_intrinsic_sym *);
......@@ -2593,7 +2582,6 @@ gfc_actual_arglist *gfc_copy_actual_arglist (gfc_actual_arglist *);
const char *gfc_extract_int (gfc_expr *, int *);
bool is_subref_array (gfc_expr *);
void gfc_add_component_ref (gfc_expr *, const char *);
gfc_expr *gfc_build_conversion (gfc_expr *);
void gfc_free_ref_list (gfc_ref *);
void gfc_type_convert_binary (gfc_expr *, int);
......@@ -2630,7 +2618,6 @@ gfc_try gfc_check_pointer_assign (gfc_expr *, gfc_expr *);
gfc_try gfc_check_assign_symbol (gfc_symbol *, gfc_expr *);
gfc_expr *gfc_default_initializer (gfc_typespec *);
gfc_expr *gfc_class_null_initializer (gfc_typespec *);
gfc_expr *gfc_get_variable_expr (gfc_symtree *);
gfc_array_spec *gfc_get_full_arrayspec_from_expr (gfc_expr *expr);
......@@ -2785,4 +2772,19 @@ int gfc_is_data_pointer (gfc_expr *);
/* check.c */
gfc_try gfc_check_same_strlen (const gfc_expr*, const gfc_expr*, const char*);
/* class.c */
void gfc_add_component_ref (gfc_expr *, const char *);
gfc_expr *gfc_class_null_initializer (gfc_typespec *);
gfc_try gfc_build_class_symbol (gfc_typespec *, symbol_attribute *,
gfc_array_spec **, bool);
gfc_symbol *gfc_find_derived_vtab (gfc_symbol *, bool);
gfc_symtree* gfc_find_typebound_proc (gfc_symbol*, gfc_try*,
const char*, bool, locus*);
gfc_symtree* gfc_find_typebound_user_op (gfc_symbol*, gfc_try*,
const char*, bool, locus*);
gfc_typebound_proc* gfc_find_typebound_intrinsic_op (gfc_symbol*, gfc_try*,
gfc_intrinsic_op, bool,
locus*);
gfc_symtree* gfc_get_tbp_symtree (gfc_symtree**, const char*);
#endif /* GCC_GFORTRAN_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment