Run semantic on Type::tvalist.

This is required to resolve the type for AAPCS/AAPCS64.
Up to now it was not necessary because only char* was used.
AAPCS/AAPCS64 use a special extern(C++) struct __va_list.
This commit is contained in:
Kai Nacke 2016-02-28 16:11:28 +00:00
parent 2dc7145e93
commit 815b13be38
4 changed files with 7 additions and 4 deletions

View file

@ -1497,7 +1497,11 @@ void FuncDeclaration::semantic3(Scope *sc)
if (f->linkage == LINKd || (f->parameters && Parameter::dim(f->parameters)))
{
// Declare _argptr
#if IN_LVVM
Type *t = Type::tvalist->semantic(loc, sc);
#else
Type *t = Type::tvalist;
#endif
argptr = new VarDeclaration(Loc(), t, Id::_argptr, NULL);
argptr->storage_class |= STCtemp;
argptr->semantic(sc2);

View file

@ -111,8 +111,7 @@ struct AArch64TargetABI : TargetABI {
// using TypeIdentifier here is a bit wonky but works, as long as the name
// is actually available in the scope (this is what DMD does, so if a better
// solution is found there, this should be adapted).
return (new TypeIdentifier(Loc(), Identifier::idPool("__va_list_tag")))
->pointerTo();
return (new TypeIdentifier(Loc(), Identifier::idPool("__va_list")));
}
};

View file

@ -882,7 +882,7 @@ void DtoDefineFunction(FuncDeclaration *fd) {
// D varargs: prepare _argptr and _arguments
if (f->linkage == LINKd && f->varargs == 1) {
// allocate _argptr (of type core.stdc.stdarg.va_list)
LLValue *argptrmem = DtoAlloca(Type::tvalist, "_argptr_mem");
LLValue *argptrmem = DtoAlloca(Type::tvalist->semantic(fd->loc, fd->scope), "_argptr_mem");
irFunc->_argptr = argptrmem;
// initialize _argptr with a call to the va_start intrinsic

@ -1 +1 @@
Subproject commit dac245a567b0b70ce9b7f1055831ddd2118784ea
Subproject commit c3a9601c157da388d37249038da1c9d95c32ed03