From patchwork Mon Apr 27 23:12:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 465295 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D71C814007F for ; Tue, 28 Apr 2015 09:12:48 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=gpvfL4jj; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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=QRIGnHn4Sa3OBySFIjFFTk1msIFBhyliKt03VWRGKHgbTfD+d21QG cIUHg9HEZuzdQskmVXOjSNEfMY3YHrQcMBIQd6A8Tu4PV8c+QVWHSzcpKyI1AYmr vlHJXUdu4aBn0t7UYSVcIyDyPj9+aTBXX+9tv1NMwqGaw74lUuvo7g= 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=JyXj2HmmAV4ZOFn2dl8j8YrFAZg=; b=gpvfL4jjysW2gNqSCWe1 PiO2Yge/0Tx1TXSQ15A5v+YFt6RpxB0OOaVbN2RH/6uOpKr1J4goFwuG1PBoq2k3 ouTBm6S7xIK7FAGNDqazEw7+lhplvfD+NCZ9JojPJ0a63tDE+XWS7MZchVwcCN5b TqJxU7qyKc8WE/CWf386JrI= Received: (qmail 117412 invoked by alias); 27 Apr 2015 23:12:31 -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 117388 invoked by uid 89); 27 Apr 2015 23:12:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-ig0-f202.google.com Received: from mail-ig0-f202.google.com (HELO mail-ig0-f202.google.com) (209.85.213.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 27 Apr 2015 23:12:29 +0000 Received: by igdh15 with SMTP id h15so585574igd.0 for ; Mon, 27 Apr 2015 16:12:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-type; bh=E3Tg0TS4+/ASWwr8ckMDHa6vvNwduDBiRjE99T/QZzw=; b=IUxv1Bbklk5ZT+6rDhoERjLHrrJMHEpj99pXQ/zMLayZgk0pX1Oi6Mu+WYhuEgWeoa d8dZHpVhuaJzY6U/d9qX7j7rekOClOea9Dz7h4AlUbF4hbgwpm5fq983V1xokMediXlM zdzRh7pLgqURdSiQ4T8meDSgZkDhhDxzzXtpXyTsSlSRQSKaN9j4W1I7J5mq4FRigVpp lFbVxwfsoKwG2jKPz9UZFUN1J4SCz6VkMiWTImd45e2y8/A1qyBtpIrbWcqK8kdYMahn LbLyiTkCqpyR47Lb3jS9ysbEwco2wR1nPAAbrviDGW78tlwCYLDLqXyTSVnXYQYvaYOU BfJQ== X-Gm-Message-State: ALoCoQmSdaKAXgvRJBMh1K0yqJmDCrsjCUby5zG0XtsfuDKwVk979dWDqhyDQpNX7lg+syq7Y4bk X-Received: by 10.42.12.208 with SMTP id z16mr25257205icz.18.1430176347768; Mon, 27 Apr 2015 16:12:27 -0700 (PDT) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id f100si1093900yhp.7.2015.04.27.16.12.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Apr 2015 16:12:27 -0700 (PDT) Received: from ruffy.mtv.corp.google.com ([172.17.128.44]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTPS id YcqsgJ89.1; Mon, 27 Apr 2015 16:12:27 -0700 From: Doug Evans To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: [PATCH] libstdc++: Add operator-> support to unique_ptr xmethod. Date: Mon, 27 Apr 2015 16:12:26 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. This patch adds operator-> support to the unique_ptr xmethod. Note: This patch assumes these two patches have been committed. https://sourceware.org/ml/gdb-patches/2015-04/msg00947.html https://gcc.gnu.org/ml/libstdc++/2015-04/msg00149.html Regression tested on amd64-linux. 2015-04-27 Doug Evans * python/libstdcxx/v6/xmethods.py (UniquePtrMethodsMatcher): Add operator->. * testsuite/libstdc++-xmethods/unique_ptr.cc: Add tests for operator->. --- ./python/libstdcxx/v6/xmethods.py= 2015-04-27 10:46:52.000000000 -0700 +++ ./python/libstdcxx/v6/xmethods.py 2015-04-27 15:47:22.000000000 -0700 @@ -581,6 +581,7 @@ class UniquePtrMethodsMatcher(gdb.xmetho matcher_name_prefix + 'unique_ptr') self._method_dict = { 'get': LibStdCxxXMethod('get', UniquePtrGetWorker), + 'operator->': LibStdCxxXMethod('operator->', UniquePtrGetWorker), 'operator*': LibStdCxxXMethod('operator*', UniquePtrDerefWorker), } self.methods = [self._method_dict[m] for m in self._method_dict] --- ./testsuite/libstdc++-xmethods/unique_ptr.cc= 2015-04-27 10:51:07.000000000 -0700 +++ ./testsuite/libstdc++-xmethods/unique_ptr.cc 2015-04-27 15:48:05.000000000 -0700 @@ -20,20 +20,36 @@ #include +struct x_struct +{ + int y; +}; + int main () { int *i = new int; *i = 10; - std::unique_ptr p(i); + x_struct *x = new x_struct; + x->y = 23; + std::unique_ptr q(x); + // { dg-final { note-test *p 10 } } // { dg-final { regexp-test p.get() 0x.* } } // { dg-final { whatis-test *p int } } // { dg-final { whatis-test p.get() int } } +// { dg-final { note-test *q {\{y = 23\}} } } +// { dg-final { regexp-test q.get() 0x.* } } +// { dg-final { note-test q->y 23 } } + +// { dg-final { whatis-test *q x_struct } } +// { dg-final { whatis-test q.get() x_struct } } +// { dg-final { whatis-test q->y int } } + return 0; // Mark SPOT }