* [PATCH] libstdc++: Add operator-> support to unique_ptr xmethod.
@ 2015-04-27 23:12 Doug Evans
0 siblings, 0 replies; only message in thread
From: Doug Evans @ 2015-04-27 23:12 UTC (permalink / raw)
To: gcc-patches, libstdc++
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 <dje@google.com>
* 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 <memory>
+struct x_struct
+{
+ int y;
+};
+
int
main ()
{
int *i = new int;
*i = 10;
-
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 { 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
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-04-27 23:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-27 23:12 [PATCH] libstdc++: Add operator-> support to unique_ptr xmethod Doug Evans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).