]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdbsupport: add support for references to checked_static_cast
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 18 May 2023 19:05:56 +0000 (15:05 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 24 May 2023 18:53:53 +0000 (14:53 -0400)
commit175ee55a229d9a02ae702f8818e2e022faae3132
treebd8c484fc43fbaff56dbf971530fc86cf866962c
parentcbd9efbbc0414b71d47020958b5fbeff25504f15
gdbsupport: add support for references to checked_static_cast

Add a checked_static_cast overload that works with references.  A bad
dynamic cast with references throws std::bad_cast, it would be possible
to implement the new overload based on that, but it seemed simpler to
just piggy back off the existing function.

I found some potential uses of this new overload in amd-dbgapi-target.c,
update them to illustrate the use of the new overload.  To build
amd-dbgapi-target.c, on needs the amd-dbgapi library, which I don't
expect many people to have.  But I have it, and it builds fine here.  I
did test the new overload by making a purposely bad cast and it did
catch it.

Change-Id: Id6b6a7db09fe3b4aa43cddb60575ff5f46761e96
Reviewed-By: Lancelot SIX <lsix@lancelotsix.com>
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
gdb/amdgpu-tdep.c
gdbsupport/gdb-checked-static-cast.h