return varentry2->variant->decl;
}
+/* Hook to adjust hash tables on cgraph_node removal. */
+
+static void
+omp_declare_variant_remove_hook (struct cgraph_node *node, void *)
+{
+ if (!node->declare_variant_alt)
+ return;
+
+ /* Drop this hash table completely. */
+ omp_declare_variants = NULL;
+ /* And remove node from the other hash table. */
+ if (omp_declare_variant_alt)
+ {
+ omp_declare_variant_base_entry entry;
+ entry.base = NULL;
+ entry.node = node;
+ entry.variants = NULL;
+ omp_declare_variant_alt->remove_elt_with_hash (&entry,
+ DECL_UID (node->decl));
+ }
+}
+
/* Try to resolve declare variant, return the variant decl if it should
be used instead of base, or base otherwise. */
break;
if (TREE_CODE (TREE_PURPOSE (TREE_VALUE (attr))) != FUNCTION_DECL)
continue;
+ cgraph_node *node = cgraph_node::get (base);
+ /* If this is already a magic decl created by this function,
+ don't process it again. */
+ if (node && node->declare_variant_alt)
+ return base;
switch (omp_context_selector_matches (TREE_VALUE (TREE_VALUE (attr))))
{
case 0:
}
}
+ static struct cgraph_node_hook_list *node_removal_hook_holder;
+ if (node_removal_hook_holder)
+ node_removal_hook_holder
+ = symtab->add_cgraph_removal_hook (omp_declare_variant_remove_hook,
+ NULL);
+
if (omp_declare_variants == NULL)
omp_declare_variants
= hash_table<omp_declare_variant_hasher>::create_ggc (64);