r193162 - Revert "This patch causes clang to reject alias attributes that point to undefined names. For example, with this patch we now reject"

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Oct 22 09:07:49 PDT 2013


On 22 October 2013 11:52, Alp Toker <alp at nuanti.com> wrote:
>
> On 22/10/2013 15:23, Rafael Espindola wrote:
>
> Author: rafael
> Date: Tue Oct 22 09:23:09 2013
> New Revision: 193162
>
> URL: http://llvm.org/viewvc/llvm-project?rev=193162&view=rev
> Log:
> Revert "This patch causes clang to reject alias attributes that point to
> undefined names. For example, with this patch we now reject"
>
> This reverts commit r193161.
>
> It broke
>
> void foo() __attribute__((alias("bar")));
> void bar() {}
> void zed() __attribute__((alias("foo")));
>
>
> FWIW, swapping the order of alias declarations makes a difference.
>
> Fails:
>
>
> void foo() __attribute__((alias("bar")));
> void zed() __attribute__((alias("foo")));
> void bar() {}
> al.c:3:27: error: alias must point to a defined variable or function
>
> void zed() __attribute__((alias("foo")));
>
> declare void @foo(...) #0
> void (...)* bitcast (void ()* @bar to void (...)*)
>
>
> Works:
>
>
> void zed() __attribute__((alias("foo")));
> void foo() __attribute__((alias("bar")));
> void bar() {}
>
> void (...)* bitcast (void ()* @bar to void (...)*)
> @foo = alias bitcast (void ()* @bar to void (...)*)
>
>
> So I don't think any of the Sema changes for PR17639 can help.
>
> Isn't it rather a question of getting CodeGen to emit the GlobalDecls in the
> right order?

It could probably be made to work, but it seems better to just ask
sema if something is defined or not, in which case the output order is
not important (as long as it is in the end of the TU).

BTW, I took the liberty of fetching the bits for pr17639 from your
patch. I will email an updated version in a sec.

Cheers,
Rafael



More information about the cfe-commits mailing list