init.c (52284) | init.c (60967) |
---|---|
1/* Handle initialization things in C++. 2 Copyright (C) 1987, 89, 92-98, 1999 Free Software Foundation, Inc. 3 Contributed by Michael Tiemann (tiemann@cygnus.com) 4 5This file is part of GNU CC. 6 7GNU CC is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by --- 45 unchanged lines hidden (view full) --- 54static tree build_builtin_delete_call PROTO((tree)); 55static int member_init_ok_or_else PROTO((tree, tree, const char *)); 56static void expand_virtual_init PROTO((tree, tree)); 57static tree sort_member_init PROTO((tree)); 58static tree initializing_context PROTO((tree)); 59static void expand_vec_init_try_block PROTO((tree)); 60static void expand_vec_init_catch_clause PROTO((tree, tree, tree, tree)); 61static tree build_java_class_ref PROTO((tree)); | 1/* Handle initialization things in C++. 2 Copyright (C) 1987, 89, 92-98, 1999 Free Software Foundation, Inc. 3 Contributed by Michael Tiemann (tiemann@cygnus.com) 4 5This file is part of GNU CC. 6 7GNU CC is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by --- 45 unchanged lines hidden (view full) --- 54static tree build_builtin_delete_call PROTO((tree)); 55static int member_init_ok_or_else PROTO((tree, tree, const char *)); 56static void expand_virtual_init PROTO((tree, tree)); 57static tree sort_member_init PROTO((tree)); 58static tree initializing_context PROTO((tree)); 59static void expand_vec_init_try_block PROTO((tree)); 60static void expand_vec_init_catch_clause PROTO((tree, tree, tree, tree)); 61static tree build_java_class_ref PROTO((tree)); |
62static void expand_cleanup_for_base PROTO((tree, tree)); | 62static void expand_cleanup_for_base PROTO((tree, tree, tree)); 63static int pvbasecount PROTO((tree, int)); |
63 64/* Cache the identifier nodes for the magic field of a new cookie. */ 65static tree nc_nelts_field_id; 66 67static tree minus_one; 68 69/* Set up local variable for this file. MUST BE CALLED AFTER 70 INIT_DECL_PROCESSING. */ --- 402 unchanged lines hidden (view full) --- 473 got_it: 474 rbases = chainon (rbases, x); 475 } 476 477 *rbase_ptr = rbases; 478 *vbase_ptr = vbases; 479} 480 | 64 65/* Cache the identifier nodes for the magic field of a new cookie. */ 66static tree nc_nelts_field_id; 67 68static tree minus_one; 69 70/* Set up local variable for this file. MUST BE CALLED AFTER 71 INIT_DECL_PROCESSING. */ --- 402 unchanged lines hidden (view full) --- 474 got_it: 475 rbases = chainon (rbases, x); 476 } 477 478 *rbase_ptr = rbases; 479 *vbase_ptr = vbases; 480} 481 |
482/* Invoke a base-class destructor. REF is the object being destroyed, 483 BINFO is the base class, and DTOR_ARG indicates whether the base 484 class should invoke delete. */ 485 486tree 487build_base_dtor_call (ref, binfo, dtor_arg) 488 tree ref, binfo, dtor_arg; 489{ 490 tree args = NULL_TREE; 491 tree vlist = lookup_name (vlist_identifier, 0); 492 tree call, decr; 493 494 if (TYPE_USES_PVBASES (BINFO_TYPE (binfo))) 495 { 496 args = expr_tree_cons (NULL_TREE, vlist, args); 497 dtor_arg = build (BIT_IOR_EXPR, integer_type_node, 498 dtor_arg, build_int_2 (4, 0)); 499 dtor_arg = fold (dtor_arg); 500 } 501 args = expr_tree_cons (NULL_TREE, dtor_arg, args); 502 call = build_scoped_method_call (ref, binfo, dtor_identifier, args); 503 504 if (!TYPE_USES_PVBASES (BINFO_TYPE (binfo))) 505 /* For plain inheritance, do not try to adjust __vlist. */ 506 return call; 507 508 /* Now decrement __vlist by the number of slots consumed by the base 509 dtor. */ 510 decr = build_int_2 (pvbasecount (BINFO_TYPE (binfo), 0), 0); 511 decr = build_binary_op (MINUS_EXPR, vlist, decr); 512 decr = build_modify_expr (vlist, NOP_EXPR, decr); 513 514 return build (COMPOUND_EXPR, void_type_node, call, decr); 515} 516 517/* Return the number of vlist entries needed to initialize TYPE, 518 depending on whether it is IN_CHARGE. */ 519 520static int 521pvbasecount (type, in_charge) 522 tree type; 523 int in_charge; 524{ 525 int i; 526 int result = 0; 527 tree vbase; 528 529 for (vbase = (CLASSTYPE_VBASECLASSES (type)); vbase; 530 vbase = TREE_CHAIN (vbase)) 531 { 532 result += list_length (CLASSTYPE_VFIELDS (BINFO_TYPE (vbase))); 533 if (in_charge) 534 result += pvbasecount (BINFO_TYPE (vbase), 0); 535 } 536 537 for (i=0; i < CLASSTYPE_N_BASECLASSES (type); i++) 538 { 539 tree base = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), i); 540 if (TREE_VIA_VIRTUAL (base)) 541 continue; 542 result += pvbasecount (BINFO_TYPE (base), 0); 543 } 544 return result; 545} 546 547void 548init_vlist (t) 549 tree t; 550{ 551 char *name; 552 tree expr; 553 tree vlist = lookup_name (vlist_identifier, 0); 554 555 name = alloca (strlen (VLIST_NAME_FORMAT) 556 + TYPE_ASSEMBLER_NAME_LENGTH (t) + 2); 557 sprintf (name, VLIST_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (t)); 558 559 expr = get_identifier (name); 560 expr = lookup_name (expr, 0); 561 expr = build1 (ADDR_EXPR, TREE_TYPE (vlist), expr); 562 if (DECL_DESTRUCTOR_FOR_PVBASE_P (current_function_decl)) 563 /* Move to the end of the vlist. */ 564 expr = build_binary_op (PLUS_EXPR, expr, 565 build_int_2 (pvbasecount (t, 1), 0)); 566 expand_expr_stmt (build_modify_expr (vlist, NOP_EXPR, expr)); 567} 568 |
|
481/* Perform whatever initializations have yet to be done on the base 482 class of the class variable. These actions are in the global 483 variable CURRENT_BASE_INIT_LIST. Such an action could be 484 NULL_TREE, meaning that the user has explicitly called the base 485 class constructor with no arguments. 486 487 If there is a need for a call to a constructor, we must surround 488 that call with a pushlevel/poplevel pair, since we are technically --- 16 unchanged lines hidden (view full) --- 505{ 506 tree member; 507 tree mem_init_list; 508 tree rbase_init_list, vbase_init_list; 509 tree t_binfo = TYPE_BINFO (t); 510 tree binfos = BINFO_BASETYPES (t_binfo); 511 int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0; 512 tree expr = NULL_TREE; | 569/* Perform whatever initializations have yet to be done on the base 570 class of the class variable. These actions are in the global 571 variable CURRENT_BASE_INIT_LIST. Such an action could be 572 NULL_TREE, meaning that the user has explicitly called the base 573 class constructor with no arguments. 574 575 If there is a need for a call to a constructor, we must surround 576 that call with a pushlevel/poplevel pair, since we are technically --- 16 unchanged lines hidden (view full) --- 593{ 594 tree member; 595 tree mem_init_list; 596 tree rbase_init_list, vbase_init_list; 597 tree t_binfo = TYPE_BINFO (t); 598 tree binfos = BINFO_BASETYPES (t_binfo); 599 int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0; 600 tree expr = NULL_TREE; |
601 tree vlist = lookup_name (vlist_identifier, 0); |
|
513 514 if (! immediately) 515 { 516 int momentary; 517 do_pending_stack_adjust (); 518 /* Make the RTL_EXPR node temporary, not momentary, 519 so that rtl_expr_chain doesn't become garbage. */ 520 momentary = suspend_momentary (); --- 55 unchanged lines hidden (view full) --- 576 expand_aggr_init_1 (base_binfo, NULL_TREE, 577 build_indirect_ref (member, NULL_PTR), init, 578 LOOKUP_NORMAL); 579 580 expand_end_target_temps (); 581 free_temp_slots (); 582 } 583 | 602 603 if (! immediately) 604 { 605 int momentary; 606 do_pending_stack_adjust (); 607 /* Make the RTL_EXPR node temporary, not momentary, 608 so that rtl_expr_chain doesn't become garbage. */ 609 momentary = suspend_momentary (); --- 55 unchanged lines hidden (view full) --- 665 expand_aggr_init_1 (base_binfo, NULL_TREE, 666 build_indirect_ref (member, NULL_PTR), init, 667 LOOKUP_NORMAL); 668 669 expand_end_target_temps (); 670 free_temp_slots (); 671 } 672 |
584 expand_cleanup_for_base (base_binfo, NULL_TREE); | 673 expand_cleanup_for_base (base_binfo, vlist, NULL_TREE); |
585 rbase_init_list = TREE_CHAIN (rbase_init_list); 586 } 587 588 /* Initialize all the virtual function table fields that 589 do come from virtual base classes. */ 590 if (TYPE_USES_VIRTUAL_BASECLASSES (t)) 591 expand_indirect_vtbls_init (t_binfo, current_class_ref, current_class_ptr); 592 --- 152 unchanged lines hidden (view full) --- 745 746/* If an exception is thrown in a constructor, those base classes already 747 constructed must be destroyed. This function creates the cleanup 748 for BINFO, which has just been constructed. If FLAG is non-NULL, 749 it is a DECL which is non-zero when this base needs to be 750 destroyed. */ 751 752static void | 674 rbase_init_list = TREE_CHAIN (rbase_init_list); 675 } 676 677 /* Initialize all the virtual function table fields that 678 do come from virtual base classes. */ 679 if (TYPE_USES_VIRTUAL_BASECLASSES (t)) 680 expand_indirect_vtbls_init (t_binfo, current_class_ref, current_class_ptr); 681 --- 152 unchanged lines hidden (view full) --- 834 835/* If an exception is thrown in a constructor, those base classes already 836 constructed must be destroyed. This function creates the cleanup 837 for BINFO, which has just been constructed. If FLAG is non-NULL, 838 it is a DECL which is non-zero when this base needs to be 839 destroyed. */ 840 841static void |
753expand_cleanup_for_base (binfo, flag) | 842expand_cleanup_for_base (binfo, vlist, flag) |
754 tree binfo; | 843 tree binfo; |
844 tree vlist; |
|
755 tree flag; 756{ 757 tree expr; 758 | 845 tree flag; 846{ 847 tree expr; 848 |
759 if (!TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (binfo))) 760 return; | 849 if (TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (binfo))) 850 { 851 /* All cleanups must be on the function_obstack. */ 852 push_obstacks_nochange (); 853 resume_temporary_allocation (); |
761 | 854 |
762 /* All cleanups must be on the function_obstack. */ 763 push_obstacks_nochange (); 764 resume_temporary_allocation (); | 855 /* Call the destructor. */ 856 expr = build_base_dtor_call (current_class_ref, binfo, 857 integer_zero_node); 858 if (flag) 859 expr = fold (build (COND_EXPR, void_type_node, 860 truthvalue_conversion (flag), 861 expr, integer_zero_node)); |
765 | 862 |
766 /* Call the destructor. */ 767 expr = (build_scoped_method_call 768 (current_class_ref, binfo, dtor_identifier, 769 build_expr_list (NULL_TREE, integer_zero_node))); 770 if (flag) 771 expr = fold (build (COND_EXPR, void_type_node, 772 truthvalue_conversion (flag), 773 expr, integer_zero_node)); | 863 pop_obstacks (); 864 add_partial_entry (expr); 865 } |
774 | 866 |
775 pop_obstacks (); 776 add_partial_entry (expr); | 867 if (TYPE_USES_PVBASES (BINFO_TYPE (binfo))) 868 { 869 /* Increment vlist by number of base's vbase classes. */ 870 expr = build_int_2 (pvbasecount (BINFO_TYPE (binfo), 0), 0); 871 expr = build_binary_op (PLUS_EXPR, vlist, expr); 872 expr = build_modify_expr (vlist, NOP_EXPR, expr); 873 expand_expr_stmt (expr); 874 } |
777} 778 779/* Subroutine of `expand_aggr_vbase_init'. 780 BINFO is the binfo of the type that is being initialized. 781 INIT_LIST is the list of initializers for the virtual baseclass. */ 782 783static void 784expand_aggr_vbase_init_1 (binfo, exp, addr, init_list) --- 23 unchanged lines hidden (view full) --- 808 tree type; 809 tree this_ref; 810 tree this_ptr; 811 tree init_list; 812 tree flag; 813{ 814 tree vbases; 815 tree result; | 875} 876 877/* Subroutine of `expand_aggr_vbase_init'. 878 BINFO is the binfo of the type that is being initialized. 879 INIT_LIST is the list of initializers for the virtual baseclass. */ 880 881static void 882expand_aggr_vbase_init_1 (binfo, exp, addr, init_list) --- 23 unchanged lines hidden (view full) --- 906 tree type; 907 tree this_ref; 908 tree this_ptr; 909 tree init_list; 910 tree flag; 911{ 912 tree vbases; 913 tree result; |
914 tree vlist = NULL_TREE; |
|
816 817 /* If there are no virtual baseclasses, we shouldn't even be here. */ 818 my_friendly_assert (TYPE_USES_VIRTUAL_BASECLASSES (type), 19990621); 819 820 /* First set the pointers in our object that tell us where to find 821 our virtual baseclasses. */ 822 expand_start_cond (flag, 0); | 915 916 /* If there are no virtual baseclasses, we shouldn't even be here. */ 917 my_friendly_assert (TYPE_USES_VIRTUAL_BASECLASSES (type), 19990621); 918 919 /* First set the pointers in our object that tell us where to find 920 our virtual baseclasses. */ 921 expand_start_cond (flag, 0); |
922 if (TYPE_USES_PVBASES (type)) 923 { 924 init_vlist (type); 925 vlist = lookup_name (vlist_identifier, 0); 926 } |
|
823 result = init_vbase_pointers (type, this_ptr); 824 if (result) 825 expand_expr_stmt (build_compound_expr (result)); 826 expand_end_cond (); 827 828 /* Now, run through the baseclasses, initializing each. */ 829 for (vbases = CLASSTYPE_VBASECLASSES (type); vbases; 830 vbases = TREE_CHAIN (vbases)) --- 15 unchanged lines hidden (view full) --- 846 that the FLAG will not change across initializations, and 847 avoid doing multiple tests. */ 848 expand_start_cond (flag, 0); 849 expand_aggr_vbase_init_1 (vbases, this_ref, 850 TREE_OPERAND (TREE_VALUE (tmp), 0), 851 init_list); 852 expand_end_cond (); 853 | 927 result = init_vbase_pointers (type, this_ptr); 928 if (result) 929 expand_expr_stmt (build_compound_expr (result)); 930 expand_end_cond (); 931 932 /* Now, run through the baseclasses, initializing each. */ 933 for (vbases = CLASSTYPE_VBASECLASSES (type); vbases; 934 vbases = TREE_CHAIN (vbases)) --- 15 unchanged lines hidden (view full) --- 950 that the FLAG will not change across initializations, and 951 avoid doing multiple tests. */ 952 expand_start_cond (flag, 0); 953 expand_aggr_vbase_init_1 (vbases, this_ref, 954 TREE_OPERAND (TREE_VALUE (tmp), 0), 955 init_list); 956 expand_end_cond (); 957 |
854 expand_cleanup_for_base (vbases, flag); | 958 expand_cleanup_for_base (vbases, vlist, flag); |
855 } 856} 857 858/* Find the context in which this FIELD can be initialized. */ 859 860static tree 861initializing_context (field) 862 tree field; --- 278 unchanged lines hidden (view full) --- 1141 TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type); 1142 expand_aggr_init_1 (TYPE_BINFO (type), exp, exp, 1143 init, LOOKUP_NORMAL|flags); 1144 TREE_TYPE (exp) = type; 1145 TREE_READONLY (exp) = was_const; 1146 TREE_THIS_VOLATILE (exp) = was_volatile; 1147} 1148 | 959 } 960} 961 962/* Find the context in which this FIELD can be initialized. */ 963 964static tree 965initializing_context (field) 966 tree field; --- 278 unchanged lines hidden (view full) --- 1245 TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type); 1246 expand_aggr_init_1 (TYPE_BINFO (type), exp, exp, 1247 init, LOOKUP_NORMAL|flags); 1248 TREE_TYPE (exp) = type; 1249 TREE_READONLY (exp) = was_const; 1250 TREE_THIS_VOLATILE (exp) = was_volatile; 1251} 1252 |
1253static tree 1254no_vlist_base_init (rval, exp, init, binfo, flags) 1255 tree rval, exp, init, binfo; 1256 int flags; 1257{ 1258 tree nrval, func, parms; 1259 1260 /* Obtain the vlist-expecting ctor. */ 1261 func = rval; 1262 my_friendly_assert (TREE_CODE (func) == CALL_EXPR, 20000131); 1263 func = TREE_OPERAND (func, 0); 1264 my_friendly_assert (TREE_CODE (func) == ADDR_EXPR, 20000132); 1265 1266 if (init == NULL_TREE 1267 || (TREE_CODE (init) == TREE_LIST && ! TREE_TYPE (init))) 1268 { 1269 parms = init; 1270 if (parms) 1271 init = TREE_VALUE (parms); 1272 } 1273 else 1274 parms = build_expr_list (NULL_TREE, init); 1275 1276 flags &= ~LOOKUP_HAS_VLIST; 1277 1278 parms = expr_tree_cons (NULL_TREE, integer_zero_node, parms); 1279 flags |= LOOKUP_HAS_IN_CHARGE; 1280 1281 nrval = build_method_call (exp, ctor_identifier, 1282 parms, binfo, flags); 1283 1284 func = build (NE_EXPR, boolean_type_node, 1285 func, null_pointer_node); 1286 nrval = build (COND_EXPR, void_type_node, 1287 func, rval, nrval); 1288 return nrval; 1289} 1290 |
|
1149static void 1150expand_default_init (binfo, true_exp, exp, init, flags) 1151 tree binfo; 1152 tree true_exp, exp; 1153 tree init; 1154 int flags; 1155{ 1156 tree type = TREE_TYPE (exp); 1157 1158 /* It fails because there may not be a constructor which takes 1159 its own type as the first (or only parameter), but which does 1160 take other types via a conversion. So, if the thing initializing 1161 the expression is a unit element of type X, first try X(X&), 1162 followed by initialization by X. If neither of these work 1163 out, then look hard. */ 1164 tree rval; 1165 tree parms; | 1291static void 1292expand_default_init (binfo, true_exp, exp, init, flags) 1293 tree binfo; 1294 tree true_exp, exp; 1295 tree init; 1296 int flags; 1297{ 1298 tree type = TREE_TYPE (exp); 1299 1300 /* It fails because there may not be a constructor which takes 1301 its own type as the first (or only parameter), but which does 1302 take other types via a conversion. So, if the thing initializing 1303 the expression is a unit element of type X, first try X(X&), 1304 followed by initialization by X. If neither of these work 1305 out, then look hard. */ 1306 tree rval; 1307 tree parms; |
1308 tree vlist = NULL_TREE; 1309 tree orig_init = init; |
|
1166 1167 if (init && TREE_CODE (init) != TREE_LIST 1168 && (flags & LOOKUP_ONLYCONVERTING)) 1169 { 1170 /* Base subobjects should only get direct-initialization. */ 1171 if (true_exp != exp) 1172 abort (); 1173 --- 27 unchanged lines hidden (view full) --- 1201 if (parms) 1202 init = TREE_VALUE (parms); 1203 } 1204 else 1205 parms = build_expr_list (NULL_TREE, init); 1206 1207 if (TYPE_USES_VIRTUAL_BASECLASSES (type)) 1208 { | 1310 1311 if (init && TREE_CODE (init) != TREE_LIST 1312 && (flags & LOOKUP_ONLYCONVERTING)) 1313 { 1314 /* Base subobjects should only get direct-initialization. */ 1315 if (true_exp != exp) 1316 abort (); 1317 --- 27 unchanged lines hidden (view full) --- 1345 if (parms) 1346 init = TREE_VALUE (parms); 1347 } 1348 else 1349 parms = build_expr_list (NULL_TREE, init); 1350 1351 if (TYPE_USES_VIRTUAL_BASECLASSES (type)) 1352 { |
1353 if (TYPE_USES_PVBASES (type)) 1354 { 1355 /* In compatibility mode, when not calling a base ctor, 1356 we do not pass the vlist argument. */ 1357 if (true_exp == exp) 1358 vlist = flag_vtable_thunks_compat? NULL_TREE : vlist_zero_node; 1359 else 1360 vlist = lookup_name (vlist_identifier, 0); 1361 1362 if (vlist) 1363 { 1364 parms = expr_tree_cons (NULL_TREE, vlist, parms); 1365 flags |= LOOKUP_HAS_VLIST; 1366 } 1367 } |
|
1209 if (true_exp == exp) 1210 parms = expr_tree_cons (NULL_TREE, integer_one_node, parms); 1211 else 1212 parms = expr_tree_cons (NULL_TREE, integer_zero_node, parms); 1213 flags |= LOOKUP_HAS_IN_CHARGE; 1214 } 1215 1216 rval = build_method_call (exp, ctor_identifier, 1217 parms, binfo, flags); | 1368 if (true_exp == exp) 1369 parms = expr_tree_cons (NULL_TREE, integer_one_node, parms); 1370 else 1371 parms = expr_tree_cons (NULL_TREE, integer_zero_node, parms); 1372 flags |= LOOKUP_HAS_IN_CHARGE; 1373 } 1374 1375 rval = build_method_call (exp, ctor_identifier, 1376 parms, binfo, flags); |
1377 if (vlist && true_exp != exp && flag_vtable_thunks_compat) 1378 { 1379 rval = no_vlist_base_init (rval, exp, orig_init, binfo, flags); 1380 } |
|
1218 if (TREE_SIDE_EFFECTS (rval)) 1219 expand_expr_stmt (rval); 1220} 1221 1222/* This function is responsible for initializing EXP with INIT 1223 (if any). 1224 1225 BINFO is the binfo of the type for who we are performing the --- 1177 unchanged lines hidden (view full) --- 2403 tree newrval; 2404 /* Constructors are never virtual. If it has an initialization, we 2405 need to complain if we aren't allowed to use the ctor that took 2406 that argument. */ 2407 int flags = LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_COMPLAIN; 2408 2409 if (rval && TYPE_USES_VIRTUAL_BASECLASSES (true_type)) 2410 { | 1381 if (TREE_SIDE_EFFECTS (rval)) 1382 expand_expr_stmt (rval); 1383} 1384 1385/* This function is responsible for initializing EXP with INIT 1386 (if any). 1387 1388 BINFO is the binfo of the type for who we are performing the --- 1177 unchanged lines hidden (view full) --- 2566 tree newrval; 2567 /* Constructors are never virtual. If it has an initialization, we 2568 need to complain if we aren't allowed to use the ctor that took 2569 that argument. */ 2570 int flags = LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_COMPLAIN; 2571 2572 if (rval && TYPE_USES_VIRTUAL_BASECLASSES (true_type)) 2573 { |
2574 if (TYPE_USES_PVBASES (true_type) 2575 && !flag_vtable_thunks_compat) 2576 { 2577 init = expr_tree_cons (NULL_TREE, vlist_zero_node, init); 2578 flags |= LOOKUP_HAS_VLIST; 2579 } |
|
2411 init = expr_tree_cons (NULL_TREE, integer_one_node, init); 2412 flags |= LOOKUP_HAS_IN_CHARGE; 2413 } 2414 2415 if (use_java_new) 2416 rval = save_expr (rval); 2417 newrval = rval; 2418 --- 699 unchanged lines hidden (view full) --- 3118 do_delete = cond; 3119 3120 passed_auto_delete = fold (build (BIT_AND_EXPR, integer_type_node, 3121 auto_delete, integer_two_node)); 3122 } 3123 else 3124 passed_auto_delete = auto_delete; 3125 | 2580 init = expr_tree_cons (NULL_TREE, integer_one_node, init); 2581 flags |= LOOKUP_HAS_IN_CHARGE; 2582 } 2583 2584 if (use_java_new) 2585 rval = save_expr (rval); 2586 newrval = rval; 2587 --- 699 unchanged lines hidden (view full) --- 3287 do_delete = cond; 3288 3289 passed_auto_delete = fold (build (BIT_AND_EXPR, integer_type_node, 3290 auto_delete, integer_two_node)); 3291 } 3292 else 3293 passed_auto_delete = auto_delete; 3294 |
3126 expr = build_method_call 3127 (ref, dtor_identifier, build_expr_list (NULL_TREE, passed_auto_delete), 3128 NULL_TREE, flags); | 3295 /* Maybe pass vlist pointer to destructor. */ 3296 if (TYPE_USES_PVBASES (type)) 3297 { 3298 /* Pass vlist_zero even if in backwards compatibility mode, 3299 as the extra argument should not hurt if it is not used. */ 3300 expr = build_expr_list (NULL_TREE, vlist_zero_node); 3301 flags |= LOOKUP_HAS_VLIST; 3302 } 3303 else 3304 expr = NULL_TREE; |
3129 | 3305 |
3306 expr = expr_tree_cons (NULL_TREE, passed_auto_delete, expr); 3307 3308 expr = build_method_call (ref, dtor_identifier, expr, 3309 NULL_TREE, flags); 3310 |
|
3130 if (do_delete) 3131 expr = build (COMPOUND_EXPR, void_type_node, expr, do_delete); 3132 3133 if (flags & LOOKUP_DESTRUCTOR) 3134 /* Explicit destructor call; don't check for null pointer. */ 3135 ifexp = integer_one_node; 3136 else 3137 /* Handle deleting a null pointer. */ --- 38 unchanged lines hidden (view full) --- 3176 exprstmt = build_expr_list (NULL_TREE, cond); 3177 3178 if (base_binfo 3179 && ! TREE_VIA_VIRTUAL (base_binfo) 3180 && TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo))) 3181 { 3182 tree this_auto_delete; 3183 | 3311 if (do_delete) 3312 expr = build (COMPOUND_EXPR, void_type_node, expr, do_delete); 3313 3314 if (flags & LOOKUP_DESTRUCTOR) 3315 /* Explicit destructor call; don't check for null pointer. */ 3316 ifexp = integer_one_node; 3317 else 3318 /* Handle deleting a null pointer. */ --- 38 unchanged lines hidden (view full) --- 3357 exprstmt = build_expr_list (NULL_TREE, cond); 3358 3359 if (base_binfo 3360 && ! TREE_VIA_VIRTUAL (base_binfo) 3361 && TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo))) 3362 { 3363 tree this_auto_delete; 3364 |
3365 /* Should the base invoke delete? */ |
|
3184 if (BINFO_OFFSET_ZEROP (base_binfo)) 3185 this_auto_delete = parent_auto_delete; 3186 else 3187 this_auto_delete = integer_zero_node; 3188 | 3366 if (BINFO_OFFSET_ZEROP (base_binfo)) 3367 this_auto_delete = parent_auto_delete; 3368 else 3369 this_auto_delete = integer_zero_node; 3370 |
3189 expr = build_scoped_method_call 3190 (ref, base_binfo, dtor_identifier, 3191 build_expr_list (NULL_TREE, this_auto_delete)); | 3371 expr = build_base_dtor_call (ref, base_binfo, this_auto_delete); |
3192 exprstmt = expr_tree_cons (NULL_TREE, expr, exprstmt); 3193 } 3194 3195 /* Take care of the remaining baseclasses. */ 3196 for (i = 1; i < n_baseclasses; i++) 3197 { 3198 base_binfo = TREE_VEC_ELT (binfos, i); 3199 if (! TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo)) 3200 || TREE_VIA_VIRTUAL (base_binfo)) 3201 continue; 3202 | 3372 exprstmt = expr_tree_cons (NULL_TREE, expr, exprstmt); 3373 } 3374 3375 /* Take care of the remaining baseclasses. */ 3376 for (i = 1; i < n_baseclasses; i++) 3377 { 3378 base_binfo = TREE_VEC_ELT (binfos, i); 3379 if (! TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo)) 3380 || TREE_VIA_VIRTUAL (base_binfo)) 3381 continue; 3382 |
3203 expr = build_scoped_method_call 3204 (ref, base_binfo, dtor_identifier, 3205 build_expr_list (NULL_TREE, integer_zero_node)); | 3383 expr = build_base_dtor_call (ref, base_binfo, integer_zero_node); |
3206 3207 exprstmt = expr_tree_cons (NULL_TREE, expr, exprstmt); 3208 } 3209 3210 for (member = TYPE_FIELDS (type); member; member = TREE_CHAIN (member)) 3211 { 3212 if (TREE_CODE (member) != FIELD_DECL) 3213 continue; --- 108 unchanged lines hidden --- | 3384 3385 exprstmt = expr_tree_cons (NULL_TREE, expr, exprstmt); 3386 } 3387 3388 for (member = TYPE_FIELDS (type); member; member = TREE_CHAIN (member)) 3389 { 3390 if (TREE_CODE (member) != FIELD_DECL) 3391 continue; --- 108 unchanged lines hidden --- |