erichkeane added a comment.

In D143803#4154736 <https://reviews.llvm.org/D143803#4154736>, @0xdc03 wrote:

> Okay, I have now modified the diagnostic to look something like (as per the 
> discussion at 
> https://discord.com/channels/636084430946959380/636732781086638081/1079356357024694363):
>
>   ../../bug/ifunc-#59164.cpp:17:16: error: ifunc must point to a defined 
> function
>   __attribute__((ifunc("resolver")))
>                  ^
>   ../../bug/ifunc-#59164.cpp:17:16: note: the name specified in an ifunc must 
> refer to the mangled name
>   ../../bug/ifunc-#59164.cpp:17:16: note: function by that name is mangled as 
> "_ZL8resolverv"
>   __attribute__((ifunc("resolver")))
>                  ^~~~~~~~~~~~~~~~~
>                  ifunc("_ZL8resolverv")
>   ../../bug/ifunc-#59164.cpp:20:16: error: alias must point to a defined 
> variable or function
>   __attribute__((alias("resolver")))
>                  ^
>   ../../bug/ifunc-#59164.cpp:20:16: note: the name specified in an alias must 
> refer to the mangled name
>   ../../bug/ifunc-#59164.cpp:20:16: note: function by that name is mangled as 
> "_ZL8resolverv"
>   __attribute__((alias("resolver")))
>                  ^~~~~~~~~~~~~~~~~
>                  alias("_ZL8resolverv")
>   ../../bug/ifunc-#59164.cpp:23:24: error: ifunc must point to a defined 
> function
>   __attribute__((unused, ifunc("resolver"), deprecated("hahahaha, isn't C 
> great?"))) void func();
>                          ^
>   ../../bug/ifunc-#59164.cpp:23:24: note: the name specified in an ifunc must 
> refer to the mangled name
>   ../../bug/ifunc-#59164.cpp:23:24: note: function by that name is mangled as 
> "_ZL8resolverv"
>   __attribute__((unused, ifunc("resolver"), deprecated("hahahaha, isn't C 
> great?"))) void func();
>                          ^~~~~~~~~~~~~~~~~
>                          ifunc("_ZL8resolverv")
>   3 errors generated.
>
> However, `clang/test/SemaCXX/externc-ifunc-resolver.cpp` still fails, and I 
> am not entirely sure what to do with it. Should I update it to check the 
> diagnostic? Also, it seems that the code I wrote prints "must refer to the 
> mangled name" everywhere, even when the resolver or aliasee is not a 
> function. Should I try to fix this? Or is it OK as it is?

I think updating that test with this additional note is the right thing to do.  
As far as that note, saying 'mangled name' is perhaps not correct there, since 
what we really care is that it is the name-as-emitted to the linker. I don't 
have an idea on exactly what to call it.  If we could come up with a better 
phrase, it probably makes the diagnostic on the thing not being a function.

ALSO, it would be worth updating the error here to mention that it must point 
to a defined function, <x, y, Z> (where x,y,z are the things that it is allowed 
to target).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143803/new/

https://reviews.llvm.org/D143803

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to