Another verify_cgraph problem

Iain Buclaw ibuclaw at ubuntu.com
Sun Jan 13 14:54:12 PST 2013


On 13 January 2013 16:02, Johannes Pfau <nospam at example.com> wrote:

> Am Sat, 12 Jan 2013 11:57:10 +0100
> schrieb Johannes Pfau <nospam at example.com>:
>
> > A template's toObjFile does nothing, but all my naive attempts to call
> > e.g.
> >
> declaration->isTemplateDeclaration()>onemember->isDeclaration()->toObjFile(false)
> > fail with a strange error.
>
> OK, of course it can't work. toObjFile has to be called on the
> TemplateInstance, not on the declaration...
>
> All TemplateInstances are currently emitted by Module::genobjfile which
> loops through all Dsymbols in the module. Therefore the scope for
> functions in template instances is always the module scope which is
> incorrect.
>
> A simple approach to fix this is delaying emitting those templates and
> emitting functions first, then change function output to emit template
> instances.
> Here's this simple approach: https://gist.github.com/4524721


 //What should multiobj be?



multiobj is ignored by gdc, but just for consistency reasons, just go with
false.


Also, do you find that templates must go after *all* functions have been
processed, or is it fine if you just add them to
toSymbol()->deferredNestedFuncs for the function they are associated with
to be processed immediately afterwards.

Regards,
Iain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20130113/dcd3ab4e/attachment.html>


More information about the D.gnu mailing list