summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-29 18:50:30 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-29 18:50:30 +0000
commit51d9479b52f25a120cfcd3245c3c08c08d36b154 (patch)
tree608299ccb142373813b47b20670e29f7a75ee3c3 /gcc/fortran/trans-decl.c
parent1a3ef8f6bad65a15eff9ec008b363934e92e3e3e (diff)
downloadgcc-51d9479b52f25a120cfcd3245c3c08c08d36b154.tar.gz
* gfortran.h (gfc_use_list): Add where field.
* module.c (use_locus): New static variable. (gfc_match_use): Set it. (gfc_use_module): Copy it to gfc_use_list's where field. * trans-decl.c (gfc_generate_module_vars): Call gfc_trans_use_stmts. (gfc_trans_use_stmts): Set backend locus before calling the debug hook. Allow non-VAR_DECLs to be created even for non-external module. Don't emit anything so far for renames from different modules. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139780 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r--gcc/fortran/trans-decl.c56
1 files changed, 34 insertions, 22 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index bf038f7cf94..042821df121 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -3151,26 +3151,7 @@ gfc_create_module_variable (gfc_symbol * sym)
}
}
-
-/* Generate all the required code for module variables. */
-
-void
-gfc_generate_module_vars (gfc_namespace * ns)
-{
- module_namespace = ns;
- cur_module = gfc_find_module (ns->proc_name->name);
-
- /* Check if the frontend left the namespace in a reasonable state. */
- gcc_assert (ns->proc_name && !ns->proc_name->tlink);
-
- /* Generate COMMON blocks. */
- gfc_trans_common (ns);
-
- /* Create decls for all the module variables. */
- gfc_traverse_ns (ns, gfc_create_module_variable);
-
- cur_module = NULL;
-}
+/* Emit debug information for USE statements. */
static void
gfc_trans_use_stmts (gfc_namespace * ns)
@@ -3190,6 +3171,7 @@ gfc_trans_use_stmts (gfc_namespace * ns)
void_type_node);
DECL_EXTERNAL (entry->namespace_decl) = 1;
}
+ gfc_set_backend_locus (&use_stmt->where);
if (!use_stmt->only_flag)
(*debug_hooks->imported_module_or_decl) (entry->namespace_decl,
NULL_TREE,
@@ -3214,9 +3196,14 @@ gfc_trans_use_stmts (gfc_namespace * ns)
rent->local_name[0]
? rent->local_name : rent->use_name);
gcc_assert (st && st->n.sym->attr.use_assoc);
- if (st->n.sym->backend_decl && DECL_P (st->n.sym->backend_decl))
+ if (st->n.sym->backend_decl
+ && DECL_P (st->n.sym->backend_decl)
+ && st->n.sym->module
+ && strcmp (st->n.sym->module, use_stmt->module_name) == 0)
{
- gcc_assert (DECL_EXTERNAL (entry->namespace_decl));
+ gcc_assert (DECL_EXTERNAL (entry->namespace_decl)
+ || (TREE_CODE (st->n.sym->backend_decl)
+ != VAR_DECL));
decl = copy_node (st->n.sym->backend_decl);
DECL_CONTEXT (decl) = entry->namespace_decl;
DECL_EXTERNAL (decl) = 1;
@@ -3236,6 +3223,7 @@ gfc_trans_use_stmts (gfc_namespace * ns)
local_name = get_identifier (rent->local_name);
else
local_name = NULL_TREE;
+ gfc_set_backend_locus (&rent->where);
(*debug_hooks->imported_module_or_decl) (decl, local_name,
ns->proc_name->backend_decl,
!use_stmt->only_flag);
@@ -3243,6 +3231,30 @@ gfc_trans_use_stmts (gfc_namespace * ns)
}
}
+
+/* Generate all the required code for module variables. */
+
+void
+gfc_generate_module_vars (gfc_namespace * ns)
+{
+ module_namespace = ns;
+ cur_module = gfc_find_module (ns->proc_name->name);
+
+ /* Check if the frontend left the namespace in a reasonable state. */
+ gcc_assert (ns->proc_name && !ns->proc_name->tlink);
+
+ /* Generate COMMON blocks. */
+ gfc_trans_common (ns);
+
+ /* Create decls for all the module variables. */
+ gfc_traverse_ns (ns, gfc_create_module_variable);
+
+ cur_module = NULL;
+
+ gfc_trans_use_stmts (ns);
+}
+
+
static void
gfc_generate_contained_functions (gfc_namespace * parent)
{