aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-01-03 15:04:38 -0500
committerJason Merrill <jason@gcc.gnu.org>2003-01-03 15:04:38 -0500
commit4e8dca1c3ab060bd7bc1b70d4c62d6933e7bc479 (patch)
tree3080ff7fbc3a73e39df1773fb9eda1ec24ad5334 /gcc/cp/tree.c
parent9aad8f83a8c33f5af53fa712234677766716659d (diff)
downloadgcc-4e8dca1c3ab060bd7bc1b70d4c62d6933e7bc479.zip
gcc-4e8dca1c3ab060bd7bc1b70d4c62d6933e7bc479.tar.gz
gcc-4e8dca1c3ab060bd7bc1b70d4c62d6933e7bc479.tar.bz2
fold-const.c (fold): Avoid NOP_EXPRs better.
* fold-const.c (fold) [COND_EXPR]: Avoid NOP_EXPRs better. * integrate.c (copy_decl_for_inlining): Don't clear the rtl for static/external decls. cp/ * call.c (build_conditional_expr): Stabilize lvalues properly. * cvt.c (ocp_convert): Don't build NOP_EXPRs of class type. * tree.c (lvalue_p_1): Don't allow sloppy NOP_EXPRs as lvalues. Don't allow CALL_EXPR or VA_ARG_EXPR, either. * call.c (convert_like_real): Call decl_constant_value for an IDENTITY_CONV even if there are no more conversions. * cvt.c (build_up_reference): Don't push unnamed temps. * decl2.c (do_namespace_alias): Namespace aliases are DECL_EXTERNAL. * dump.c (cp_dump_tree): Don't try to dump class-specific fields for a backend struct. * except.c (wrap_cleanups_r, build_throw): Make MUST_NOT_THROW_EXPRs void. * init.c (expand_default_init): Update to handle MUST_NOT_THROW_EXPR. * init.c (build_vec_delete_1): Pre-evaluate the base address. * init.c (get_temp_regvar): Simplify logic. * tree.c (cp_copy_res_decl_for_inlining): Only do debug tweaks if our replacement is a decl. From-SVN: r60851
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 20d51d4..ad062b7 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -93,13 +93,7 @@ lvalue_p_1 (ref, treat_class_rvalues_as_lvalues, allow_cast_as_lvalue)
allow_cast_as_lvalue);
case NOP_EXPR:
- /* If expression doesn't change the type, we consider it as an
- lvalue even when cast_as_lvalue extension isn't selected.
- That's because parts of the compiler are alleged to be sloppy
- about sticking in NOP_EXPR node for no good reason. */
- if (allow_cast_as_lvalue ||
- same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (ref)),
- TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (ref, 0)))))
+ if (allow_cast_as_lvalue)
return lvalue_p_1 (TREE_OPERAND (ref, 0),
treat_class_rvalues_as_lvalues,
allow_cast_as_lvalue);
@@ -179,9 +173,8 @@ lvalue_p_1 (ref, treat_class_rvalues_as_lvalues, allow_cast_as_lvalue)
case CALL_EXPR:
case VA_ARG_EXPR:
- return ((treat_class_rvalues_as_lvalues
- && IS_AGGR_TYPE (TREE_TYPE (ref)))
- ? clk_class : clk_none);
+ /* Any class-valued call would be wrapped in a TARGET_EXPR. */
+ return clk_none;
case FUNCTION_DECL:
/* All functions (except non-static-member functions) are
@@ -2353,13 +2346,16 @@ cp_copy_res_decl_for_inlining (result, fn, caller, decl_map_,
/* We have a named return value; copy the name and source
position so we can get reasonable debugging information, and
register the return variable as its equivalent. */
- DECL_NAME (var) = DECL_NAME (nrv);
- DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (nrv);
- DECL_ABSTRACT_ORIGIN (var) = DECL_ORIGIN (nrv);
- /* Don't lose initialization info. */
- DECL_INITIAL (var) = DECL_INITIAL (nrv);
- /* Don't forget that it needs to go in the stack. */
- TREE_ADDRESSABLE (var) = TREE_ADDRESSABLE (nrv);
+ if (TREE_CODE (var) == VAR_DECL)
+ {
+ DECL_NAME (var) = DECL_NAME (nrv);
+ DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (nrv);
+ DECL_ABSTRACT_ORIGIN (var) = DECL_ORIGIN (nrv);
+ /* Don't lose initialization info. */
+ DECL_INITIAL (var) = DECL_INITIAL (nrv);
+ /* Don't forget that it needs to go in the stack. */
+ TREE_ADDRESSABLE (var) = TREE_ADDRESSABLE (nrv);
+ }
splay_tree_insert (decl_map,
(splay_tree_key) nrv,