[patch][rfc] Emit DeferredDeclsToEmit in order

Richard Smith richard at metafoo.co.uk
Wed Jan 21 13:25:29 PST 2015


You lose one nice property of the current model: if we emit 'f', and
'f' calls 'g', we then immediately emit 'g' as well. I think it'd be
nicer to emit declarations in something like depth-first usage order.
(Something like: swap DeferredDeclsToEmit with a local, then walk it
emitting decls, and after each one, recursively call
emitCurrentDeferredDecls if DeferredDeclsToEmit isn't empty.)

On Wed, Jan 21, 2015 at 9:43 AM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> Currently we emit DeferredDeclsToEmit in reverse order. The attached
> patch changes that.
>
> The advantages of the change are that
>
> * The output order is a bit closer to the source order. The change to
> test/CodeGenCXX/pod-member-memcpys.cpp is a good example.
>
> * If we decide to deffer more, it will not cause as large changes in
> the testcases as it would without this patch.
>
> Note that the patch is incomplete. I have to finish updating the
> tests, but I wanted to check first if other think this is a good idea
> first.
>
> Cheers,
> Rafael




More information about the cfe-commits mailing list