[PATCH] D143803: [clang][alias|ifunc]: Add a diagnostic for mangled names
Dhruv Chawla via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 27 02:32:46 PST 2023
0xdc03 added a comment.
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?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143803/new/
https://reviews.llvm.org/D143803
More information about the cfe-commits
mailing list