Ignore:
Timestamp:
Apr 28, 2004, 6:58:06 AM (21 years ago)
Author:
bird
Message:

#1040: Joined the GCC 3.3.3 with the trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gcc/gcc/cp/semantics.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1393 r1394  
    5757static void genrtl_eh_spec_block PARAMS ((tree));
    5858static void genrtl_handler PARAMS ((tree));
    59 static void genrtl_ctor_stmt PARAMS ((tree));
    60 static void genrtl_subobject PARAMS ((tree));
    6159static void genrtl_named_return_value PARAMS ((void));
    6260static void cp_expand_stmt PARAMS ((tree));
     
    8280  } while (0)
    8381
    84 /* Returns non-zero if the current statement is a full expression,
     82/* Returns nonzero if the current statement is a full expression,
    8583   i.e. temporaries created during that statement should be destroyed
    8684   at the end of the statement.  */
     
    10098{
    10199  return (cfun
    102           ? &cfun->language->x_stmt_tree
     100          ? &cfun->language->base.x_stmt_tree
    103101          : &scope_chain->x_stmt_tree);
    104102}
     
    112110     tree node;
    113111{
    114   return (CLASS_TYPE_P (node) && TYPE_LANG_SPECIFIC(node)->anon_aggr);
     112  return ANON_AGGR_TYPE_P (node);
    115113}
    116114
     
    269267{
    270268  RECHAIN_STMTS (if_stmt, THEN_CLAUSE (if_stmt));
    271   last_tree = if_stmt;
    272269  return if_stmt;
    273270}
     
    295292finish_if_stmt ()
    296293{
     294  finish_stmt ();
    297295  do_poplevel ();
    298   finish_stmt ();
    299 }
    300 
    301 void
    302 clear_out_block ()
    303 {
    304   /* If COND wasn't a declaration, clear out the
    305      block we made for it and start a new one here so the
    306      optimization in expand_end_loop will work.  */
    307   if (getdecls () == NULL_TREE)
    308     {
    309       do_poplevel ();
    310       do_pushlevel ();
    311     }
    312296}
    313297
     
    334318{
    335319  cond = maybe_convert_cond (cond);
    336   FINISH_COND (cond, while_stmt, WHILE_COND (while_stmt));
    337   clear_out_block ();
     320  if (processing_template_decl)
     321    /* Don't mess with condition decls in a template.  */
     322    FINISH_COND (cond, while_stmt, WHILE_COND (while_stmt));
     323  else if (getdecls () == NULL_TREE)
     324    /* It was a simple condition; install it.  */
     325    WHILE_COND (while_stmt) = cond;
     326  else
     327    {
     328      /* If there was a declaration in the condition, we can't leave it
     329         there; transform
     330            while (A x = 42) { }
     331         to
     332            while (true) { A x = 42; if (!x) break; }  */
     333      tree if_stmt;
     334      WHILE_COND (while_stmt) = boolean_true_node;
     335
     336      if_stmt = begin_if_stmt ();
     337      cond = build_unary_op (TRUTH_NOT_EXPR, cond, 0);
     338      finish_if_stmt_cond (cond, if_stmt);
     339      finish_break_stmt ();
     340      finish_then_clause (if_stmt);
     341      finish_if_stmt ();
     342    }
    338343}
    339344
     
    420425                  NULL_TREE, NULL_TREE);
    421426  NEW_FOR_SCOPE_P (r) = flag_new_for_scope > 0;
    422   add_stmt (r);
    423427  if (NEW_FOR_SCOPE_P (r))
    424428    {
     
    426430      note_level_for_for ();
    427431    }
     432  add_stmt (r);
    428433
    429434  return r;
     
    451456{
    452457  cond = maybe_convert_cond (cond);
    453   FINISH_COND (cond, for_stmt, FOR_COND (for_stmt));
    454   clear_out_block ();
     458  if (processing_template_decl)
     459    /* Don't mess with condition decls in a template.  */
     460    FINISH_COND (cond, for_stmt, FOR_COND (for_stmt));
     461  else if (getdecls () == NULL_TREE)
     462    /* It was a simple condition; install it.  */
     463    FOR_COND (for_stmt) = cond;
     464  else
     465    {
     466      /* If there was a declaration in the condition, we can't leave it
     467         there; transform
     468            for (; A x = 42;) { }
     469         to
     470            for (;;) { A x = 42; if (!x) break; }  */
     471      tree if_stmt;
     472      FOR_COND (for_stmt) = NULL_TREE;
     473
     474      if_stmt = begin_if_stmt ();
     475      cond = build_unary_op (TRUTH_NOT_EXPR, cond, 0);
     476      finish_if_stmt_cond (cond, if_stmt);
     477      finish_break_stmt ();
     478      finish_then_clause (if_stmt);
     479      finish_if_stmt ();
     480    }
    455481}
    456482
     
    505531{
    506532  tree r;
     533  do_pushlevel ();
    507534  r = build_stmt (SWITCH_STMT, NULL_TREE, NULL_TREE, NULL_TREE);
    508535  add_stmt (r);
    509   do_pushlevel ();
    510536  return r;
    511537}
     
    563589  RECHAIN_STMTS (switch_stmt, SWITCH_BODY (switch_stmt));
    564590  pop_switch ();
     591  finish_stmt ();
    565592  do_poplevel ();
    566   finish_stmt ();
    567 }
    568 
    569 /* Generate the RTL for T, which is a TRY_BLOCK. */
     593}
     594
     595/* Generate the RTL for T, which is a TRY_BLOCK.  */
    570596
    571597static void
     
    604630}
    605631
    606 /* Generate the RTL for T, which is an EH_SPEC_BLOCK. */
     632/* Generate the RTL for T, which is an EH_SPEC_BLOCK.  */
    607633
    608634static void
     
    713739}
    714740
    715 /* Generate the RTL for T, which is a HANDLER. */
     741/* Generate the RTL for T, which is a HANDLER.  */
    716742
    717743static void
     
    782808}
    783809
    784 /* Generate the RTL for T, which is a CTOR_STMT. */
    785 
    786 static void
    787 genrtl_ctor_stmt (t)
    788      tree t;
    789 {
    790   if (CTOR_BEGIN_P (t))
    791     begin_protect_partials ();
    792   else
    793     /* After this point, any exceptions will cause the
    794        destructor to be executed, so we no longer need to worry
    795        about destroying the various subobjects ourselves.  */
    796     end_protect_partials ();
    797 }
    798 
    799 /* Begin a compound-statement.  If HAS_NO_SCOPE is non-zero, the
     810/* Begin a compound-statement.  If HAS_NO_SCOPE is nonzero, the
    800811   compound-statement does not define a scope.  Returns a new
    801812   COMPOUND_STMT if appropriate.  */
     
    836847
    837848/* Finish a compound-statement, which may be given by COMPOUND_STMT.
    838    If HAS_NO_SCOPE is non-zero, the compound statement does not define
     849   If HAS_NO_SCOPE is nonzero, the compound statement does not define
    839850   a scope.  */
    840851
     
    880891  tree r;
    881892  tree t;
    882 
    883   if (TREE_CHAIN (string))
    884     string = combine_strings (string);
    885893
    886894  if (cv_qualifier != NULL_TREE
     
    928936
    929937          constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
    930           operand = TREE_VALUE (output_operands);
     938          operand = TREE_VALUE (t);
    931939
    932940          if (!parse_output_constraint (&constraint,
     
    949957             point.  */
    950958          if (!allows_reg && DECL_P (operand))
    951             mark_addressable (operand);
     959            cxx_mark_addressable (operand);
    952960        }
    953961    }
     
    981989}
    982990
    983 /* Generate the RTL for a SUBOBJECT. */
    984 
    985 static void
    986 genrtl_subobject (cleanup)
    987      tree cleanup;
    988 {
    989   add_partial_entry (cleanup);
    990 }
    991 
    992 /* We're in a constructor, and have just constructed a a subobject of
    993    *THIS.  CLEANUP is code to run if an exception is thrown before the
    994    end of the current function is reached.   */
    995 
    996 void
    997 finish_subobject (cleanup)
    998      tree cleanup;
    999 {
    1000   tree r = build_stmt (SUBOBJECT, cleanup);
    1001   add_stmt (r);
    1002 }
    1003 
    1004991/* When DECL goes out of scope, make sure that CLEANUP is executed.  */
    1005992
     
    1012999}
    10131000
    1014 /* Generate the RTL for a RETURN_INIT. */
     1001/* If the current scope exits with an exception, run CLEANUP.  */
     1002
     1003void
     1004finish_eh_cleanup (cleanup)
     1005     tree cleanup;
     1006{
     1007  tree r = build_stmt (CLEANUP_STMT, NULL_TREE, cleanup);
     1008  CLEANUP_EH_ONLY (r) = 1;
     1009  add_stmt (r);
     1010}
     1011
     1012/* Generate the RTL for a RETURN_INIT.  */
    10151013
    10161014static void
     
    10321030      SET_DECL_RTL (decl, gen_reg_rtx (GET_MODE (DECL_RTL (decl))));
    10331031      if (TREE_ADDRESSABLE (decl))
    1034         put_var_into_stack (decl);
     1032        put_var_into_stack (decl, /*rescan=*/true);
    10351033    }
    10361034
     
    10941092}
    10951093
    1096 /* The INIT_LIST is a list of mem-initializers, in the order they were
    1097    written by the user.  The TREE_VALUE of each node is a list of
    1098    initializers for a particular subobject.  The TREE_PURPOSE is a
    1099    FIELD_DECL is the initializer is for a non-static data member, and
    1100    a class type if the initializer is for a base class.  */
    1101 
    1102 void
    1103 finish_mem_initializers (init_list)
    1104      tree init_list;
    1105 {
    1106   tree member_init_list;
    1107   tree base_init_list;
    1108   tree last_base_warned_about;
    1109   tree next;
    1110   tree init;
    1111 
    1112   member_init_list = NULL_TREE;
    1113   base_init_list = NULL_TREE;
    1114   last_base_warned_about = NULL_TREE;
    1115 
    1116   for (init = init_list; init; init = next)
    1117     {
    1118       next = TREE_CHAIN (init);
    1119       if (TREE_CODE (TREE_PURPOSE (init)) == FIELD_DECL)
    1120         {
    1121           TREE_CHAIN (init) = member_init_list;
    1122           member_init_list = init;
    1123 
    1124           /* We're running through the initializers from right to left
    1125              as we process them here.  So, if we see a data member
    1126              initializer after we see a base initializer, that
    1127              actually means that the base initializer preceded the
    1128              data member initializer.  */
    1129           if (warn_reorder && last_base_warned_about != base_init_list)
    1130             {
    1131               tree base;
    1132 
    1133               for (base = base_init_list;
    1134                    base != last_base_warned_about;
    1135                    base = TREE_CHAIN (base))
    1136                 {
    1137                   warning ("base initializer for `%T'",
    1138                               TREE_PURPOSE (base));
    1139                   warning ("   will be re-ordered to precede member initializations");
    1140                 }
    1141 
    1142               last_base_warned_about = base_init_list;
    1143             }
    1144         }
    1145       else
    1146         {
    1147           TREE_CHAIN (init) = base_init_list;
    1148           base_init_list = init;
    1149         }
    1150     }
     1094/* Begin processing a mem-initializer-list.  */
     1095
     1096void
     1097begin_mem_initializers ()
     1098{
     1099  if (! DECL_CONSTRUCTOR_P (current_function_decl))
     1100    error ("only constructors take base initializers");
     1101}
     1102
     1103/* The MEM_INITS is a list of mem-initializers, in reverse of the
     1104   order they were written by the user.  Each node is as for
     1105   emit_mem_initializers.  */
     1106
     1107void
     1108finish_mem_initializers (tree mem_inits)
     1109{
     1110  /* Reorder the MEM_INITS so that they are in the order they appeared
     1111     in the source program.  */
     1112  mem_inits = nreverse (mem_inits);
    11511113
    11521114  if (processing_template_decl)
    1153     add_stmt (build_min_nt (CTOR_INITIALIZER,
    1154                             member_init_list, base_init_list));
     1115    add_stmt (build_min_nt (CTOR_INITIALIZER, mem_inits));
    11551116  else
    1156     emit_base_init (member_init_list, base_init_list);
     1117    emit_mem_initializers (mem_inits);
    11571118}
    11581119
     
    11621123current_scope_stmt_stack ()
    11631124{
    1164   return &cfun->language->x_scope_stmt_stack;
     1125  return &cfun->language->base.x_scope_stmt_stack;
    11651126}
    11661127
     
    11721133{
    11731134  if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr))))
    1174     /* This inhibits warnings in truthvalue_conversion.  */
     1135    /* This inhibits warnings in c_common_truthvalue_conversion.  */
    11751136    C_SET_EXP_ORIGINAL_CODE (expr, ERROR_MARK);
    11761137
     
    12641225}
    12651226
    1266 /* Finish a call to FN with ARGS.  Returns a representation of the
    1267    call.  */
     1227/* Generate an expression for `FN (ARGS)'.
     1228
     1229   If DISALLOW_VIRTUAL is true, the call to FN will be not generated
     1230   as a virtual call, even if FN is virtual.  (This flag is set when
     1231   encountering an expression where the function name is explicitly
     1232   qualified.  For example a call to `X::f' never generates a virtual
     1233   call.)
     1234
     1235   Returns code for the call.  */
    12681236
    12691237tree
    1270 finish_call_expr (fn, args, koenig)
    1271      tree fn;
    1272      tree args;
    1273      int koenig;
    1274 {
    1275   tree result;
    1276 
    1277   if (koenig)
    1278     {
    1279       if (TREE_CODE (fn) == BIT_NOT_EXPR)
    1280         fn = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND (fn, 0));
    1281       else if (TREE_CODE (fn) != TEMPLATE_ID_EXPR)
    1282         fn = do_identifier (fn, 2, args);
    1283     }
    1284   result = build_x_function_call (fn, args, current_class_ref);
    1285 
    1286   if (TREE_CODE (result) == CALL_EXPR
    1287       && (! TREE_TYPE (result)
    1288           || TREE_CODE (TREE_TYPE (result)) != VOID_TYPE))
    1289     result = require_complete_type (result);
    1290 
    1291   return result;
     1238finish_call_expr (tree fn, tree args, bool disallow_virtual)
     1239{
     1240  if (fn == error_mark_node || args == error_mark_node)
     1241    return error_mark_node;
     1242
     1243  if (processing_template_decl)
     1244    return build_nt (CALL_EXPR, fn, args, NULL_TREE);
     1245
     1246  /* ARGS should be a list of arguments.  */
     1247  my_friendly_assert (!args || TREE_CODE (args) == TREE_LIST,
     1248                      20020712);
     1249
     1250  if (BASELINK_P (fn))
     1251    {
     1252      tree object;
     1253
     1254      /* A call to a member function.  From [over.call.func]:
     1255
     1256           If the keyword this is in scope and refers to the class of
     1257           that member function, or a derived class thereof, then the
     1258           function call is transformed into a qualified function call
     1259           using (*this) as the postfix-expression to the left of the
     1260           . operator.... [Otherwise] a contrived object of type T
     1261           becomes the implied object argument. 
     1262
     1263        This paragraph is unclear about this situation:
     1264
     1265          struct A { void f(); };
     1266          struct B : public A {};
     1267          struct C : public A { void g() { B::f(); }};
     1268
     1269        In particular, for `B::f', this paragraph does not make clear
     1270        whether "the class of that member function" refers to `A' or
     1271        to `B'.  We believe it refers to `B'.  */
     1272      if (current_class_type
     1273          && DERIVED_FROM_P (BINFO_TYPE (BASELINK_ACCESS_BINFO (fn)),
     1274                             current_class_type)
     1275          && current_class_ref)
     1276        object = maybe_dummy_object (BINFO_TYPE (BASELINK_ACCESS_BINFO (fn)),
     1277                                     NULL);
     1278      else
     1279        {
     1280          tree representative_fn;
     1281
     1282          representative_fn = BASELINK_FUNCTIONS (fn);
     1283          if (TREE_CODE (representative_fn) == TEMPLATE_ID_EXPR)
     1284            representative_fn = TREE_OPERAND (representative_fn, 0);
     1285          representative_fn = get_first_fn (representative_fn);
     1286          object = build_dummy_object (DECL_CONTEXT (representative_fn));
     1287        }
     1288
     1289      return build_new_method_call (object, fn, args, NULL_TREE,
     1290                                    (disallow_virtual
     1291                                     ? LOOKUP_NONVIRTUAL : 0));
     1292    }
     1293  else if (is_overloaded_fn (fn))
     1294    /* A call to a namespace-scope function.  */
     1295    return build_new_function_call (fn, args);
     1296  else if (CLASS_TYPE_P (TREE_TYPE (fn)))
     1297    {
     1298      /* If the "function" is really an object of class type, it might
     1299         have an overloaded `operator ()'.  */
     1300      tree result;
     1301      result = build_opfncall (CALL_EXPR, LOOKUP_NORMAL, fn, args, NULL_TREE);
     1302      if (result)
     1303        return result;
     1304    }
     1305
     1306  /* A call where the function is unknown.  */
     1307  return build_function_call (fn, args);
    12921308}
    12931309
     
    13491365     tree args;
    13501366{
    1351 #if 0
    1352   /* This is a future direction of this code, but because
    1353      build_x_function_call cannot always undo what is done in
    1354      build_component_ref entirely yet, we cannot do this.  */
    1355 
    1356   tree real_fn = build_component_ref (object, fn, NULL_TREE, 1);
    1357   return finish_call_expr (real_fn, args);
    1358 #else
    13591367  if (DECL_DECLARES_TYPE_P (fn))
    13601368    {
     
    13751383        }
    13761384    }
    1377 
    1378   return build_method_call (object, fn, args, NULL_TREE, LOOKUP_NORMAL);
    1379 #endif
     1385 
     1386  if (processing_template_decl || name_p (fn))
     1387    return build_method_call (object, fn, args, NULL_TREE, LOOKUP_NORMAL);
     1388  else
     1389    return build_new_method_call (object, fn, args, NULL_TREE, LOOKUP_NORMAL);
    13801390}
    13811391
     
    14161426
    14171427  return cp_convert (void_type_node, object);
    1418 }
    1419 
    1420 /* Finish a call to a globally qualified member function FN using
    1421    ARGS.  Returns an expression for the call.  */
    1422 
    1423 tree
    1424 finish_qualified_call_expr (fn, args)
    1425      tree fn;
    1426      tree args;
    1427 {
    1428   if (processing_template_decl)
    1429     return build_min_nt (CALL_EXPR, fn, args, NULL_TREE);
    1430   else
    1431     return build_member_call (TREE_OPERAND (fn, 0),
    1432                               TREE_OPERAND (fn, 1),
    1433                               args);
    14341428}
    14351429
     
    14681462}
    14691463
     1464/* Return the declaration for the function-name variable indicated by
     1465   ID.  */
     1466
     1467tree
     1468finish_fname (tree id)
     1469{
     1470  tree decl;
     1471 
     1472  decl = fname_decl (C_RID_CODE (id), id);
     1473  if (processing_template_decl)
     1474    decl = build_min_nt (LOOKUP_EXPR, DECL_NAME (decl));
     1475  return decl;
     1476}
     1477
    14701478static tree current_type_lookups;
    14711479
     
    15251533}
    15261534
    1527 /* Begin a function definition declared with DECL_SPECS and
    1528    DECLARATOR.  Returns non-zero if the function-declaration is
    1529    legal.  */
     1535/* Begin a function definition declared with DECL_SPECS, ATTRIBUTES,
     1536   and DECLARATOR.  Returns nonzero if the function-declaration is
     1537   valid.  */
    15301538
    15311539int
    1532 begin_function_definition (decl_specs, declarator)
     1540begin_function_definition (decl_specs, attributes, declarator)
    15331541     tree decl_specs;
     1542     tree attributes;
    15341543     tree declarator;
    15351544{
    1536   tree specs;
    1537   tree attrs;
    1538 
    1539   split_specs_attrs (decl_specs, &specs, &attrs);
    1540   if (!start_function (specs, declarator, attrs, SF_DEFAULT))
     1545  if (!start_function (decl_specs, declarator, attributes, SF_DEFAULT))
    15411546    return 0;
    15421547
     
    15901595    pop_namespace ();
    15911596
    1592   /* Do file scope __FUNCTION__ et al. */
     1597  /* Do file scope __FUNCTION__ et al.  */
    15931598  finish_fname_decls ();
    15941599 
     
    16331638}
    16341639
     1640/* ARGUMENT is the default-argument value for a template template
     1641   parameter.  If ARGUMENT is invalid, issue error messages and return
     1642   the ERROR_MARK_NODE.  Otherwise, ARGUMENT itself is returned.  */
     1643
     1644tree
     1645check_template_template_default_arg (tree argument)
     1646{
     1647  if (TREE_CODE (argument) != TEMPLATE_DECL
     1648      && TREE_CODE (argument) != TEMPLATE_TEMPLATE_PARM
     1649      && TREE_CODE (argument) != TYPE_DECL
     1650      && TREE_CODE (argument) != UNBOUND_CLASS_TEMPLATE)
     1651    {
     1652      error ("invalid default template argument");
     1653      return error_mark_node;
     1654    }
     1655
     1656  return argument;
     1657}
     1658
    16351659/* Finish a parameter list, indicated by PARMS.  If ELLIPSIS is
    1636    non-zero, the parameter list was terminated by a `...'.  */
     1660   nonzero, the parameter list was terminated by a `...'.  */
    16371661
    16381662tree
     
    16621686    return error_mark_node;
    16631687
    1664   /* Check the bases are accessible. */
     1688  /* Check the bases are accessible.  */
    16651689  decl_type_access_control (TYPE_NAME (t));
    16661690  reset_type_access_control ();
     
    17321756          TYPE_FIELDS (t) = NULL_TREE;
    17331757          TYPE_METHODS (t) = NULL_TREE;
    1734           CLASSTYPE_TAGS (t) = NULL_TREE;
     1758          CLASSTYPE_DECL_LIST (t) = NULL_TREE;
     1759          CLASSTYPE_NESTED_UDTS (t) = NULL;
    17351760          CLASSTYPE_VBASECLASSES (t) = NULL_TREE;
    17361761          TYPE_SIZE (t) = NULL_TREE;
     
    18251850      TREE_CHAIN (decl) = TYPE_METHODS (current_class_type);
    18261851      TYPE_METHODS (current_class_type) = decl;
    1827     }
    1828   else
     1852
     1853      maybe_add_class_template_decl_list (current_class_type, decl,
     1854                                          /*friend_p=*/0);
     1855    }
     1856  /* Enter the DECL into the scope of the class.  */
     1857  else if (TREE_CODE (decl) == USING_DECL || pushdecl_class_level (decl))
    18291858    {
    18301859      /* All TYPE_DECLs go at the end of TYPE_FIELDS.  Ordinary fields
     
    18371866           s.E = 3;
    18381867
    1839          is legal.  In addition, the FIELD_DECLs must be maintained in
     1868         is valid.  In addition, the FIELD_DECLs must be maintained in
    18401869         declaration order so that class layout works as expected.
    18411870         However, we don't need that order until class layout, so we
     
    18541883        }
    18551884
    1856       /* Enter the DECL into the scope of the class.  */
    1857       if (TREE_CODE (decl) != USING_DECL)
    1858         pushdecl_class_level (decl);
     1885      maybe_add_class_template_decl_list (current_class_type, decl,
     1886                                          /*friend_p=*/0);
    18591887    }
    18601888}
     
    19111939  if (current_scope () == current_function_decl)
    19121940    do_pending_inlines ();
    1913 }
    1914 
    1915 /* Finish processing the inline function definitions cached during the
    1916    processing of a class definition.  */
    1917 
    1918 void
    1919 finish_inline_definitions ()
    1920 {
    1921   if (current_class_type == NULL_TREE)
    1922     clear_inline_text_obstack ();
    19231941}
    19241942
     
    19701988/* Finish processing a template-id (which names a type) of the form
    19711989   NAME < ARGS >.  Return the TYPE_DECL for the type named by the
    1972    template-id.  If ENTERING_SCOPE is non-zero we are about to enter
     1990   template-id.  If ENTERING_SCOPE is nonzero we are about to enter
    19731991   the scope of template-id indicated.  */
    19741992
     
    20312049  tree result;
    20322050
    2033   if (! is_aggr_type (base_class, 1))
     2051  if (base_class == error_mark_node)
     2052    {
     2053      error ("invalid base-class specification");
     2054      result = NULL_TREE;
     2055    }
     2056  else if (! is_aggr_type (base_class, 1))
    20342057    result = NULL_TREE;
    20352058  else
     
    20592082
    20602083     We don't just use PROCESSING_TEMPLATE_DECL for the first
    2061      condition since that would disallow the perfectly legal code,
     2084     condition since that would disallow the perfectly valid code,
    20622085     like `template <class T> struct S { int i, j; };'.  */
    2063   tree scope = current_scope ();
    2064 
    2065   if (scope && TREE_CODE (scope) == FUNCTION_DECL)
     2086  if (at_function_scope_p ())
    20662087    /* It's OK to write `template <class T> void f() { int i, j;}'.  */
    20672088    return;
     
    21132134    return build_min_nt (SIZEOF_EXPR, t);
    21142135
    2115   return TYPE_P (t) ? c_sizeof (t) : expr_sizeof (t);
     2136  return TYPE_P (t) ? cxx_sizeof (t) : expr_sizeof (t);
    21162137}
    21172138
     
    21262147    return build_min_nt (ALIGNOF_EXPR, t);
    21272148
    2128   return TYPE_P (t) ? c_alignof (complete_type (t)) : c_alignof_expr (t);
     2149  return TYPE_P (t) ? cxx_alignof (t) : c_alignof_expr (t);
    21292150}
    21302151
     
    21382159  switch (TREE_CODE (t))
    21392160    {
    2140     case CTOR_STMT:
    2141       genrtl_ctor_stmt (t);
    2142       break;
    2143 
    21442161    case TRY_BLOCK:
    21452162      genrtl_try_block (t);
     
    21522169    case HANDLER:
    21532170      genrtl_handler (t);
    2154       break;
    2155 
    2156     case SUBOBJECT:
    2157       genrtl_subobject (SUBOBJECT_CLEANUP (t));
    21582171      break;
    21592172
     
    22122225      /* Replace the first argument with the address of the third
    22132226         argument to the AGGR_INIT_EXPR.  */
    2214       mark_addressable (slot);
     2227      cxx_mark_addressable (slot);
    22152228      args = tree_cons (NULL_TREE,
    22162229                        build1 (ADDR_EXPR,
     
    22722285  if (DECL_VIRTUAL_P (fn))
    22732286    {
    2274       tree binfo;
    2275       tree v;
    2276 
    2277       for (binfo = TYPE_BINFO (DECL_CONTEXT (fn));
    2278            binfo;
    2279            binfo = TREE_CHAIN (binfo))
    2280         for (v = BINFO_VIRTUALS (binfo); v; v = TREE_CHAIN (v))
    2281           if (BV_FN (v) == fn
    2282               && (!integer_zerop (BV_DELTA (v))
    2283                   || BV_USE_VCALL_INDEX_P (v)))
    2284             {
    2285               tree thunk;
    2286               tree vcall_index;
    2287 
    2288               if (BV_USE_VCALL_INDEX_P (v))
    2289                 {
    2290                   vcall_index = BV_VCALL_INDEX (v);
    2291                   my_friendly_assert (vcall_index != NULL_TREE, 20000621);
    2292                 }
    2293               else
    2294                 vcall_index = NULL_TREE;
    2295 
    2296               thunk = make_thunk (build1 (ADDR_EXPR,
    2297                                           vfunc_ptr_type_node,
    2298                                           fn),
    2299                                   BV_DELTA (v),
    2300                                   vcall_index);
    2301               use_thunk (thunk, /*emit_p=*/1);
    2302             }
     2287      tree thunk;
     2288      for (thunk = DECL_THUNKS (fn); thunk; thunk = TREE_CHAIN (thunk))
     2289        use_thunk (thunk, /*emit_p=*/1);
    23032290    }
    23042291}
     
    23122299  int saved_lineno;
    23132300  const char *saved_input_filename;
     2301  tree saved_function;
    23142302
    23152303  /* When the parser calls us after finishing the body of a template
     
    23892377    return;
    23902378
    2391   timevar_push (TV_INTEGRATION);
    2392 
    2393   /* Optimize the body of the function before expanding it.  */
    2394   optimize_function (fn);
    2395 
    2396   timevar_pop (TV_INTEGRATION);
    2397   timevar_push (TV_EXPAND);
    2398 
    23992379  /* Save the current file name and line number.  When we expand the
    24002380     body of the function, we'll set LINENO and INPUT_FILENAME so that
     
    24022382  saved_lineno = lineno;
    24032383  saved_input_filename = input_filename;
     2384  saved_function = current_function_decl;
    24042385  lineno = DECL_SOURCE_LINE (fn);
    24052386  input_filename = DECL_SOURCE_FILE (fn);
     2387  current_function_decl = fn;
     2388
     2389  timevar_push (TV_INTEGRATION);
     2390
     2391  /* Optimize the body of the function before expanding it.  */
     2392  optimize_function (fn);
     2393
     2394  timevar_pop (TV_INTEGRATION);
     2395  timevar_push (TV_EXPAND);
    24062396
    24072397  genrtl_start_function (fn);
     
    24362426
    24372427  /* And restore the current source position.  */
     2428  current_function_decl = saved_function;
    24382429  lineno = saved_lineno;
    24392430  input_filename = saved_input_filename;
     
    24632454    *walk_subtrees = 0;
    24642455  else if (TREE_CODE (*tp) == RETURN_STMT)
    2465     RETURN_EXPR (*tp) = NULL_TREE;
     2456    RETURN_STMT_EXPR (*tp) = NULL_TREE;
    24662457  else if (TREE_CODE (*tp) == CLEANUP_STMT
    24672458           && CLEANUP_DECL (*tp) == nrv)
     
    25172508         cp_copy_res_decl_for_inlining.  */
    25182509      if (! DECL_INLINE (fn))
    2519         {
    2520           free (DECL_SAVED_FUNCTION_DATA (fn));
    2521           DECL_SAVED_FUNCTION_DATA (fn) = NULL;
    2522         }
     2510        DECL_SAVED_FUNCTION_DATA (fn) = NULL;
    25232511    }
    25242512
Note: See TracChangeset for help on using the changeset viewer.