aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-05-08 14:49:33 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-05-25 09:48:37 -0400
commit410f4d7a76fec676ad1f22beafbdbe40c2f700de (patch)
treea40db2babcfa71dcd4f21dc45e01cc835439d9a6 /gdbsupport
parent679a4e92b311841e7f9a067d9251f5534485499f (diff)
downloadgdb-410f4d7a76fec676ad1f22beafbdbe40c2f700de.zip
gdb-410f4d7a76fec676ad1f22beafbdbe40c2f700de.tar.gz
gdb-410f4d7a76fec676ad1f22beafbdbe40c2f700de.tar.bz2
gdbsupport: make filtered_iterator::operator* return the same thing as underlying iterator
This is the same idea as the previous patch, but for filtered_iterator. Without this patch, I would see this when applying the patch that removes reference_to_pointer_iterator from breakpoint_range: CXX breakpoint.o /home/smarchi/src/binutils-gdb/gdb/breakpoint.c: In function ‘void download_tracepoint_locations()’: /home/smarchi/src/binutils-gdb/gdb/breakpoint.c:11007:41: error: cannot allocate an object of abstract type ‘breakpoint’ 11007 | for (breakpoint &b : all_tracepoints ()) | ^ In file included from /home/smarchi/src/binutils-gdb/gdb/gdbthread.h:26, from /home/smarchi/src/binutils-gdb/gdb/infrun.h:21, from /home/smarchi/src/binutils-gdb/gdb/gdbarch.h:28, from /home/smarchi/src/binutils-gdb/gdb/arch-utils.h:23, from /home/smarchi/src/binutils-gdb/gdb/breakpoint.c:21: /home/smarchi/src/binutils-gdb/gdb/breakpoint.h:619:8: note: because the following virtual functions are pure within ‘breakpoint’: 619 | struct breakpoint : public intrusive_list_node<breakpoint> | ^~~~~~~~~~ /home/smarchi/src/binutils-gdb/gdb/breakpoint.c:250:1: note: ‘virtual breakpoint::~breakpoint()’ 250 | breakpoint::~breakpoint () | ^~~~~~~~~~ Change-Id: I05285ff27d21cb0ab80cba392ec4e959167e3cd7 Reviewed-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/filtered-iterator.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/gdbsupport/filtered-iterator.h b/gdbsupport/filtered-iterator.h
index d87484c..9e9548e 100644
--- a/gdbsupport/filtered-iterator.h
+++ b/gdbsupport/filtered-iterator.h
@@ -19,6 +19,8 @@
#ifndef COMMON_FILTERED_ITERATOR_H
#define COMMON_FILTERED_ITERATOR_H
+#include "gdbsupport/invoke-result.h"
+
/* A filtered iterator. This wraps BaseIterator and automatically
skips elements that FilterFunc filters out. Requires that
default-constructing a BaseIterator creates a valid one-past-end
@@ -54,7 +56,10 @@ public:
: filtered_iterator (static_cast<const filtered_iterator &> (other))
{}
- value_type operator* () const { return *m_it; }
+ typename gdb::invoke_result<decltype(&BaseIterator::operator*),
+ BaseIterator>::type
+ operator* () const
+ { return *m_it; }
self_type &operator++ ()
{