LEFT | RIGHT |
1 /* Process declarations and variables for C++ compiler. | 1 /* Process declarations and variables for C++ compiler. |
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, | 2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, |
3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, | 3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, |
4 2011, 2012 Free Software Foundation, Inc. | 4 2011, 2012 Free Software Foundation, Inc. |
5 Hacked by Michael Tiemann (tiemann@cygnus.com) | 5 Hacked by Michael Tiemann (tiemann@cygnus.com) |
6 | 6 |
7 This file is part of GCC. | 7 This file is part of GCC. |
8 | 8 |
9 GCC is free software; you can redistribute it and/or modify | 9 GCC is free software; you can redistribute it and/or modify |
10 it under the terms of the GNU General Public License as published by | 10 it under the terms of the GNU General Public License as published by |
(...skipping 18 matching lines...) Expand all Loading... |
29 line numbers. For example, the CONST_DECLs for enum values. */ | 29 line numbers. For example, the CONST_DECLs for enum values. */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "system.h" | 32 #include "system.h" |
33 #include "coretypes.h" | 33 #include "coretypes.h" |
34 #include "tm.h" | 34 #include "tm.h" |
35 #include "tree.h" | 35 #include "tree.h" |
36 #include "flags.h" | 36 #include "flags.h" |
37 #include "cp-tree.h" | 37 #include "cp-tree.h" |
38 #include "decl.h" | 38 #include "decl.h" |
39 #include "output.h" | |
40 #include "toplev.h" | 39 #include "toplev.h" |
41 #include "timevar.h" | 40 #include "timevar.h" |
42 #include "cpplib.h" | 41 #include "cpplib.h" |
43 #include "target.h" | 42 #include "target.h" |
44 #include "c-family/c-common.h" | 43 #include "c-family/c-common.h" |
45 #include "c-family/c-objc.h" | 44 #include "c-family/c-objc.h" |
46 #include "cgraph.h" | 45 #include "cgraph.h" |
47 #include "tree-inline.h" | 46 #include "tree-inline.h" |
48 #include "c-family/c-pragma.h" | 47 #include "c-family/c-pragma.h" |
49 #include "tree-dump.h" | 48 #include "dumpfile.h" |
50 #include "intl.h" | 49 #include "intl.h" |
51 #include "gimple.h" | 50 #include "gimple.h" |
52 #include "pointer-set.h" | 51 #include "pointer-set.h" |
53 #include "splay-tree.h" | 52 #include "splay-tree.h" |
54 #include "langhooks.h" | 53 #include "langhooks.h" |
55 #include "c-family/c-ada-spec.h" | 54 #include "c-family/c-ada-spec.h" |
56 #include "multiversion.h" | |
57 | 55 |
58 extern cpp_reader *parse_in; | 56 extern cpp_reader *parse_in; |
59 | 57 |
60 /* This structure contains information about the initializations | 58 /* This structure contains information about the initializations |
61 and/or destructions required for a particular priority level. */ | 59 and/or destructions required for a particular priority level. */ |
62 typedef struct priority_info_s { | 60 typedef struct priority_info_s { |
63 /* Nonzero if there have been any initializations at this priority | 61 /* Nonzero if there have been any initializations at this priority |
64 throughout the translation unit. */ | 62 throughout the translation unit. */ |
65 int initializations_p; | 63 int initializations_p; |
66 /* Nonzero if there have been any destructions at this priority | 64 /* Nonzero if there have been any destructions at this priority |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 tree orig_array_expr = array_expr; | 343 tree orig_array_expr = array_expr; |
346 tree orig_index_exp = index_exp; | 344 tree orig_index_exp = index_exp; |
347 | 345 |
348 if (error_operand_p (array_expr) || error_operand_p (index_exp)) | 346 if (error_operand_p (array_expr) || error_operand_p (index_exp)) |
349 return error_mark_node; | 347 return error_mark_node; |
350 | 348 |
351 if (processing_template_decl) | 349 if (processing_template_decl) |
352 { | 350 { |
353 if (type_dependent_expression_p (array_expr) | 351 if (type_dependent_expression_p (array_expr) |
354 || type_dependent_expression_p (index_exp)) | 352 || type_dependent_expression_p (index_exp)) |
355 » return build_min_nt (ARRAY_REF, array_expr, index_exp, | 353 » return build_min_nt_loc (loc, ARRAY_REF, array_expr, index_exp, |
356 » » » NULL_TREE, NULL_TREE); | 354 » » » » NULL_TREE, NULL_TREE); |
357 array_expr = build_non_dependent_expr (array_expr); | 355 array_expr = build_non_dependent_expr (array_expr); |
358 index_exp = build_non_dependent_expr (index_exp); | 356 index_exp = build_non_dependent_expr (index_exp); |
359 } | 357 } |
360 | 358 |
361 type = TREE_TYPE (array_expr); | 359 type = TREE_TYPE (array_expr); |
362 gcc_assert (type); | 360 gcc_assert (type); |
363 type = non_reference (type); | 361 type = non_reference (type); |
364 | 362 |
365 /* If they have an `operator[]', use that. */ | 363 /* If they have an `operator[]', use that. */ |
366 if (MAYBE_CLASS_TYPE_P (type) || MAYBE_CLASS_TYPE_P (TREE_TYPE (index_exp))) | 364 if (MAYBE_CLASS_TYPE_P (type) || MAYBE_CLASS_TYPE_P (TREE_TYPE (index_exp))) |
367 expr = build_new_op (loc, ARRAY_REF, LOOKUP_NORMAL, | 365 expr = build_new_op (loc, ARRAY_REF, LOOKUP_NORMAL, array_expr, index_exp, |
368 » » » array_expr, index_exp, NULL_TREE, | 366 » » » NULL_TREE, /*overload=*/NULL, tf_warning_or_error); |
369 » » » /*overload=*/NULL, tf_warning_or_error); | |
370 else | 367 else |
371 { | 368 { |
372 tree p1, p2, i1, i2; | 369 tree p1, p2, i1, i2; |
373 | 370 |
374 /* Otherwise, create an ARRAY_REF for a pointer or array type. | 371 /* Otherwise, create an ARRAY_REF for a pointer or array type. |
375 It is a little-known fact that, if `a' is an array and `i' is | 372 It is a little-known fact that, if `a' is an array and `i' is |
376 an int, you can write `i[a]', which means the same thing as | 373 an int, you can write `i[a]', which means the same thing as |
377 `a[i]'. */ | 374 `a[i]'. */ |
378 if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == VECTOR_TYPE) | 375 if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == VECTOR_TYPE) |
379 p1 = array_expr; | 376 p1 = array_expr; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 if (processing_template_decl) | 431 if (processing_template_decl) |
435 { | 432 { |
436 t = build_min (DELETE_EXPR, void_type_node, exp, size); | 433 t = build_min (DELETE_EXPR, void_type_node, exp, size); |
437 DELETE_EXPR_USE_GLOBAL (t) = use_global_delete; | 434 DELETE_EXPR_USE_GLOBAL (t) = use_global_delete; |
438 DELETE_EXPR_USE_VEC (t) = doing_vec; | 435 DELETE_EXPR_USE_VEC (t) = doing_vec; |
439 TREE_SIDE_EFFECTS (t) = 1; | 436 TREE_SIDE_EFFECTS (t) = 1; |
440 return t; | 437 return t; |
441 } | 438 } |
442 | 439 |
443 /* An array can't have been allocated by new, so complain. */ | 440 /* An array can't have been allocated by new, so complain. */ |
444 if (TREE_CODE (exp) == VAR_DECL | 441 if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE) |
445 && TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE) | 442 warning (0, "deleting array %q#E", exp); |
446 warning (0, "deleting array %q#D", exp); | |
447 | 443 |
448 t = build_expr_type_conversion (WANT_POINTER, exp, true); | 444 t = build_expr_type_conversion (WANT_POINTER, exp, true); |
449 | 445 |
450 if (t == NULL_TREE || t == error_mark_node) | 446 if (t == NULL_TREE || t == error_mark_node) |
451 { | 447 { |
452 error ("type %q#T argument given to %<delete%>, expected pointer", | 448 error ("type %q#T argument given to %<delete%>, expected pointer", |
453 TREE_TYPE (exp)); | 449 TREE_TYPE (exp)); |
454 return error_mark_node; | 450 return error_mark_node; |
455 } | 451 } |
456 | 452 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 /* A member template definition only matches a member template | 673 /* A member template definition only matches a member template |
678 if (is_template != (TREE_CODE (fndecl) == TEMPLATE_DECL)) | 674 if (is_template != (TREE_CODE (fndecl) == TEMPLATE_DECL)) |
679 continue; | 675 continue; |
680 | 676 |
681 if (same_type_p (TREE_TYPE (TREE_TYPE (function)), | 677 if (same_type_p (TREE_TYPE (TREE_TYPE (function)), |
682 TREE_TYPE (TREE_TYPE (fndecl))) | 678 TREE_TYPE (TREE_TYPE (fndecl))) |
683 && compparms (p1, p2) | 679 && compparms (p1, p2) |
684 && (!is_template | 680 && (!is_template |
685 || comp_template_parms (template_parms, | 681 || comp_template_parms (template_parms, |
686 DECL_TEMPLATE_PARMS (fndecl))) | 682 DECL_TEMPLATE_PARMS (fndecl))) |
LEFT | RIGHT |