[PATCH] D68410: [AttrDocs] document always_inline

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 7 11:26:45 PDT 2019


nickdesaulniers added a comment.

In D68410#1694026 <https://reviews.llvm.org/D68410#1694026>, @kristina wrote:

> Also, I'm fairly certain `__forceinline` and `always_inline`, confusingly enough differ in semantics, with `__forceinline` only being a stronger hint on MSVC.


Does clang handle `__forceinline` vs `always_inline` differently, today?  If not, then sounds like we may need to split these in two.

In D68410#1696411 <https://reviews.llvm.org/D68410#1696411>, @joerg wrote:

> I wonder if we should actually enumerate evil here, i.e. give the situations in which inlining actually fails.


Which is likely to change over time.  I worry that enumerating such cases is compiler version specific, and might lead to developers depending/[ab]using that behavior?

> As mentioned on IRC, I wonder if we shouldn't aim for the stronger semantics

As long as we error when we fail to inline, I think that matches GCC's behavior.  There's likely differences in what we can inline or not.

> and at least warn by default of any situation that prevents always_inline from doing its job.

Might be hard to recognize all such cases in the frontend?  GCC does warn via `-Wattributes` when the attribute is applied to a non-`inline` function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68410





More information about the cfe-commits mailing list