decl2.c (collect_candidates_for_java_method_aliases): Use DECL_CLASS_SCOPE_P.
authorPaolo Carlini <paolo.carlini@oracle.com>
Sun, 31 Mar 2013 11:15:46 +0000 (11:15 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 31 Mar 2013 11:15:46 +0000 (11:15 +0000)
2013-03-31  Paolo Carlini  <paolo.carlini@oracle.com>

* decl2.c (collect_candidates_for_java_method_aliases): Use
DECL_CLASS_SCOPE_P.
* name-lookup.c (pushtag_1) Use TYPE_FUNCTION_SCOPE_P.
(pushdecl_maybe_friend_1): Use DECL_DECLARES_FUNCTION_P.
* decl.c (duplicate_decls): Likewise.
* parser.c (cp_parser_template_declaration_after_export): Likewise,
also DECL_DECLARES_TYPE_P.
* pt.c (instantiate_class_template_1): Likewise.
* search.c (lookup_field_1): Use DECL_DECLARES_TYPE_P.
(lookup_field_r): Likewise.
(friend_accessible_p): Use DECL_DECLARES_FUNCTION_P.
(lookup_fnfields_slot_nolazy): Likewise.
* semantics.c (finish_member_declaration): Likewise.
* typeck.c (convert_for_initialization): Use TYPE_REFFN_P.

From-SVN: r197283

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/name-lookup.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/search.c
gcc/cp/semantics.c
gcc/cp/typeck.c

index b8c40305daa5ed6e9f2ead5cc7393b68c9f667c9..df25c097b963abac459939b54259db98e519d032 100644 (file)
@@ -1,3 +1,20 @@
+2013-03-31  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * decl2.c (collect_candidates_for_java_method_aliases): Use
+       DECL_CLASS_SCOPE_P.
+       * name-lookup.c (pushtag_1) Use TYPE_FUNCTION_SCOPE_P.
+       (pushdecl_maybe_friend_1): Use DECL_DECLARES_FUNCTION_P.
+       * decl.c (duplicate_decls): Likewise.
+       * parser.c (cp_parser_template_declaration_after_export): Likewise,
+       also DECL_DECLARES_TYPE_P.
+       * pt.c (instantiate_class_template_1): Likewise.
+       * search.c (lookup_field_1): Use DECL_DECLARES_TYPE_P.
+       (lookup_field_r): Likewise.
+       (friend_accessible_p): Use DECL_DECLARES_FUNCTION_P.
+       (lookup_fnfields_slot_nolazy): Likewise.
+       * semantics.c (finish_member_declaration): Likewise.
+       * typeck.c (convert_for_initialization): Use TYPE_REFFN_P.
+
 2013-03-29  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        * pt.c (template_parms_to_args): Fix typo in comment.
index ae4c5b4714841caa38e15f6666fd492254e0712f..98d30dd99ebd64525d7a0d70b0575ea49755d261 100644 (file)
@@ -2063,8 +2063,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
          DECL_TEMPLATE_INFO (newdecl) = DECL_TEMPLATE_INFO (olddecl);
        }
       /* Only functions have these fields.  */
-      if (TREE_CODE (newdecl) == FUNCTION_DECL
-         || DECL_FUNCTION_TEMPLATE_P (newdecl))
+      if (DECL_DECLARES_FUNCTION_P (newdecl))
        {
          DECL_NONCONVERTING_P (newdecl) = DECL_NONCONVERTING_P (olddecl);
          olddecl_friend = DECL_FRIEND_P (olddecl);
index 09fd86464b0ddf6d36d5a165ca291cc9b48f51ec..2b2171039d78e2b02be5159d21e9d84805605d54 100644 (file)
@@ -3665,8 +3665,7 @@ collect_candidates_for_java_method_aliases (void)
     {
       tree fndecl = node->symbol.decl;
 
-      if (DECL_CONTEXT (fndecl)
-         && TYPE_P (DECL_CONTEXT (fndecl))
+      if (DECL_CLASS_SCOPE_P (fndecl)
          && TYPE_FOR_JAVA (DECL_CONTEXT (fndecl))
          && TARGET_USE_LOCAL_THUNK_ALIAS_P (fndecl))
        {
index b25db14f1e1f95baef25d2a10bd6dd4df25ad004..e09eca174b6c6dc3de62b3b3e086536eaf548f83 100644 (file)
@@ -887,7 +887,7 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
            add_decl_to_level (x, NAMESPACE_LEVEL (CP_DECL_CONTEXT (t)));
        }
 
-      if (TREE_CODE (t) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (t))
+      if (DECL_DECLARES_FUNCTION_P (t))
        check_default_args (t);
 
       if (t != x || DECL_FUNCTION_TEMPLATE_P (t))
@@ -5823,8 +5823,7 @@ pushtag_1 (tree name, tree type, tag_scope scope)
         convenient way.  (It's otherwise tricky to find a member
         function definition it's only pointed to from within a local
         class.)  */
-      if (TYPE_CONTEXT (type)
-         && TREE_CODE (TYPE_CONTEXT (type)) == FUNCTION_DECL)
+      if (TYPE_FUNCTION_SCOPE_P (type))
        {
          if (processing_template_decl)
            {
index 78b13c3f7fb503dbac332a4822298523fac1fd3c..44ef9adf02e29eb268eff69a4be28da380364072 100644 (file)
@@ -21983,8 +21983,7 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p)
          decl = finish_member_template_decl (decl);
        }
       else if (friend_p && decl
-              && (TREE_CODE (decl) == TYPE_DECL
-                  || DECL_TYPE_TEMPLATE_P (decl)))
+              && DECL_DECLARES_TYPE_P (decl))
        make_friend_class (current_class_type, TREE_TYPE (decl),
                           /*complain=*/true);
     }
@@ -21998,7 +21997,7 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p)
 
   /* Check the template arguments for a literal operator template.  */
   if (decl
-      && (TREE_CODE (decl) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (decl))
+      && DECL_DECLARES_FUNCTION_P (decl)
       && UDLIT_OPER_P (DECL_NAME (decl)))
     {
       bool ok = true;
@@ -22034,8 +22033,7 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p)
      (Even though there is no definition, there might be default
      arguments that need handling.)  */
   if (member_p && decl
-      && (TREE_CODE (decl) == FUNCTION_DECL
-         || DECL_FUNCTION_TEMPLATE_P (decl)))
+      && DECL_DECLARES_FUNCTION_P (decl))
     vec_safe_push (unparsed_funs_with_definitions, decl);
 }
 
index b5d570313f7f938028ceb01866cea670a9672be2..68da2c80133d3535bd5f34dfd32622136041ced6 100644 (file)
@@ -8786,8 +8786,7 @@ instantiate_class_template_1 (tree type)
                  pushtag (name, newtag, /*tag_scope=*/ts_current);
                }
            }
-         else if (TREE_CODE (t) == FUNCTION_DECL
-                  || DECL_FUNCTION_TEMPLATE_P (t))
+         else if (DECL_DECLARES_FUNCTION_P (t))
            {
              /* Build new TYPE_METHODS.  */
              tree r;
index 19a4c43ff0d3df90383412564968258baa495c84..b64398fac6d0c890eeb5906e186a96e0f2ba1ffe 100644 (file)
@@ -424,8 +424,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
                  do
                    field = fields[i--];
                  while (i >= lo && DECL_NAME (fields[i]) == name);
-                 if (TREE_CODE (field) != TYPE_DECL
-                     && !DECL_TYPE_TEMPLATE_P (field))
+                 if (!DECL_DECLARES_TYPE_P (field))
                    field = NULL_TREE;
                }
              else
@@ -478,9 +477,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
        }
 
       if (DECL_NAME (decl) == name
-         && (!want_type
-             || TREE_CODE (decl) == TYPE_DECL
-             || DECL_TYPE_TEMPLATE_P (decl)))
+         && (!want_type || DECL_DECLARES_TYPE_P (decl)))
        return decl;
     }
   /* Not found.  */
@@ -777,8 +774,7 @@ friend_accessible_p (tree scope, tree decl, tree binfo)
   if (!scope)
     return 0;
 
-  if (TREE_CODE (scope) == FUNCTION_DECL
-      || DECL_FUNCTION_TEMPLATE_P (scope))
+  if (DECL_DECLARES_FUNCTION_P (scope))
     befriending_classes = DECL_BEFRIENDING_CLASSES (scope);
   else if (TYPE_P (scope))
     befriending_classes = CLASSTYPE_BEFRIENDING_CLASSES (scope);
@@ -796,8 +792,7 @@ friend_accessible_p (tree scope, tree decl, tree binfo)
       if (protected_accessible_p (decl, t, binfo))
        return 1;
 
-  if (TREE_CODE (scope) == FUNCTION_DECL
-      || DECL_FUNCTION_TEMPLATE_P (scope))
+  if (DECL_DECLARES_FUNCTION_P (scope))
     {
       /* Perhaps this SCOPE is a member of a class which is a
         friend.  */
@@ -1059,8 +1054,7 @@ lookup_field_r (tree binfo, void *data)
 
   /* If we're looking up a type (as with an elaborated type specifier)
      we ignore all non-types we find.  */
-  if (lfi->want_type && TREE_CODE (nval) != TYPE_DECL
-      && !DECL_TYPE_TEMPLATE_P (nval))
+  if (lfi->want_type && !DECL_DECLARES_TYPE_P (nval))
     {
       if (lfi->name == TYPE_IDENTIFIER (type))
        {
@@ -1509,8 +1503,7 @@ lookup_fnfields_slot_nolazy (tree type, tree name)
 int
 class_method_index_for_fn (tree class_type, tree function)
 {
-  gcc_assert (TREE_CODE (function) == FUNCTION_DECL
-             || DECL_FUNCTION_TEMPLATE_P (function));
+  gcc_assert (DECL_DECLARES_FUNCTION_P (function));
 
   return lookup_fnfields_1 (class_type,
                            DECL_CONSTRUCTOR_P (function) ? ctor_identifier :
index 1821ff4217e9d8a329a673371230529e4b6dc04b..281ba75949aef6940a4b3b8c4cf28c87c35a62fb 100644 (file)
@@ -2741,8 +2741,7 @@ finish_member_declaration (tree decl)
   /* Put functions on the TYPE_METHODS list and everything else on the
      TYPE_FIELDS list.  Note that these are built up in reverse order.
      We reverse them (to obtain declaration order) in finish_struct.  */
-  if (TREE_CODE (decl) == FUNCTION_DECL
-      || DECL_FUNCTION_TEMPLATE_P (decl))
+  if (DECL_DECLARES_FUNCTION_P (decl))
     {
       /* We also need to add this function to the
         CLASSTYPE_METHOD_VEC.  */
index 7e2dcccac6b998052f793349dc33558201870078..ae9267509b649555fd0b63a79aedc8897696a364 100644 (file)
@@ -7963,8 +7963,7 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags,
        && (TREE_CODE (type) != REFERENCE_TYPE
           || TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE))
       || (TREE_CODE (TREE_TYPE (rhs)) == FUNCTION_TYPE
-         && (TREE_CODE (type) != REFERENCE_TYPE
-             || TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE))
+         && !TYPE_REFFN_P (type))
       || TREE_CODE (TREE_TYPE (rhs)) == METHOD_TYPE)
     rhs = decay_conversion (rhs, complain);