[patch][pr22217] Use the most recent decl for mangling

David Majnemer david.majnemer at gmail.com
Wed Jan 21 17:19:55 PST 2015


On Wed, Jan 21, 2015 at 10:01 AM, David Majnemer <david.majnemer at gmail.com>
wrote:

> I think clang's delayed codegen approach is a design flaw, I'd be happy to
> see it gone.


To be clear, I am in favor of delaying everything and emitting only at the
end.


>
>
> On Wednesday, January 21, 2015, Rafael EspĂ­ndola <
> rafael.espindola at gmail.com> wrote:
>
>> On 20 January 2015 at 12:42, David Majnemer <david.majnemer at gmail.com>
>> wrote:
>> > I don't think this approach would handle things like:
>> >
>> > int pr22217_foo;
>> > int *b = &pr22217_foo;
>> > extern int pr22217_foo __asm__("pr22217_bar");
>> >
>> > With your patch, pr22217_foo gets emitted.
>> > With gcc, pr22217_bar gets emitted.
>>
>> Gosh, this part is horrible. I can see two options:
>>
>> * Check in CodeGenModule::getMangledName than the name we get is the
>> same as the cache and error if not. Very expensive. Just rejecting
>> __asm__ after the name has been computed might have the same effect
>> and be cheaper.
>>
>> * Delay all of codegen. Basically just return false from
>> CodeGenModule::MayBeEmittedEagerly and try to avoid the order change
>> in codegen. The more I think about it, the more this looks desirable.
>> It should also fix pr16187 and allow us to finally cache visibility
>> computations.
>>
>> Cheers,
>> Rafael
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150121/115ee273/attachment.html>


More information about the cfe-commits mailing list