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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jan 21 06:30:17 PST 2015


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



More information about the cfe-commits mailing list