[PATCH] D52703: Allow ifunc resolvers to accept arguments
Ed Maste via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 9 17:37:11 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC344100: clang: Allow ifunc resolvers to accept arguments (authored by emaste, committed by ).
Repository:
rC Clang
https://reviews.llvm.org/D52703
Files:
include/clang/Basic/AttrDocs.td
include/clang/Basic/DiagnosticSemaKinds.td
lib/CodeGen/CodeGenModule.cpp
test/Sema/attr-ifunc.c
Index: include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -2889,8 +2889,6 @@
"%select{alias|ifunc}0 definition is part of a cycle">;
def err_ifunc_resolver_return : Error<
"ifunc resolver function must return a pointer">;
-def err_ifunc_resolver_params : Error<
- "ifunc resolver function must have no parameters">;
def warn_attribute_wrong_decl_type_str : Warning<
"%0 attribute only applies to %1">, InGroup<IgnoredAttributes>;
def err_attribute_wrong_decl_type_str : Error<
Index: include/clang/Basic/AttrDocs.td
===================================================================
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -3428,7 +3428,7 @@
let Content = [{
``__attribute__((ifunc("resolver")))`` is used to mark that the address of a declaration should be resolved at runtime by calling a resolver function.
-The symbol name of the resolver function is given in quotes. A function with this name (after mangling) must be defined in the current translation unit; it may be ``static``. The resolver function should take no arguments and return a pointer.
+The symbol name of the resolver function is given in quotes. A function with this name (after mangling) must be defined in the current translation unit; it may be ``static``. The resolver function should return a pointer.
The ``ifunc`` attribute may only be used on a function declaration. A function declaration with an ``ifunc`` attribute is considered to be a definition of the declared entity. The entity must not have weak linkage; for example, in C++, it cannot be applied to a declaration if a definition at that location would be considered inline.
Index: test/Sema/attr-ifunc.c
===================================================================
--- test/Sema/attr-ifunc.c
+++ test/Sema/attr-ifunc.c
@@ -27,10 +27,6 @@
void f4() __attribute__((ifunc("f4_ifunc")));
//expected-error at -1 {{ifunc resolver function must return a pointer}}
-void* f5_ifunc(int i) { return 0; }
-void f5() __attribute__((ifunc("f5_ifunc")));
-//expected-error at -1 {{ifunc resolver function must have no parameters}}
-
#else
void f1a() __asm("f1");
void f1a() {}
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -322,8 +322,6 @@
assert(FTy);
if (!FTy->getReturnType()->isPointerTy())
Diags.Report(Location, diag::err_ifunc_resolver_return);
- if (FTy->getNumParams())
- Diags.Report(Location, diag::err_ifunc_resolver_params);
}
llvm::Constant *Aliasee = Alias->getIndirectSymbol();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52703.168922.patch
Type: text/x-patch
Size: 2827 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181010/bb82f320/attachment-0001.bin>
More information about the cfe-commits
mailing list