]> gcc.gnu.org Git - gcc.git/commitdiff
error.c (dump_simple_decl): Use DECL_CLASS_SCOPE_P and/or DECL_NAMESPACE_SCOPE_P.
authorJason Merrill <jason@yorick.cygnus.com>
Tue, 12 May 1998 21:42:34 +0000 (21:42 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 12 May 1998 21:42:34 +0000 (17:42 -0400)
* error.c (dump_simple_decl): Use DECL_CLASS_SCOPE_P and/or
DECL_NAMESPACE_SCOPE_P.
(lang_decl_name): Likewise.
* pt.c (tsubst_friend_function, tsubst): Likewise.
* decl.c (pushdecl, redeclaration_error_message, start_decl,
cp_finish_decl, start_function): Likewise.
* class.c (finish_struct_1): Likewise.
* call.c (build_over_call): Likewise.
(compare_ics): Use DERIVED_FROM_P.

From-SVN: r19705

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/error.c
gcc/cp/pt.c

index b58f01e66e5ba44c23c1efaec47be64d2981155d..a2742a5414e366183e42ac8b9a218181f3cfed83 100644 (file)
@@ -1,3 +1,15 @@
+Tue May 12 21:37:49 1998  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * error.c (dump_simple_decl): Use DECL_CLASS_SCOPE_P and/or
+       DECL_NAMESPACE_SCOPE_P.
+       (lang_decl_name): Likewise.
+       * pt.c (tsubst_friend_function, tsubst): Likewise.
+       * decl.c (pushdecl, redeclaration_error_message, start_decl, 
+       cp_finish_decl, start_function): Likewise.
+       * class.c (finish_struct_1): Likewise.
+       * call.c (build_over_call): Likewise.
+       (compare_ics): Use DERIVED_FROM_P.
+
 Tue May 12 07:24:18 1998  Mark Mitchell  <mmitchell@usa.net>
 
        * cp-tree.h (CANONICAL_TYPE_VARIANT): New macro.
@@ -11,12 +23,8 @@ Mon May 11 11:38:07 1998  Mark Mitchell  <mmitchell@usa.net>
 
        * ptree.c (lang_print_xnode): Add missing `break'.
 
-Mon May 11 10:09:16 1998  Mark Mitchell  <mmitchell@usa.net>
-
        * pt.c (tsubst): Remove duplicate check for IDENTIFIER_NODE.
 
-Mon May 11 07:16:30 1998  Mark Mitchell  <mmitchell@usa.net>
-
        * call.c (add_template_candidate): Adjust for changes to
        fn_type_unification. 
        (add_template_candidate_real): Likewise.
@@ -68,8 +76,6 @@ Mon May 11 07:16:30 1998  Mark Mitchell  <mmitchell@usa.net>
        * parse.h: Regenerated.
        * parse.c: Really regenerated.
        
-Mon May 11 00:03:34 1998  Mark Mitchell  <mmitchell@usa.net>
-
        * cp-tree.h (finish_unary_op_expr): New function.
        (finish_id_expr): Likewise.
        (begin_new_placement): Likewise.
@@ -108,8 +114,8 @@ Sun May 10 23:43:13 1998  Mark Mitchell  <mmitchell@usa.net>
 
 Sun May 10 22:53:56 1998  Jason Merrill  <jason@yorick.cygnus.com>
 
-       * cp-tree.h (DECL_NAMESPACE_SCOPE): New macro.
-       (DECL_CLASS_SCOPE): Likewise.
+       * cp-tree.h (DECL_NAMESPACE_SCOPE_P): New macro.
+       (DECL_CLASS_SCOPE_P): Likewise.
 
 Sun May 10 22:48:22 1998  H.J. Lu  (hjl@gnu.org)
 
index 5eafd87289a4e452277479c39b371057415fdb05..fa02408ff688f00dadc51bf33f6d08e0eee98e9c 100644 (file)
@@ -3294,14 +3294,12 @@ build_over_call (cand, args, flags)
 
             we must be careful to do name lookup in the scope of
             S<T>, rather than in the current class.  */
-         if (DECL_REAL_CONTEXT (fn) 
-             && TREE_CODE (DECL_REAL_CONTEXT (fn)) != NAMESPACE_DECL)
+         if (DECL_CLASS_SCOPE_P (fn))
            pushclass (DECL_REAL_CONTEXT (fn), 2);
 
          arg = tsubst_expr (arg, DECL_TI_ARGS (fn), NULL_TREE);
 
-         if (DECL_REAL_CONTEXT (fn)
-             && TREE_CODE (DECL_CONTEXT (fn)) != NAMESPACE_DECL)
+         if (DECL_CLASS_SCOPE_P (fn))
            popclass (0);
        }
       converted_args = expr_tree_cons
@@ -3926,10 +3924,10 @@ compare_ics (ics1, ics2)
            return -1;
        }
       else if (TREE_CODE (to2) == VOID_TYPE && IS_AGGR_TYPE (to1)
-              && get_base_distance (to1, from1, 0, 0) != -1)
+              && DERIVED_FROM_P (to1, from1))
        return 1;
       else if (TREE_CODE (to1) == VOID_TYPE && IS_AGGR_TYPE (to2)
-              && get_base_distance (to2, from2, 0, 0) != -1)
+              && DERIVED_FROM_P (to2, from2))
        return -1;
 
       if (! (IS_AGGR_TYPE (to1) && IS_AGGR_TYPE (to2)))
index 17cfe2bf9b4a64e537eb3c60f392a6d9c5418718..a07563febaf0b8adbdf9278eee2e5abab527e18e 100644 (file)
@@ -4191,8 +4191,7 @@ finish_struct_1 (t, warn_anon)
     {
       /* Be smarter about nested classes here.  If a type is nested,
         only output it if we would output the enclosing type.  */
-      if (DECL_CONTEXT (TYPE_MAIN_DECL (t))
-         && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (TYPE_MAIN_DECL (t)))) == 't')
+      if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (t)))
        DECL_IGNORED_P (TYPE_MAIN_DECL (t)) = TREE_ASM_WRITTEN (TYPE_MAIN_DECL (t));
     }
 #endif
index d02c7e74a1c6bd4a708b558621235a40311aa7a6..3461bdb5fbfc6575d0c338bfc69ab194b86b9756 100644 (file)
@@ -1106,12 +1106,12 @@ struct lang_decl
    ? DECL_CLASS_CONTEXT (NODE) : DECL_CONTEXT (NODE))
 
 /* 1 iff NODE has namespace scope, including the global namespace.  */
-#define DECL_NAMESPACE_SCOPE(NODE) \
+#define DECL_NAMESPACE_SCOPE_P(NODE) \
   (DECL_CONTEXT (NODE) == NULL_TREE \
    || TREE_CODE (DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
 
 /* 1 iff NODE is a class member.  */
-#define DECL_CLASS_SCOPE(NODE) \
+#define DECL_CLASS_SCOPE_P(NODE) \
   (DECL_CONTEXT (NODE) \
    && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't')
 
index d0afbc2791eb6f22965630c04f828b0d57fc9e5a..4650bf4fce25e12e3df57ceb4ff42b71ecaef609 100644 (file)
@@ -3257,8 +3257,7 @@ pushdecl (x)
        name = TREE_OPERAND (name, 0);
       
       /* Namespace-scoped variables are not found in the current level. */
-      if (TREE_CODE (x) == VAR_DECL
-         && TREE_CODE (DECL_CONTEXT (x)) == NAMESPACE_DECL)
+      if (TREE_CODE (x) == VAR_DECL && DECL_NAMESPACE_SCOPE_P (x))
        t = namespace_binding (name, DECL_CONTEXT (x));
       else
        t = lookup_name_current_level (name);
@@ -3367,8 +3366,7 @@ pushdecl (x)
          if (t != x || DECL_LANGUAGE (x) == lang_c)
            return t;
        }
-      else if (DECL_FUNCTION_TEMPLATE_P (x) && DECL_CONTEXT (x)
-              && TREE_CODE (DECL_CONTEXT (x)) == NAMESPACE_DECL)
+      else if (DECL_FUNCTION_TEMPLATE_P (x) && DECL_NAMESPACE_SCOPE_P (x))
        return push_overloaded_decl (x, 0);
 
       /* If declaring a type as a typedef, copy the type (unless we're
@@ -3995,7 +3993,7 @@ redeclaration_error_message (newdecl, olddecl)
 
       /* If both functions come from different namespaces, this is not
         a redeclaration - this is a conflict with a used function. */
-      if (TREE_CODE (DECL_CONTEXT (olddecl)) == NAMESPACE_DECL
+      if (DECL_NAMESPACE_SCOPE_P (olddecl)
          && DECL_CONTEXT (olddecl) != DECL_CONTEXT (newdecl))
        return "`%D' conflicts with used function";
 
@@ -6232,10 +6230,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
      comes from another scope, e.g. a static member variable.
      TEM may equal DECL or it may be a previous decl of the same name.  */
   
-  if ((TREE_CODE (decl) != PARM_DECL && DECL_CONTEXT (decl) != NULL_TREE 
-       /* Definitions of namespace members outside their namespace are
-         possible. */
-       && TREE_CODE (DECL_CONTEXT (decl)) != NAMESPACE_DECL)
+  if ((TREE_CODE (decl) != PARM_DECL && DECL_CONTEXT (decl) != NULL_TREE)
       || (TREE_CODE (decl) == TEMPLATE_DECL && !namespace_bindings_p ())
       || TREE_CODE (type) == LANG_TYPE
       /* The declaration of template specializations does not affect
@@ -6841,8 +6836,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
        /* Let debugger know it should output info for this type.  */
        note_debug_info_needed (ttype);
 
-      if (TREE_STATIC (decl) && DECL_CONTEXT (decl)
-         && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
+      if (TREE_STATIC (decl) && DECL_CLASS_SCOPE_P (decl))
        note_debug_info_needed (DECL_CONTEXT (decl));
 
       if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl))
@@ -11636,8 +11630,7 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
 
       if (! DECL_ARGUMENTS (decl1)
          && !DECL_STATIC_FUNCTION_P (decl1)
-         && DECL_CONTEXT (decl1)
-         && TREE_CODE (DECL_CONTEXT (decl1)) != NAMESPACE_DECL
+         && DECL_CLASS_SCOPE_P (decl1)
          && TYPE_IDENTIFIER (DECL_CONTEXT (decl1))
          && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (DECL_CONTEXT (decl1))))
        {
index 1f068da56cc763a28b079c95d58133d52a383af7..61739211bb5885443342274e7cd12a6b7f96ab77 100644 (file)
@@ -658,9 +658,7 @@ dump_simple_decl (t, type, v)
       OB_PUTC (' ');
       dump_readonly_or_volatile (t, after);
     }
-  /* DECL_CLASS_CONTEXT isn't being set in some cases.  Hmm...  */
-  if (DECL_CONTEXT (t)
-      && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (t))) == 't')
+  if (DECL_CLASS_SCOPE_P (t))
     {
       dump_type (DECL_CONTEXT (t), 0);
       OB_PUTC2 (':', ':');
@@ -1748,8 +1746,7 @@ lang_decl_name (decl, v)
 
   OB_INIT ();
 
-  if (v == 1 && DECL_CONTEXT (decl)
-      && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
+  if (v == 1 && DECL_CLASS_SCOPE_P (decl))
     {
       tree cname;
       if (TREE_CODE (decl) == FUNCTION_DECL)
index d6764b00a15690a0eddf52f538ac709aa3effa5a..5b860abed4a44fae2469039e1cf9964a59662e78 100644 (file)
@@ -3467,8 +3467,7 @@ tsubst_friend_function (decl, args)
   if (TREE_CODE (decl) == TEMPLATE_DECL)
     DECL_USE_TEMPLATE (DECL_TEMPLATE_RESULT (new_friend)) = 0;
   
-  if (!DECL_CONTEXT (new_friend) 
-      || TREE_CODE (DECL_CONTEXT (new_friend)) == NAMESPACE_DECL)
+  if (DECL_NAMESPACE_SCOPE_P (new_friend))
     {
       if (TREE_CODE (new_friend) == TEMPLATE_DECL)
        /* This declaration is a `primary' template.  */
@@ -4395,8 +4394,7 @@ tsubst (t, args, in_decl)
        tree tmpl = NULL_TREE;
        int member;
 
-       if (DECL_CONTEXT (t) != NULL_TREE
-           && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (t))) == 't')
+       if (DECL_CLASS_SCOPE_P (t))
          {
            if (DECL_NAME (t) == constructor_name (DECL_CONTEXT (t)))
              member = 2;
This page took 0.085629 seconds and 5 git commands to generate.