diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-01-07 17:47:18 +0100 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2021-01-11 11:12:48 -0500 |
commit | 3dd0d3ee1d2a988e7f3a3e8f009fcf328f16d2ed (patch) | |
tree | 9dfb8f62a37b9b2871383eb8efa1268dfb2851a4 /gcc/cp/class.c | |
parent | 8c09b788a96ddf63b282a8f92c02ad23535c912f (diff) | |
download | gcc-3dd0d3ee1d2a988e7f3a3e8f009fcf328f16d2ed.zip gcc-3dd0d3ee1d2a988e7f3a3e8f009fcf328f16d2ed.tar.gz gcc-3dd0d3ee1d2a988e7f3a3e8f009fcf328f16d2ed.tar.bz2 |
c++, abi: Fix abi_tag attribute handling [PR98481]
In GCC10 cp_walk_subtrees has been changed to walk template arguments.
As the following testcase, that changed the mangling of some functions.
I believe the previous behavior that find_abi_tags_r doesn't recurse into
template args has been the correct one, but setting *walk_subtrees = 0
for the types and handling the types subtree walking manually in
find_abi_tags_r looks too hard, there are a lot of subtrees and details what
should and shouldn't be walked, both in tree.c (walk_type_fields there,
which is static) and in cp_walk_subtrees itself.
The following patch abuses the fact that *walk_subtrees is an int to
tell cp_walk_subtrees it shouldn't walk the template args.
Co-authored-by: Jason Merrill <jason@redhat.com>
gcc/cp/ChangeLog:
PR c++/98481
* class.c (find_abi_tags_r): Set *walk_subtrees to 2 instead of 1
for types.
(mark_abi_tags_r): Likewise.
* decl2.c (min_vis_r): Likewise.
* tree.c (cp_walk_subtrees): If *walk_subtrees_p is 2, look through
typedefs.
gcc/testsuite/ChangeLog:
PR c++/98481
* g++.dg/abi/abi-tag24.C: New test.
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c41ac7d..00c0dba 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1507,6 +1507,10 @@ mark_or_check_tags (tree t, tree *tp, abi_tag_data *p, bool val) static tree find_abi_tags_r (tree *tp, int *walk_subtrees, void *data) { + if (TYPE_P (*tp) && *walk_subtrees == 1) + /* Tell cp_walk_subtrees to look though typedefs. */ + *walk_subtrees = 2; + if (!OVERLOAD_TYPE_P (*tp)) return NULL_TREE; @@ -1527,6 +1531,10 @@ find_abi_tags_r (tree *tp, int *walk_subtrees, void *data) static tree mark_abi_tags_r (tree *tp, int *walk_subtrees, void *data) { + if (TYPE_P (*tp) && *walk_subtrees == 1) + /* Tell cp_walk_subtrees to look though typedefs. */ + *walk_subtrees = 2; + if (!OVERLOAD_TYPE_P (*tp)) return NULL_TREE; |