extern bool handle_module_option (unsigned opt, const char *arg, int value);
/* In optimize.cc */
+extern tree clone_attrs (tree);
extern bool maybe_clone_body (tree);
/* In parser.cc */
/* Copy constexpr from the inherited constructor even if the
inheriting constructor doesn't satisfy the requirements. */
constexpr_p = DECL_DECLARED_CONSTEXPR_P (inherited_ctor);
+ /* Also copy any attributes. */
+ DECL_ATTRIBUTES (fn) = clone_attrs (DECL_ATTRIBUTES (inherited_ctor));
}
/* Add the "this" parameter. */
#include "debug.h"
#include "tree-inline.h"
#include "tree-iterator.h"
+#include "attribs.h"
/* Prototypes. */
return 1;
}
+/* Copy most attributes from ATTRS, omitting attributes that can really only
+ apply to a single decl. */
+
+tree
+clone_attrs (tree attrs)
+{
+ tree new_attrs = NULL_TREE;
+ tree *p = &new_attrs;
+
+ for (tree a = attrs; a; a = TREE_CHAIN (a))
+ {
+ tree aname = get_attribute_name (a);
+ if (is_attribute_namespace_p ("", a)
+ && (is_attribute_p ("alias", aname)
+ || is_attribute_p ("ifunc", aname)))
+ continue;
+ *p = copy_node (a);
+ p = &TREE_CHAIN (*p);
+ }
+ *p = NULL_TREE;
+ return new_attrs;
+}
+
/* FN is a function that has a complete body. Clone the body as
necessary. Returns nonzero if there's no longer any need to
process the main body. */
DECL_VISIBILITY (clone) = DECL_VISIBILITY (fn);
DECL_VISIBILITY_SPECIFIED (clone) = DECL_VISIBILITY_SPECIFIED (fn);
DECL_DLLIMPORT_P (clone) = DECL_DLLIMPORT_P (fn);
- DECL_ATTRIBUTES (clone) = copy_list (DECL_ATTRIBUTES (fn));
+ DECL_ATTRIBUTES (clone) = clone_attrs (DECL_ATTRIBUTES (fn));
DECL_DISREGARD_INLINE_LIMITS (clone) = DECL_DISREGARD_INLINE_LIMITS (fn);
set_decl_section_name (clone, fn);