From patchwork Wed Mar 27 02:25:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Dos Reis X-Patchwork-Id: 231581 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 385AB2C008E for ; Wed, 27 Mar 2013 13:26:10 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=QD4XbRenRGnHdCizVkSpAdQ4JYo9X6G0ZGfZ2H/JgCdGl2x3/u7Xz sQAFIrr+g++h/b1ZgkWh/VktHhrSHA7EM2M+066WPezhSeyPaxfttSktdYsQpXSW EMvhRaJrzJoEpiFuO73s92buiihx356mpn7yrKGGr9J8y5fz7Nve28= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=VbXrqTjYy+zIEB1qwfCZI8CYw/A=; b=BaZtRpaXNyhAr6LvuzNU Ts+ghxQpjFClIvWJcF695hfsDCbTJIKx1NzRg5oImVw4z7wGaTGPikkoNkHbkMCp LyKsYW8lxJQZkIGqb4OUqzPY66i/7JZQakUZCkhzd46po5tLaBPvo5poovUgeRp4 eByX/J2e8AnJHMfy3SgkaAA= Received: (qmail 16847 invoked by alias); 27 Mar 2013 02:25:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 16811 invoked by uid 89); 27 Mar 2013 02:25:51 -0000 X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_CX autolearn=ham version=3.3.1 Received: from www.axiomatics.org (HELO mail.axiomatics.org) (66.228.53.191) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 27 Mar 2013 02:25:48 +0000 Received: by mail.axiomatics.org (Postfix, from userid 1000) id AFA8BED4F; Tue, 26 Mar 2013 21:25:45 -0500 (CDT) From: Gabriel Dos Reis To: gcc-patches@gcc.gnu.org Subject: C++ PATCH: use INDIRECT_REF_P more often Date: Tue, 26 Mar 2013 21:25:44 -0500 Message-ID: <874nfxbmtz.fsf@euclid.axiomatics.org> Lines: 251 MIME-Version: 1.0 Applying to trunk as obvious. Tested on an x86_64-suse-linux. -- Gaby 2013-03-26 Gabriel Dos Reis * call.c (build_new_method_call_1): Use INDIRECT_REF_P. * cvt.c (convert_to_void): Likewise. * error.c (dump_expr): Likewise. * mangle.c (write_expression): Likewise. * parser.c (cp_parser_template_argument): Likewise. * pt.c (convert_nontype_argument): Likewise. (tsubst_copy_and_build): Likewise. * rtti.c (build_typeid): Likewise. * semantics.c (finish_call_expr): Likewise. (finish_decltype_type): Likewise. (build_data_member_initialization): Likewise. * tree.c (is_dummy_object): Likewise. * typeck.c (decay_conversion): Likewise. (build_class_member_access_expr): Likewise. (cp_build_addr_expr_1): Likewise. (unary_complex_lvalue): Likewise. (check_return_expr): Likewise. * typeck2.c (cxx_readonly_error): Likewise. Index: call.c =================================================================== --- call.c (revision 197125) +++ call.c (working copy) @@ -7730,7 +7730,7 @@ cast_to_void = true; call = TREE_OPERAND (call, 0); } - if (TREE_CODE (call) == INDIRECT_REF) + if (INDIRECT_REF_P (call)) call = TREE_OPERAND (call, 0); call = (build_min_non_dep_call_vec (call, Index: cvt.c =================================================================== --- cvt.c (revision 197125) +++ cvt.c (working copy) @@ -916,7 +916,7 @@ exprv = TREE_OPERAND (exprv, 1); if (DECL_P (exprv) || handled_component_p (exprv) - || TREE_CODE (exprv) == INDIRECT_REF) + || INDIRECT_REF_P (exprv)) /* Expr is not being 'used' here, otherwise we whould have called mark_{rl}value_use use here, which would have in turn called mark_exp_read. Rather, we call mark_exp_read directly Index: error.c =================================================================== --- error.c (revision 197125) +++ error.c (working copy) @@ -1988,7 +1988,7 @@ case COMPONENT_REF: { tree ob = TREE_OPERAND (t, 0); - if (TREE_CODE (ob) == INDIRECT_REF) + if (INDIRECT_REF_P (ob)) { ob = TREE_OPERAND (ob, 0); if (TREE_CODE (ob) != PARM_DECL @@ -2243,7 +2243,7 @@ } else { - if (TREE_CODE (ob) == INDIRECT_REF) + if (INDIRECT_REF_P (ob)) { dump_expr (TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS); pp_cxx_arrow (cxx_pp); Index: mangle.c =================================================================== --- mangle.c (revision 197125) +++ mangle.c (working copy) @@ -2691,7 +2691,7 @@ write_member_name (member); } } - else if (TREE_CODE (expr) == INDIRECT_REF + else if (INDIRECT_REF_P (expr) && TREE_TYPE (TREE_OPERAND (expr, 0)) && TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == REFERENCE_TYPE) { Index: parser.c =================================================================== --- parser.c (revision 197125) +++ parser.c (working copy) @@ -13274,7 +13274,7 @@ { tree probe; - if (TREE_CODE (argument) == INDIRECT_REF) + if (INDIRECT_REF_P (argument)) { gcc_assert (REFERENCE_REF_P (argument)); argument = TREE_OPERAND (argument, 0); Index: pt.c =================================================================== --- pt.c (revision 197125) +++ pt.c (working copy) @@ -5735,7 +5735,7 @@ shall be one of: [...] -- the address of an object or function with external linkage. */ - if (TREE_CODE (expr) == INDIRECT_REF + if (INDIRECT_REF_P (expr) && TYPE_REF_OBJ_P (TREE_TYPE (TREE_OPERAND (expr, 0)))) { expr = TREE_OPERAND (expr, 0); @@ -14013,7 +14013,7 @@ if (unq != function) { tree fn = unq; - if (TREE_CODE (fn) == INDIRECT_REF) + if (INDIRECT_REF_P (fn)) fn = TREE_OPERAND (fn, 0); if (TREE_CODE (fn) == COMPONENT_REF) fn = TREE_OPERAND (fn, 1); Index: rtti.c =================================================================== --- rtti.c (revision 197125) +++ rtti.c (working copy) @@ -326,7 +326,7 @@ /* FIXME when integrating with c_fully_fold, mark resolves_to_fixed_type_p case as a non-constant expression. */ - if (TREE_CODE (exp) == INDIRECT_REF + if (INDIRECT_REF_P (exp) && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE && TYPE_POLYMORPHIC_P (TREE_TYPE (exp)) && ! resolves_to_fixed_type_p (exp, &nonnull) Index: semantics.c =================================================================== --- semantics.c (revision 197125) +++ semantics.c (working copy) @@ -2236,7 +2236,7 @@ if (processing_template_decl && result != error_mark_node) { - if (TREE_CODE (result) == INDIRECT_REF) + if (INDIRECT_REF_P (result)) result = TREE_OPERAND (result, 0); result = build_call_vec (TREE_TYPE (result), orig_fn, orig_args); SET_EXPR_LOCATION (result, input_location); @@ -5301,7 +5301,7 @@ if (identifier_p (expr)) expr = lookup_name (expr); - if (TREE_CODE (expr) == INDIRECT_REF) + if (INDIRECT_REF_P (expr)) /* This can happen when the expression is, e.g., "a.b". Just look at the underlying operand. */ expr = TREE_OPERAND (expr, 0); @@ -5948,7 +5948,7 @@ return true; else gcc_unreachable (); - if (TREE_CODE (member) == INDIRECT_REF) + if (INDIRECT_REF_P (member)) member = TREE_OPERAND (member, 0); if (TREE_CODE (member) == NOP_EXPR) { Index: tree.c =================================================================== --- tree.c (revision 197125) +++ tree.c (working copy) @@ -2879,7 +2879,7 @@ int is_dummy_object (const_tree ob) { - if (TREE_CODE (ob) == INDIRECT_REF) + if (INDIRECT_REF_P (ob)) ob = TREE_OPERAND (ob, 0); return (TREE_CODE (ob) == NOP_EXPR && TREE_OPERAND (ob, 0) == void_zero_node); Index: typeck.c =================================================================== --- typeck.c (revision 197125) +++ typeck.c (working copy) @@ -1911,7 +1911,7 @@ tree adr; tree ptrtype; - if (TREE_CODE (exp) == INDIRECT_REF) + if (INDIRECT_REF_P (exp)) return build_nop (build_pointer_type (TREE_TYPE (type)), TREE_OPERAND (exp, 0)); @@ -2289,7 +2289,7 @@ int type_quals; tree member_type; - null_object_p = (TREE_CODE (object) == INDIRECT_REF + null_object_p = (INDIRECT_REF_P (object) && integer_zerop (TREE_OPERAND (object, 0))); /* Convert OBJECT to the type of MEMBER. */ @@ -5164,7 +5164,7 @@ } /* Let &* cancel out to simplify resulting code. */ - if (TREE_CODE (arg) == INDIRECT_REF) + if (INDIRECT_REF_P (arg)) { /* We don't need to have `current_class_ptr' wrapped in a NON_LVALUE_EXPR node. */ @@ -5189,7 +5189,7 @@ && argtype != unknown_type_node && (val = get_base_address (arg)) && COMPLETE_TYPE_P (TREE_TYPE (val)) - && TREE_CODE (val) == INDIRECT_REF + && INDIRECT_REF_P (val) && TREE_CONSTANT (TREE_OPERAND (val, 0))) { tree type = build_pointer_type (argtype); @@ -5708,7 +5708,7 @@ return build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (arg)), targ); } - if (TREE_CODE (arg) == SAVE_EXPR && TREE_CODE (targ) == INDIRECT_REF) + if (TREE_CODE (arg) == SAVE_EXPR && INDIRECT_REF_P (targ)) return build3 (SAVE_EXPR, build_pointer_type (TREE_TYPE (arg)), TREE_OPERAND (targ, 0), current_function_decl, NULL); } @@ -8247,7 +8247,7 @@ warn = false; /* If we are calling a function whose return type is the same of the current class reference, it is ok. */ - else if (TREE_CODE (retval) == INDIRECT_REF + else if (INDIRECT_REF_P (retval) && TREE_CODE (TREE_OPERAND (retval, 0)) == CALL_EXPR) warn = false; } Index: typeck2.c =================================================================== --- typeck2.c (revision 197125) +++ typeck2.c (working copy) @@ -111,7 +111,7 @@ G_("decrement of " "constant field %qD"), arg); - else if (TREE_CODE (arg) == INDIRECT_REF + else if (INDIRECT_REF_P (arg) && TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REFERENCE_TYPE && (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL || TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))