Mercurial > projects > ldc
diff dmd/expression.c @ 599:4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Mon, 15 Sep 2008 02:04:26 +0200 |
parents | fbb1a366cfbc |
children | 8aebdf56c455 |
line wrap: on
line diff
--- a/dmd/expression.c Sun Sep 14 22:49:19 2008 +0200 +++ b/dmd/expression.c Mon Sep 15 02:04:26 2008 +0200 @@ -9071,4 +9071,30 @@ 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