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

Alp Toker alp at nuanti.com
Tue Oct 22 08:52:16 PDT 2013


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?

Alp.


-- 
http://www.nuanti.com
the browser experts

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131022/5572b9ad/attachment.html>


More information about the cfe-commits mailing list