From patchwork Mon Sep 29 21:11:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siva Chandra Reddy X-Patchwork-Id: 3029 Received: (qmail 10480 invoked by alias); 29 Sep 2014 21:11:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 10470 invoked by uid 89); 29 Sep 2014 21:11:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f182.google.com Received: from mail-ob0-f182.google.com (HELO mail-ob0-f182.google.com) (209.85.214.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 29 Sep 2014 21:11:47 +0000 Received: by mail-ob0-f182.google.com with SMTP id wo20so13815387obc.41 for ; Mon, 29 Sep 2014 14:11:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=A7lDtNV1QUGE7AH21qU6PxyrQ2XgdP1ZP9EaHetK4dg=; b=BWrIag4CmbELjP+DSqcu4s1Q4hQY1F8IQ0aFZCbSOih17E0u0tes7s7j8Qf32Nzlbv ZWgzARNxLIxuL/FS2WYGFITSApL5kp6VhIhEdYlWRqVD3bZsfJameTAq50mZKt7Dq7Zu 6/gHmyro7rGjBq3ziHlh3KO+pz2NoplI+0l9s9Nxmg02jRz7xKxcrfrPq5UU+0+cgtRE URP1BhgJc+UlbGS2u7BgKIZe/EJwuQLoZqySx/lJD3XWqclW7scmlaThqZIpoAv60G9F lrP2RyRdvds8xpTknmjKGQhAZ+FprFHwTUf/zV3TzE8MVxU/dO/V47G2E6u1n8ECqGOc eulQ== X-Gm-Message-State: ALoCoQlGdqqOcuOCnHnGB+l0oO/gZOzhY/l4r/yZhrpj50uQTbhF3a9cqY0tYy2U4UvNWvE9Cro/ MIME-Version: 1.0 X-Received: by 10.182.133.104 with SMTP id pb8mr41813789obb.37.1412025105472; Mon, 29 Sep 2014 14:11:45 -0700 (PDT) Received: by 10.202.225.135 with HTTP; Mon, 29 Sep 2014 14:11:45 -0700 (PDT) In-Reply-To: References: Date: Mon, 29 Sep 2014 14:11:45 -0700 Message-ID: Subject: Re: [PATCH 2/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args From: Siva Chandra To: Doug Evans Cc: gdb-patches X-IsSubscribed: yes On Sun, Sep 28, 2014 at 11:01 PM, Doug Evans wrote: >> 2014-09-11 Siva Chandra Reddy >> >> PR c++/13403 >> PR c++/15154 >> * gdbtypes.c (make_qualified_type): Make non-static. >> * gdbtypes.h (make_qualified_type): Declare. >> * gnu-v3-abi.c (gnuv3_pass_by_reference): Lookup copy >> constructors with qualified args > Can you use class_types_same_p here (instead of comparing with the > result of make_qualified_type) ? Yes, I made this change now. The patch is attached. I am assuming that the other patches in this series are approved modulo making the test regexes more specific. gdb/ChangeLog: 2014-09-29 Siva Chandra Reddy PR c++/13403 PR c++/15154 * gnu-v3-abi.c (gnuv3_pass_by_reference): Lookup copy constructors with qualified args. diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index d5ed355..043c30f 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -1313,11 +1313,17 @@ gnuv3_pass_by_reference (struct type *type) /* If this method takes two arguments, and the second argument is a reference to this class, then it is a copy constructor. */ - if (TYPE_NFIELDS (fieldtype) == 2 - && TYPE_CODE (TYPE_FIELD_TYPE (fieldtype, 1)) == TYPE_CODE_REF - && check_typedef (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (fieldtype, - 1))) == type) - return 1; + if (TYPE_NFIELDS (fieldtype) == 2) + { + struct type *arg_type = TYPE_FIELD_TYPE (fieldtype, 1); + struct type *arg_target_type; + + arg_target_type = check_typedef (TYPE_TARGET_TYPE (arg_type)); + + if (TYPE_CODE (arg_type) == TYPE_CODE_REF + && class_types_same_p (arg_target_type, type)) + return 1; + } } /* Even if all the constructors and destructors were artificial, one