[patch][pr17535] Reject alias attributes that point to undefined names.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Oct 14 09:31:18 PDT 2013


The attached patch causes clang to reject alias attributes that point
to undefined names. For example, with this patch we now reject

void f1(void) __attribute__((alias("g1")));

if g1 is not defined in this file. This matches "modern" gcc (>= 4.2
at least) behavior. What is different in this implementation is that
we use the C/C++ level names, not the assembly names like gcc does.
This is consistent with our implementation of #pragma weak, with has
the same difference to gcc's implementation.

Other options include
* Using the mangled name from sema. This would be very expensive and
we would have to mangle each decl to see if we got it.
* Produce a terse error from CodeGen. We normally avoid this, but it
is probably the right thing to do here if we decide to use the mangled
names.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 12461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131014/ac355f23/attachment.obj>


More information about the cfe-commits mailing list