cp-tree.h (CANONICAL_TYPE_VARIANT): New macro.
authorMark Mitchell <mmitchell@usa.net>
Tue, 12 May 1998 07:27:15 +0000 (07:27 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 12 May 1998 07:27:15 +0000 (07:27 +0000)
* cp-tree.h (CANONICAL_TYPE_VARIANT): New macro.
* method.c (build_mangled_name): Use it.
(build_decl_overload_real): Likewise.

From-SVN: r19695

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/method.c

index 79a5c44ac84ec961787b66408025ddd86cfe19b3..b58f01e66e5ba44c23c1efaec47be64d2981155d 100644 (file)
@@ -1,5 +1,9 @@
 Tue May 12 07:24:18 1998  Mark Mitchell  <mmitchell@usa.net>
 
+       * cp-tree.h (CANONICAL_TYPE_VARIANT): New macro.
+       * method.c (build_mangled_name): Use it.
+       (build_decl_overload_real): Likewise.
+
        * error.c (dump_simple_decl): New function, broken out from ...
        (dump_decl): Use it.
 
index e76c85b3e8d8a52c74a72c8a7b1161391df4470d..d02c7e74a1c6bd4a708b558621235a40311aa7a6 100644 (file)
@@ -596,6 +596,14 @@ struct lang_type
 #define TYPE_HAS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assignment)
 #define TYPE_HAS_REAL_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assignment)
 
+/* Returns the canonical version of TYPE.  In other words, if TYPE is
+   a typedef, returns the underlying type.  The cv-qualification of
+   the type returned matches the type input; they will always be
+   compatible types.  */
+#define CANONICAL_TYPE_VARIANT(NODE)                                   \
+  (cp_build_type_variant (TYPE_MAIN_VARIANT (NODE),                    \
+                         TYPE_READONLY (NODE), TYPE_VOLATILE (NODE)))
+
 /* Nonzero for _CLASSTYPE means that operator new and delete are defined,
    respectively.  */
 #define TYPE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new)
index ef048f3b900923f6c07ed4027b8de5d415b5c5f8..5ebcac9e65f3585e7beb3b75a0c673f61e6d186a 100644 (file)
@@ -1004,15 +1004,14 @@ build_mangled_name (parmtypes, begin, end)
     {
       if (TYPE_PTRMEMFUNC_P (parmtypes))
         parmtypes = TYPE_PTRMEMFUNC_FN_TYPE (parmtypes);
+      parmtypes = CANONICAL_TYPE_VARIANT (parmtypes);
       process_modifiers (parmtypes);
       process_overload_item (parmtypes, FALSE);
     }
   else  {
     for ( ; parmtypes!=NULL; parmtypes = TREE_CHAIN (parmtypes))
       {
-        parmtype = TREE_VALUE (parmtypes);
-        parmtype = build_type_variant (TYPE_MAIN_VARIANT (parmtype), 
-                      TYPE_READONLY (parmtype), TYPE_VOLATILE (parmtype));
+        parmtype = CANONICAL_TYPE_VARIANT (TREE_VALUE (parmtypes));
         if (flag_do_squangling)       /* squangling style repeats */
           {
             if (parmtype == lasttype) 
@@ -1612,8 +1611,7 @@ build_decl_overload_real (dname, parms, ret_type, tparms, targs,
               tree temp = TREE_VALUE (t);
               TREE_USED (temp) = 0;
               /* clear out the type variant in case we used it */
-              temp = build_type_variant (TYPE_MAIN_VARIANT (temp),
-                    TYPE_READONLY (temp), TYPE_VOLATILE (temp));
+              temp = CANONICAL_TYPE_VARIANT (temp);
               TREE_USED (temp) = 0;
               t = TREE_CHAIN (t);
             }