diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2012-01-27 09:22:36 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2012-01-27 09:22:36 +0000 |
commit | 1228a6a69b9fddc0aaa2b462db44d3d2bef4f22f (patch) | |
tree | 27220aacc35df038cd025daf85b09ead96c9cc36 /gcc/ada/gcc-interface/trans.c | |
parent | 88a94e2bba73b6eeb77d82f5bb18d990d2f63b10 (diff) | |
download | gcc-1228a6a69b9fddc0aaa2b462db44d3d2bef4f22f.zip gcc-1228a6a69b9fddc0aaa2b462db44d3d2bef4f22f.tar.gz gcc-1228a6a69b9fddc0aaa2b462db44d3d2bef4f22f.tar.bz2 |
gigi.h (get_minimal_subprog_decl): Declare.
* gcc-interface/gigi.h (get_minimal_subprog_decl): Declare.
* gcc-interface/decl.c (get_minimal_subprog_decl): New function.
* gcc-interface/trans.c (Attribute_to_gnu): Use it for the prefix of an
Access-like attribute in a dispatch table if the subprogram is public.
From-SVN: r183607
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 4ba6fb3..077d4a6 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1232,11 +1232,24 @@ Pragma_to_gnu (Node_Id gnat_node) static tree Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) { - tree gnu_prefix = gnat_to_gnu (Prefix (gnat_node)); - tree gnu_type = TREE_TYPE (gnu_prefix); - tree gnu_expr, gnu_result_type, gnu_result = error_mark_node; + tree gnu_prefix, gnu_type, gnu_expr; + tree gnu_result_type, gnu_result = error_mark_node; bool prefix_unused = false; + /* ??? If this is an access attribute for a public subprogram to be used in + a dispatch table, do not translate its type as it's useless there and the + parameter types might be incomplete types coming from a limited with. */ + if (Ekind (Etype (gnat_node)) == E_Access_Subprogram_Type + && Is_Dispatch_Table_Entity (Etype (gnat_node)) + && Nkind (Prefix (gnat_node)) == N_Identifier + && Is_Subprogram (Entity (Prefix (gnat_node))) + && Is_Public (Entity (Prefix (gnat_node))) + && !present_gnu_tree (Entity (Prefix (gnat_node)))) + gnu_prefix = get_minimal_subprog_decl (Entity (Prefix (gnat_node))); + else + gnu_prefix = gnat_to_gnu (Prefix (gnat_node)); + gnu_type = TREE_TYPE (gnu_prefix); + /* If the input is a NULL_EXPR, make a new one. */ if (TREE_CODE (gnu_prefix) == NULL_EXPR) { |