OSDN Git Service

* gcc-interface/utils.c (gnat_pushdecl): Set TYPE_CONTEXT for types
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Jul 2012 07:58:55 +0000 (07:58 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Jul 2012 07:58:55 +0000 (07:58 +0000)
attached to a TYPE_DECL.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@189196 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils.c

index b336f03..1e84e74 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-03  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/utils.c (gnat_pushdecl): Set TYPE_CONTEXT for types
+       attached to a TYPE_DECL.
+
 2012-06-15  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR ada/53592
index c87a761..e4e74b0 100644 (file)
@@ -581,6 +581,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
              if (TREE_CODE (t) == POINTER_TYPE)
                TYPE_NEXT_PTR_TO (t) = tt;
              TYPE_NAME (tt) = DECL_NAME (decl);
+             TYPE_CONTEXT (tt) = DECL_CONTEXT (decl);
              TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (t);
              DECL_ORIGINAL_TYPE (decl) = tt;
            }
@@ -590,6 +591,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
          /* We need a variant for the placeholder machinery to work.  */
          tree tt = build_variant_type_copy (t);
          TYPE_NAME (tt) = decl;
+         TYPE_CONTEXT (tt) = DECL_CONTEXT (decl);
          TREE_USED (tt) = TREE_USED (t);
          TREE_TYPE (decl) = tt;
          if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
@@ -609,7 +611,10 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
       if (t)
        for (t = TYPE_MAIN_VARIANT (t); t; t = TYPE_NEXT_VARIANT (t))
          if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL))
-           TYPE_NAME (t) = decl;
+           {
+             TYPE_NAME (t) = decl;
+             TYPE_CONTEXT (t) = DECL_CONTEXT (decl);
+           }
     }
 }
 \f