Handle new'ing of Java classes.

Handle new'ing of Java classes.
	* init.c (build_class_classref):  New function.
	(build_new_1):  If type is TYPE_FOR_JAVA:  Call _Jv_AllocObject;
	constructor does not return this;  don't need to exception-protect.
	* pt.c (lookup_template_class):  Copy TYPE_FOR_JAVA flag.
	* decl2.c (acceptable_java_type):  Handle template-derived types.

From-SVN: r21881
This commit is contained in:
Per Bothner 1998-08-20 09:44:01 -07:00
parent f668f16016
commit 824f42abaf
1 changed files with 16 additions and 2 deletions

View File

@ -1403,8 +1403,22 @@ acceptable_java_type (type)
type = TREE_TYPE (type);
if (TREE_CODE (type) == RECORD_TYPE)
{
complete_type (type);
return TYPE_FOR_JAVA (type);
tree args; int i;
if (! TYPE_FOR_JAVA (type))
return 0;
if (! CLASSTYPE_TEMPLATE_INFO (type))
return 1;
args = CLASSTYPE_TI_ARGS (type);
i = TREE_VEC_LENGTH (args);
while (--i >= 0)
{
type = TREE_VEC_ELT (args, i);
if (TREE_CODE (type) == POINTER_TYPE)
type = TREE_TYPE (type);
if (! TYPE_FOR_JAVA (type))
return 0;
}
return 1;
}
}
return 0;