start_cleanup_fn (void)
{
char name[32];
- tree fntype;
- tree fndecl;
- bool use_cxa_atexit = flag_use_cxa_atexit
- && !targetm.cxx.use_atexit_for_cxa_atexit ();
push_to_top_level ();
/* Build the name of the function. */
sprintf (name, "__tcf_%d", start_cleanup_cnt++);
/* Build the function declaration. */
- fntype = TREE_TYPE (get_atexit_fn_ptr_type ());
- fndecl = build_lang_decl (FUNCTION_DECL, get_identifier (name), fntype);
+ tree fntype = TREE_TYPE (get_atexit_fn_ptr_type ());
+ tree fndecl = build_lang_decl (FUNCTION_DECL, get_identifier (name), fntype);
+ DECL_CONTEXT (fndecl) = FROB_CONTEXT (current_namespace);
/* It's a function with internal linkage, generated by the
compiler. */
TREE_PUBLIC (fndecl) = 0;
emissions this way. */
DECL_DECLARED_INLINE_P (fndecl) = 1;
DECL_INTERFACE_KNOWN (fndecl) = 1;
- /* Build the parameter. */
- if (use_cxa_atexit)
+ if (flag_use_cxa_atexit && !targetm.cxx.use_atexit_for_cxa_atexit ())
{
+ /* Build the parameter. */
tree parmdecl = cp_build_parm_decl (fndecl, NULL_TREE, ptr_type_node);
TREE_USED (parmdecl) = 1;
DECL_READ_P (parmdecl) = 1;
DECL_ARGUMENTS (fndecl) = parmdecl;
}
- pushdecl (fndecl);
+ fndecl = pushdecl (fndecl, /*hidden=*/true);
start_preparsed_function (fndecl, NULL_TREE, SF_PRE_PARSED);
pop_lang_context ();