[PATCH] D101598: [clang][Sema] adds `[[clang::no_address]]` attribute

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 30 13:03:44 PDT 2021


rsmith added a comment.

In D101598#2729865 <https://reviews.llvm.org/D101598#2729865>, @ldionne wrote:

> Just for posterity, what we discussed is that since there is a list of addressable functions in the standard, we should explore adding a warning to Clang that fires whenever somebody takes the address of a function in namespace `std`, except if it's an addressable function. That list would either be maintained explicitly in Clang, or, preferably, we'd have an attribute that we can mark addressable functions with so that the compiler doesn't flag those specific functions.

Just in case this didn't come up in the discussion already: we can't rely on the standard library implementation having the "this function is addressable" attributes, because we support other standard libraries that won't have those attributes. I think a combination of an opt-in attribute on the `std` namespace plus an opt-out attribute on addressable functions would work, as would maintaining a list of addressable functions in Clang.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101598



More information about the cfe-commits mailing list