From 419587a0bb9c22c0088e6fca5449af957db2c5bb Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Tue, 26 May 2015 23:06:55 +0000 Subject: [PATCH] xmethods.py (UniquePtrMethodsMatcher): Add operator-> support. * python/libstdcxx/v6/xmethods.py (UniquePtrMethodsMatcher): Add operator-> support. * testsuite/libstdc++-xmethods/unique_ptr.cc: Add tests for operator->. From-SVN: r223723 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/python/libstdcxx/v6/xmethods.py | 1 + .../libstdc++-xmethods/unique_ptr.cc | 19 ++++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index af08a735d11..fa3963d1998 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2015-05-26 Doug Evans + + * python/libstdcxx/v6/xmethods.py (UniquePtrMethodsMatcher): Add + operator-> support. + * testsuite/libstdc++-xmethods/unique_ptr.cc: Add tests for + operator->. + 2015-05-26 Jonathan Wakely * include/bits/locale_conv.h: Fix copyright years. diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py index 6db0e163e98..c85dd674734 100644 --- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py +++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py @@ -584,6 +584,7 @@ class UniquePtrMethodsMatcher(gdb.xmethod.XMethodMatcher): 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] diff --git a/libstdc++-v3/testsuite/libstdc++-xmethods/unique_ptr.cc b/libstdc++-v3/testsuite/libstdc++-xmethods/unique_ptr.cc index 5d59b551f52..c449f525a41 100644 --- a/libstdc++-v3/testsuite/libstdc++-xmethods/unique_ptr.cc +++ b/libstdc++-v3/testsuite/libstdc++-xmethods/unique_ptr.cc @@ -20,19 +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 } -- 2.30.2