diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-08-01 16:45:26 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-08-01 16:45:26 +0200 |
commit | 9a30c7c4092fa2e7f46ee54883404a3fe34f2919 (patch) | |
tree | 514c0aecb2430f2b39147e8bf572fd6c5dc59617 /gcc/ada/gcc-interface/decl.c | |
parent | 88b1a3221d1a03211d78dec931d0cc8d84b180cb (diff) | |
download | gcc-9a30c7c4092fa2e7f46ee54883404a3fe34f2919.zip gcc-9a30c7c4092fa2e7f46ee54883404a3fe34f2919.tar.gz gcc-9a30c7c4092fa2e7f46ee54883404a3fe34f2919.tar.bz2 |
[multiple changes]
2014-08-01 Olivier Hainque <hainque@adacore.com>
* gcc-interface/Make-lang.in (ADA_TOOLS_FLAGS_TO_PASS, native): use
$(CXX) instead of ../../xg++ to feed CXX.
(CXX_LFLAGS): Remove. Now unused as the proper flags
are expected to be included in the CXX variable.
2014-08-01 Pierre-Marie Derodat <derodat@adacore.com>
* gcc-interface/decl.c (elaborate_expression_1): Return the new
variable when debug info is needed and the expression is not
constant. Tag as external only new variables that are global.
(gnat_to_gnu_entity): Call it after the GNU declaration is saved.
* gcc-interface/trans.c (Attribute_to_gnu): Do not cache
attributes for IN array parameters when their actual subtype
needs debug info.
(Compilation_Unit_to_gnu): Call it to process all remaining nodes.
* gcc-interface/gigi.h (process_deferred_decl_context): New.
* gcc-interface/utils.c (gnat_write_global_declarations): Do not
emit debug info for ignored global declarations.
(struct deferred_decl_context_node,
add_deferred_decl_context, add_deferred_type_context,
compute_deferred_decl_context, defer_or_set_type_context,
deferred_decl_context_queue, get_debug_scope,
get_global_context, process_deferred_decl_context): New.
(gnat_pushdecl): Re-implement the DECL_CONTEXT and TYPE_CONTEXT
computation machinery to rely on the GNAT Scope attribute.
2014-08-01 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils2.c (build_simple_component_ref): Add guard.
From-SVN: r213482
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 9f05067..1e390ef 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -5190,6 +5190,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (!saved) save_gnu_tree (gnat_entity, gnu_decl, false); + /* Now we are sure gnat_entity has a corresponding ..._DECL node, + eliminate as many deferred computations as possible. */ + process_deferred_decl_context (false); + /* If this is an enumeration or floating-point type, we were not able to set the bounds since they refer to the type. These are always static. */ if ((kind == E_Enumeration_Type && Present (First_Literal (gnat_entity))) @@ -6184,14 +6188,30 @@ elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, tree gnu_name, /* Now create it, possibly only for debugging purposes. */ if (use_variable || need_debug) { + /* The following variable creation can happen when processing the body of + subprograms that are defined out of the extended main unit and + inlined. In this case, we are not at the global scope, and thus the + new variable must not be tagged "external", as we used to do here as + long as definition == 0. */ + const bool external_flag = !definition && expr_global_p; tree gnu_decl = create_var_decl_1 (create_concat_name (gnat_entity, IDENTIFIER_POINTER (gnu_name)), NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, true, expr_public_p, - !definition, expr_global_p, !need_debug, NULL, gnat_entity); + external_flag, expr_global_p, !need_debug, NULL, gnat_entity); DECL_ARTIFICIAL (gnu_decl) = 1; - if (use_variable) + + /* Using this variable at debug time (if need_debug is true) requires a + proper location. The back-end will compute a location for this + variable only if the variable is used by the generated code. + Returning the variable ensures the caller will use it in generated + code. Note that there is no need for a location if the debug info + contains an integer constant. + FIXME: when the encoding-based debug scheme is dropped, move this + condition to the top-level IF block: we will not need to create a + variable anymore in such cases, then. */ + if (use_variable || (need_debug && !TREE_CONSTANT (gnu_expr))) return gnu_decl; } |