mirror of git://gcc.gnu.org/git/gcc.git
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
This commit is contained in:
parent
afa5920a97
commit
419587a0bb
|
|
@ -1,3 +1,10 @@
|
||||||
|
2015-05-26 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* python/libstdcxx/v6/xmethods.py (UniquePtrMethodsMatcher): Add
|
||||||
|
operator-> support.
|
||||||
|
* testsuite/libstdc++-xmethods/unique_ptr.cc: Add tests for
|
||||||
|
operator->.
|
||||||
|
|
||||||
2015-05-26 Jonathan Wakely <jwakely@redhat.com>
|
2015-05-26 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
* include/bits/locale_conv.h: Fix copyright years.
|
* include/bits/locale_conv.h: Fix copyright years.
|
||||||
|
|
|
||||||
|
|
@ -584,6 +584,7 @@ class UniquePtrMethodsMatcher(gdb.xmethod.XMethodMatcher):
|
||||||
matcher_name_prefix + 'unique_ptr')
|
matcher_name_prefix + 'unique_ptr')
|
||||||
self._method_dict = {
|
self._method_dict = {
|
||||||
'get': LibStdCxxXMethod('get', UniquePtrGetWorker),
|
'get': LibStdCxxXMethod('get', UniquePtrGetWorker),
|
||||||
|
'operator->': LibStdCxxXMethod('operator->', UniquePtrGetWorker),
|
||||||
'operator*': LibStdCxxXMethod('operator*', UniquePtrDerefWorker),
|
'operator*': LibStdCxxXMethod('operator*', UniquePtrDerefWorker),
|
||||||
}
|
}
|
||||||
self.methods = [self._method_dict[m] for m in self._method_dict]
|
self.methods = [self._method_dict[m] for m in self._method_dict]
|
||||||
|
|
|
||||||
|
|
@ -20,19 +20,36 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
struct x_struct
|
||||||
|
{
|
||||||
|
int y;
|
||||||
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
int *i = new int;
|
int *i = new int;
|
||||||
*i = 10;
|
*i = 10;
|
||||||
|
|
||||||
std::unique_ptr<int> p(i);
|
std::unique_ptr<int> p(i);
|
||||||
|
|
||||||
|
x_struct *x = new x_struct;
|
||||||
|
x->y = 23;
|
||||||
|
std::unique_ptr<x_struct> q(x);
|
||||||
|
|
||||||
// { dg-final { note-test *p 10 } }
|
// { dg-final { note-test *p 10 } }
|
||||||
// { dg-final { regexp-test p.get() 0x.* } }
|
// { dg-final { regexp-test p.get() 0x.* } }
|
||||||
|
|
||||||
// { dg-final { whatis-test *p int } }
|
// { dg-final { whatis-test *p int } }
|
||||||
// { dg-final { whatis-test p.get() "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
|
return 0; // Mark SPOT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue