c-ada-spec.c (has_nontrivial_methods): Test for FUNCTION_DECL.
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 7 Aug 2017 15:09:07 +0000 (15:09 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 7 Aug 2017 15:09:07 +0000 (15:09 +0000)
* c-ada-spec.c (has_nontrivial_methods): Test for FUNCTION_DECL.
(print_ada_methods): Likewise.
(print_ada_declaration): Likewise.

From-SVN: r250920

gcc/c-family/ChangeLog
gcc/c-family/c-ada-spec.c

index ba007b9442c4ab486cafcbf838f13266e1c6e814..1243eefa91edee83d1886956dbbae0ad708626ea 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-07  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * c-ada-spec.c (has_nontrivial_methods): Test for FUNCTION_DECL.
+       (print_ada_methods): Likewise.
+       (print_ada_declaration): Likewise.
+
 2017-08-07  Martin Liska  <mliska@suse.cz>
 
        * array-notation-common.c: Add new includes.
index dac437d9bf63c2165160d8edc6bd6fd4d4888dee..6c050fb673b9942f776248bda1999148e1d44ce3 100644 (file)
@@ -1099,7 +1099,7 @@ has_nontrivial_methods (tree type)
 
   /* If there are user-defined methods, they are deemed non-trivial.  */
   for (tree fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld))
-    if (TREE_CODE (TREE_TYPE (fld)) == METHOD_TYPE && !DECL_ARTIFICIAL (fld))
+    if (TREE_CODE (fld) == FUNCTION_DECL && !DECL_ARTIFICIAL (fld))
       return true;
 
   return false;
@@ -2442,7 +2442,7 @@ print_ada_methods (pretty_printer *buffer, tree node, int spc)
 
   int res = 1;
   for (tree fld = TYPE_FIELDS (node); fld; fld = DECL_CHAIN (fld))
-    if (TREE_CODE (TREE_TYPE (fld)) == METHOD_TYPE)
+    if (TREE_CODE (fld) == FUNCTION_DECL)
       {
        if (res)
          {
@@ -2955,8 +2955,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
 
       if (is_constructor && RECORD_OR_UNION_TYPE_P (type))
        for (tree fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld))
-         if (TREE_CODE (TREE_TYPE (fld)) == METHOD_TYPE
-             && cpp_check (fld, IS_ABSTRACT))
+         if (TREE_CODE (fld) == FUNCTION_DECL && cpp_check (fld, IS_ABSTRACT))
            {
              is_abstract_class = true;
              break;
@@ -3036,7 +3035,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
                    is_interface = 0;
                  has_fields = true;
                }
-             else if (TREE_CODE (TREE_TYPE (fld)) == METHOD_TYPE
+             else if (TREE_CODE (fld) == FUNCTION_DECL
                       && !DECL_ARTIFICIAL (fld))
                {
                  if (cpp_check (fld, IS_ABSTRACT))