Keep _d_newclass() semantics, re-introduce _d_allocclass() instead

And use that one in DtoNewClass(), keeping 3rd party code from breaking.
This commit is contained in:
Martin 2016-08-14 20:52:39 +02:00
parent 97921fbb8d
commit a5e5bd1716
6 changed files with 20 additions and 6 deletions

View file

@ -84,8 +84,8 @@ DValue *DtoNewClass(Loc &loc, TypeClass *tc, NewExp *newexp) {
// allocate
LLValue *mem;
if (newexp->onstack) {
// FIXME align scope class to its largest member
mem = DtoRawAlloca(DtoType(tc)->getContainedType(0), 0, ".newclass_alloca");
mem = DtoRawAlloca(DtoType(tc)->getContainedType(0), DtoAlignment(tc),
".newclass_alloca");
}
// custom allocator
else if (newexp->allocator) {
@ -97,7 +97,7 @@ DValue *DtoNewClass(Loc &loc, TypeClass *tc, NewExp *newexp) {
// default allocator
else {
llvm::Function *fn =
getRuntimeFunction(loc, gIR->module, "_d_newclass");
getRuntimeFunction(loc, gIR->module, "_d_allocclass");
LLConstant *ci = DtoBitCast(getIrAggr(tc->sym)->getClassInfoSymbol(),
DtoType(Type::typeinfoclass->type));
mem =