diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2019-04-18 09:50:56 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-04-01 00:12:47 +0200 |
commit | 013fca64fc17ba646c3564eab52fac50f0751188 (patch) | |
tree | c75868fd2d0b82c3e4ba548430629646ea5fb681 /gcc/d/modules.cc | |
parent | 1c16f7fc903c1c1c912faf7889b69d83429b7b2e (diff) | |
download | gcc-013fca64fc17ba646c3564eab52fac50f0751188.zip gcc-013fca64fc17ba646c3564eab52fac50f0751188.tar.gz gcc-013fca64fc17ba646c3564eab52fac50f0751188.tar.bz2 |
d: Merge UDAs between function prototype and definitions (PR90136)
This change fixes the symbol merging in get_symbol_decl to also consider
prototypes. This allows the ability to set user defined attributes on
the prototype of a function, which then get applied to the definition,
if found later in the compilation.
The lowering of UDAs to GCC attributes has been commonized into a single
function called apply_user_attributes.
gcc/d/ChangeLog:
PR d/90136
* d-attribs.cc: Include dmd/attrib.h.
(build_attributes): Redeclare as static.
(apply_user_attributes): New function.
* d-tree.h (class UserAttributeDeclaration): Remove.
(build_attributes): Remove.
(apply_user_attributes): Declare.
(finish_aggregate_type): Remove attrs argument.
* decl.cc (get_symbol_decl): Merge declaration prototypes with
definitions. Use apply_user_attributes.
* modules.cc (layout_moduleinfo_fields): Remove last argument to
finish_aggregate_type.
* typeinfo.cc (layout_classinfo_interfaces): Likewise.
* types.cc (layout_aggregate_members): Likewise.
(finish_aggregate_type): Remove attrs argument.
(TypeVisitor::visit (TypeEnum *)): Use apply_user_attributes.
(TypeVisitor::visit (TypeStruct *)): Remove last argument to
finish_aggregate_type. Use apply_user_attributes.
(TypeVisitor::visit (TypeClass *)): Likewise.
gcc/testsuite/ChangeLog:
PR d/90136
* gdc.dg/pr90136a.d: New test.
* gdc.dg/pr90136b.d: New test.
* gdc.dg/pr90136c.d: New test.
Diffstat (limited to 'gcc/d/modules.cc')
-rw-r--r-- | gcc/d/modules.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc index ba18f2c..4f54190 100644 --- a/gcc/d/modules.cc +++ b/gcc/d/modules.cc @@ -543,7 +543,7 @@ layout_moduleinfo_fields (Module *decl, tree type) size_t alignsize = MAX (TYPE_ALIGN_UNIT (type), TYPE_ALIGN_UNIT (ptr_type_node)); - finish_aggregate_type (offset, alignsize, type, NULL); + finish_aggregate_type (offset, alignsize, type); return type; } |