OSDN Git Service

* cp-tree.h (CALL_DECLARATOR_PARMS): New macro.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Aug 1999 07:20:23 +0000 (07:20 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Aug 1999 07:20:23 +0000 (07:20 +0000)
(CALL_DECLARATOR_QUALS): Likewise.
(CALL_DECARATOR_EXCEPTION_SPEC): Likewise.
* decl.c (grokdeclarator): Adjust to use them.
* decl2.c (grokfield): Likewise.
(reparse_absdcl_as_casts): Likewise.
* lex.c (make_call_declarator): Likewise.
(set_quals_and_spec): Likewise.
* pt.c (tsubst): Likewise.
* tree.c (mapcar): Remove special hack to handle third operand of
a CALL_EXPR.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28733 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/lex.c
gcc/cp/pt.c
gcc/cp/tree.c

index cf9a357..da75c33 100644 (file)
@@ -1,3 +1,17 @@
+1999-08-17  Mark Mitchell  <mark@codesourcery.com>
+
+       * cp-tree.h (CALL_DECLARATOR_PARMS): New macro.
+       (CALL_DECLARATOR_QUALS): Likewise.
+       (CALL_DECARATOR_EXCEPTION_SPEC): Likewise.
+       * decl.c (grokdeclarator): Adjust to use them.
+       * decl2.c (grokfield): Likewise.
+       (reparse_absdcl_as_casts): Likewise.
+       * lex.c (make_call_declarator): Likewise.
+       (set_quals_and_spec): Likewise.
+       * pt.c (tsubst): Likewise.
+       * tree.c (mapcar): Remove special hack to handle third operand of
+       a CALL_EXPR.
+
 1999-08-16  Mark Mitchell  <mark@codesourcery.com>
 
        * cp-tree.h (CAN_HAVE_FULL_LANG_DECL_P): New macro.
index 1de0e31..91ce272 100644 (file)
@@ -2150,6 +2150,18 @@ extern int flag_new_for_scope;
 #define STMT_LINENO(NODE)                      \
   (TREE_COMPLEXITY ((NODE)))
 
+/* The parameters for a call-declarator.  */
+#define CALL_DECLARATOR_PARMS(NODE) \
+  (TREE_PURPOSE (TREE_OPERAND ((NODE), 1)))
+
+/* The cv-qualifiers for a call-declarator.  */
+#define CALL_DECLARATOR_QUALS(NODE) \
+  (TREE_VALUE (TREE_OPERAND ((NODE), 1)))
+
+/* The exception-specification for a call-declarator.  */
+#define CALL_DECLARATOR_EXCEPTION_SPEC(NODE) \
+  (TREE_TYPE ((NODE)))
+
 /* An enumeration of the kind of tags that C++ accepts.  */
 enum tag_types { record_type, class_type, union_type, enum_type };
 
index dee05d3..d5fcbea 100644 (file)
@@ -9002,7 +9002,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
            break;
 
          case CALL_EXPR:
-           if (parmlist_is_exprlist (TREE_OPERAND (decl, 1)))
+           if (parmlist_is_exprlist (CALL_DECLARATOR_PARMS (decl)))
              {
                /* This is actually a variable declaration using
                   constructor syntax.  We need to call start_decl and
@@ -9012,7 +9012,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
                tree attributes, prefix_attributes;
 
                *next = TREE_OPERAND (decl, 0);
-               init = TREE_OPERAND (decl, 1);
+               init = CALL_DECLARATOR_PARMS (decl);
 
                if (attrlist)
                  {
@@ -10023,7 +10023,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
          {
            tree arg_types;
            int funcdecl_p;
-           tree inner_parms = TREE_OPERAND (declarator, 1);
+           tree inner_parms = CALL_DECLARATOR_PARMS (declarator);
            tree inner_decl = TREE_OPERAND (declarator, 0);
 
            /* Declaring a function type.
@@ -10053,10 +10053,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
              inner_decl = dname;
 
            /* Pick up type qualifiers which should be applied to `this'.  */
-           quals = TREE_OPERAND (declarator, 2);
+           quals = CALL_DECLARATOR_QUALS (declarator);
 
            /* Pick up the exception specifications.  */
-           raises = TREE_TYPE (declarator);
+           raises = CALL_DECLARATOR_EXCEPTION_SPEC (declarator);
 
            /* Say it's a definition only for the CALL_EXPR
               closest to the identifier.  */
index e4d2d0e..7e0e23b 100644 (file)
@@ -1590,7 +1590,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
       && TREE_OPERAND (declarator, 0)
       && (TREE_CODE (TREE_OPERAND (declarator, 0)) == IDENTIFIER_NODE
          || TREE_CODE (TREE_OPERAND (declarator, 0)) == SCOPE_REF)
-      && parmlist_is_exprlist (TREE_OPERAND (declarator, 1)))
+      && parmlist_is_exprlist (CALL_DECLARATOR_PARMS (declarator)))
     {
       init = TREE_OPERAND (declarator, 1);
       declarator = TREE_OPERAND (declarator, 0);
@@ -3733,7 +3733,7 @@ reparse_absdcl_as_casts (decl, expr)
   if (TREE_CODE (expr) == CONSTRUCTOR
       && TREE_TYPE (expr) == 0)
     {
-      type = groktypename (TREE_VALUE (TREE_OPERAND (decl, 1)));
+      type = groktypename (TREE_VALUE (CALL_DECLARATOR_PARMS (decl)));
       decl = TREE_OPERAND (decl, 0);
 
       expr = digest_init (type, expr, (tree *) 0);
@@ -3747,7 +3747,7 @@ reparse_absdcl_as_casts (decl, expr)
 
   while (decl)
     {
-      type = groktypename (TREE_VALUE (TREE_OPERAND (decl, 1)));
+      type = groktypename (TREE_VALUE (CALL_DECLARATOR_PARMS (decl)));
       decl = TREE_OPERAND (decl, 0);
       expr = build_c_cast (type, expr);
     }
index f641dc6..acff58f 100644 (file)
@@ -228,8 +228,15 @@ tree
 make_call_declarator (target, parms, cv_qualifiers, exception_specification)
      tree target, parms, cv_qualifiers, exception_specification;
 {
-  target = build_parse_node (CALL_EXPR, target, parms, cv_qualifiers);
-  TREE_TYPE (target) = exception_specification;
+  target = build_parse_node (CALL_EXPR, target, 
+                            /* Both build_parse_node and
+                               decl_tree_cons build on the
+                               temp_decl_obstack.  */
+                            decl_tree_cons (parms, cv_qualifiers, NULL_TREE),
+                            /* The third operand is really RTL.  We
+                               shouldn't put anything there.  */
+                            NULL_TREE);
+  CALL_DECLARATOR_EXCEPTION_SPEC (target) = exception_specification;
   return target;
 }
 
@@ -237,8 +244,8 @@ void
 set_quals_and_spec (call_declarator, cv_qualifiers, exception_specification)
      tree call_declarator, cv_qualifiers, exception_specification;
 {
-  TREE_OPERAND (call_declarator, 2) = cv_qualifiers;
-  TREE_TYPE (call_declarator) = exception_specification;
+  CALL_DECLARATOR_QUALS (call_declarator) = cv_qualifiers;
+  CALL_DECLARATOR_EXCEPTION_SPEC (call_declarator) = exception_specification;
 }
 \f
 /* Build names and nodes for overloaded operators.  */
index 674834b..cf2050a 100644 (file)
@@ -6800,15 +6800,16 @@ tsubst (t, args, complain, in_decl)
       {
        tree e1 = tsubst (TREE_OPERAND (t, 0), args, complain,
                          in_decl);
-       tree e2 = tsubst_call_declarator_parms (TREE_OPERAND (t, 1), args, 
-                                               complain, in_decl);
-       tree e3 = tsubst (TREE_TYPE (t), args, complain, in_decl);
+       tree e2 = (tsubst_call_declarator_parms
+                  (CALL_DECLARATOR_PARMS (t), args, complain, in_decl));
+       tree e3 = tsubst (CALL_DECLARATOR_EXCEPTION_SPEC (t), args,
+                         complain, in_decl);
 
        if (e1 == error_mark_node || e2 == error_mark_node 
            || e3 == error_mark_node)
          return error_mark_node;
 
-       return make_call_declarator (e1, e2, TREE_OPERAND (t, 2), e3);
+       return make_call_declarator (e1, e2, CALL_DECLARATOR_QUALS (t), e3);
       }
 
     case SCOPE_REF:
index b9732b3..61ad108 100644 (file)
@@ -1921,14 +1921,7 @@ mapcar (t, func)
       TREE_TYPE (t) = mapcar (TREE_TYPE (t), func);
       TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
       TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func);
-
-      /* tree.def says that operand two is RTL, but
-        make_call_declarator puts trees in there.  */
-      if (TREE_OPERAND (t, 2)
-         && TREE_CODE (TREE_OPERAND (t, 2)) == TREE_LIST)
-       TREE_OPERAND (t, 2) = mapcar (TREE_OPERAND (t, 2), func);
-      else
-       TREE_OPERAND (t, 2) = NULL_TREE;
+      TREE_OPERAND (t, 2) = NULL_TREE;
       return t;
 
     case SAVE_EXPR: