Commit 94350948 by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (DECL_CLONED_FUNCTION_P): Check DECL_LANG_SPECIFIC.

	* cp-tree.h (DECL_CLONED_FUNCTION_P): Check DECL_LANG_SPECIFIC.
	* mangle.c (write_function_type): Change prototype.
	(write_encoding): Don't mangle return types for
	constructors or destructors.
	(write_type): Adjust call to write_function_type.
	* pt.c (instantiate_template): Instantiate alternate entry points
	when instantiating the main function.

From-SVN: r35916
parent e282c9c9
2000-08-23 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (DECL_CLONED_FUNCTION_P): Check DECL_LANG_SPECIFIC.
* mangle.c (write_function_type): Change prototype.
(write_encoding): Don't mangle return types for
constructors or destructors.
(write_type): Adjust call to write_function_type.
* pt.c (instantiate_template): Instantiate alternate entry points
when instantiating the main function.
2000-08-23 Gabriel Dos Reis <gdr@codesourcery.com> 2000-08-23 Gabriel Dos Reis <gdr@codesourcery.com>
* error.c (cp_print_error_function): Don't use embedded '\n' in * error.c (cp_print_error_function): Don't use embedded '\n' in
......
...@@ -2010,8 +2010,9 @@ struct lang_decl ...@@ -2010,8 +2010,9 @@ struct lang_decl
/* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or /* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
destructor. */ destructor. */
#define DECL_CLONED_FUNCTION_P(NODE) \ #define DECL_CLONED_FUNCTION_P(NODE) \
(DECL_CLONED_FUNCTION (NODE) != NULL_TREE) (DECL_LANG_SPECIFIC (NODE) \
&& DECL_CLONED_FUNCTION (NODE) != NULL_TREE)
/* If DECL_CLONED_FUNCTION_P holds, this is the function that was /* If DECL_CLONED_FUNCTION_P holds, this is the function that was
cloned. */ cloned. */
......
...@@ -166,7 +166,7 @@ static void write_special_name_destructor PARAMS ((tree)); ...@@ -166,7 +166,7 @@ static void write_special_name_destructor PARAMS ((tree));
static void write_type PARAMS ((tree)); static void write_type PARAMS ((tree));
static int write_CV_qualifiers_for_type PARAMS ((tree)); static int write_CV_qualifiers_for_type PARAMS ((tree));
static void write_builtin_type PARAMS ((tree)); static void write_builtin_type PARAMS ((tree));
static void write_function_type PARAMS ((tree, int)); static void write_function_type PARAMS ((tree));
static void write_bare_function_type PARAMS ((tree, int)); static void write_bare_function_type PARAMS ((tree, int));
static void write_method_parms PARAMS ((tree, int)); static void write_method_parms PARAMS ((tree, int));
static void write_class_enum_type PARAMS ((tree)); static void write_class_enum_type PARAMS ((tree));
...@@ -640,7 +640,10 @@ write_encoding (decl) ...@@ -640,7 +640,10 @@ write_encoding (decl)
else else
fn_type = TREE_TYPE (decl); fn_type = TREE_TYPE (decl);
write_bare_function_type (fn_type, decl_is_template_id (decl, NULL)); write_bare_function_type (fn_type,
(!DECL_CONSTRUCTOR_P (decl)
&& !DECL_DESTRUCTOR_P (decl)
&& decl_is_template_id (decl, NULL)));
} }
} }
...@@ -1247,7 +1250,7 @@ write_type (type) ...@@ -1247,7 +1250,7 @@ write_type (type)
case FUNCTION_TYPE: case FUNCTION_TYPE:
case METHOD_TYPE: case METHOD_TYPE:
write_function_type (type, 1); write_function_type (type);
break; break;
case UNION_TYPE: case UNION_TYPE:
...@@ -1431,15 +1434,14 @@ write_builtin_type (type) ...@@ -1431,15 +1434,14 @@ write_builtin_type (type)
} }
/* Non-terminal <function-type>. NODE is a FUNCTION_TYPE or /* Non-terminal <function-type>. NODE is a FUNCTION_TYPE or
METHOD_TYPE. If INCLUDE_RETURN_TYPE is non-zero, the return type METHOD_TYPE. The return type is mangled before the parameter
is mangled before the parameter types. types.
<function-type> ::= F [Y] <bare-function-type> E */ <function-type> ::= F [Y] <bare-function-type> E */
static void static void
write_function_type (type, include_return_type) write_function_type (type)
tree type; tree type;
int include_return_type;
{ {
MANGLE_TRACE_TREE ("function-type", type); MANGLE_TRACE_TREE ("function-type", type);
...@@ -1456,7 +1458,7 @@ write_function_type (type, include_return_type) ...@@ -1456,7 +1458,7 @@ write_function_type (type, include_return_type)
extern "C" function_t f; // Vice versa. extern "C" function_t f; // Vice versa.
See [dcl.link]. */ See [dcl.link]. */
write_bare_function_type (type, include_return_type); write_bare_function_type (type, /*include_return_type_p=*/1);
write_char ('E'); write_char ('E');
} }
......
...@@ -7420,6 +7420,7 @@ tree ...@@ -7420,6 +7420,7 @@ tree
instantiate_template (tmpl, targ_ptr) instantiate_template (tmpl, targ_ptr)
tree tmpl, targ_ptr; tree tmpl, targ_ptr;
{ {
tree clone;
tree fndecl; tree fndecl;
tree gen_tmpl; tree gen_tmpl;
tree spec; tree spec;
...@@ -7483,6 +7484,13 @@ instantiate_template (tmpl, targ_ptr) ...@@ -7483,6 +7484,13 @@ instantiate_template (tmpl, targ_ptr)
if (flag_external_templates) if (flag_external_templates)
add_pending_template (fndecl); add_pending_template (fndecl);
/* If we've just instantiated the main entry point for a function,
instantiate all the alternate entry points as well. */
for (clone = TREE_CHAIN (gen_tmpl);
clone && DECL_CLONED_FUNCTION_P (clone);
clone = TREE_CHAIN (clone))
instantiate_template (clone, targ_ptr);
return fndecl; return fndecl;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment