+2019-09-15 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
+ IDENTIFIER_CDTOR_P, correct documentation.
+ (DECL_CLONED_FUNCTION): Directly access field.
+ (decl_cloned_function_p): Delete.
+ * class.c (decl_cloned_function_p): Delete.
+ * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
+
2019-09-11 Nathan Sidwell <nathan@acm.org>
* c-objcp-common.c (cp-objcp-common.c): Alphababetize and
return clone;
}
-/* Implementation of DECL_CLONED_FUNCTION and DECL_CLONED_FUNCTION_P, do
- not invoke this function directly.
-
- For a non-thunk function, returns the address of the slot for storing
- the function it is a clone of. Otherwise returns NULL_TREE.
-
- If JUST_TESTING, looks through TEMPLATE_DECL and returns NULL if
- cloned_function is unset. This is to support the separate
- DECL_CLONED_FUNCTION and DECL_CLONED_FUNCTION_P modes; using the latter
- on a template makes sense, but not the former. */
-
-tree *
-decl_cloned_function_p (const_tree decl, bool just_testing)
-{
- tree *ptr;
- if (just_testing)
- decl = STRIP_TEMPLATE (decl);
-
- if (TREE_CODE (decl) != FUNCTION_DECL
- || !DECL_LANG_SPECIFIC (decl)
- || DECL_LANG_SPECIFIC (decl)->u.fn.thunk_p)
- {
-#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
- if (!just_testing)
- lang_check_failed (__FILE__, __LINE__, __FUNCTION__);
- else
-#endif
- return NULL;
- }
-
- ptr = &DECL_LANG_SPECIFIC (decl)->u.fn.u5.cloned_function;
- if (just_testing && *ptr == NULL_TREE)
- return NULL;
- else
- return ptr;
-}
-
/* Produce declarations for all appropriate clones of FN. If
UPDATE_METHODS is true, the clones are added to the
CLASSTYPE_MEMBER_VEC. */
(DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (NODE) \
|| DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (NODE))
-/* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
+/* Nonzero if NODE (a _DECL) is a cloned constructor or
destructor. */
-#define DECL_CLONED_FUNCTION_P(NODE) (!!decl_cloned_function_p (NODE, true))
+#define DECL_CLONED_FUNCTION_P(NODE) \
+ (DECL_NAME (NODE) \
+ && IDENTIFIER_CDTOR_P (DECL_NAME (NODE)) \
+ && !DECL_MAYBE_IN_CHARGE_CDTOR_P (NODE))
/* If DECL_CLONED_FUNCTION_P holds, this is the function that was
cloned. */
-#define DECL_CLONED_FUNCTION(NODE) (*decl_cloned_function_p (NODE, false))
+#define DECL_CLONED_FUNCTION(NODE) \
+ (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->u.fn.u5.cloned_function)
/* Perform an action for each clone of FN, if FN is a function with
clones. This macro should be used like:
extern tree missing_abi_tags (tree);
extern void fixup_type_variants (tree);
extern void fixup_attribute_variants (tree);
-extern tree* decl_cloned_function_p (const_tree, bool);
extern void clone_function_decl (tree, bool);
extern void adjust_clone_args (tree);
extern void deduce_noexcept_on_destructor (tree);
instantiate all the alternate entry points as well. We do this
by cloning the instantiation of the main entry point, not by
instantiating the template clones. */
- if (DECL_CHAIN (gen_tmpl) && DECL_CLONED_FUNCTION_P (DECL_CHAIN (gen_tmpl)))
- clone_function_decl (fndecl, /*update_methods=*/false);
+ if (tree chain = DECL_CHAIN (gen_tmpl))
+ if (DECL_P (chain) && DECL_CLONED_FUNCTION_P (chain))
+ clone_function_decl (fndecl, /*update_methods=*/false);
if (!access_ok)
{