Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.

This commit is contained in:
Tomas Lindquist Olsen
2008-09-15 02:04:26 +02:00
parent 431bc19d2f
commit 4280a86bcf
8 changed files with 67 additions and 8 deletions

View File

@@ -9071,4 +9071,30 @@ void CondExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
expToCBuffer(buf, hgs, e2, PREC_cond);
}
/************************************************************/
#if IN_LLVM
// Strictly LLVMDC specific stuff
GEPExp::GEPExp(Loc loc, Expression* e, Identifier* id, unsigned idx)
: UnaExp(loc, TOKgep, sizeof(GEPExp), e)
{
index = idx;
ident = id;
}
void GEPExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
expToCBuffer(buf, hgs, e1, PREC_primary);
buf->writeByte('.');
buf->writestring(ident->toChars());
}
Expression* GEPExp::toLvalue(Scope* sc, Expression* e)
{
// GEP's are always lvalues, at least in the "LLVM sense" ...
return this;
}
#endif