[PATCH] D124701: [clang] Honor __attribute__((no_builtin("foo"))) on functions

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 14:45:23 PDT 2022


efriedma added inline comments.


================
Comment at: clang/lib/CodeGen/CGExpr.cpp:5219
+    // function.
+    else if (!CGF.CurFn->getAttributes().hasFnAttr(AttributeNoBuiltin))
       return CGCallee::forBuiltin(builtinID, FD);
----------------
steplong wrote:
> hans wrote:
> > What if CurFn has the "wildcard" no-builtins attribute?
> Hmmm, good question. Currently, "*" generates a warning. I was able to get "*" to add the attribute no-builtins to the function, but if I try making it affect the calls in the function, I see a compiler crash when compiling compiler-rt. It looks like some builtins must be generated even if -fno-builtins is called such as __sync_lock_test_and_set_1. I'm not sure how to check for that.
I think you're looking for isPredefinedLibFunction()


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

https://reviews.llvm.org/D124701



More information about the cfe-commits mailing list