[PATCH] D129045: [C++20][Modules] Update handling of implicit inlines [P1779R3]

Iain Sandoe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 3 07:08:22 PDT 2022


iains created this revision.
Herald added a project: All.
iains added reviewers: urnathan, ChuanqiXu.
iains added a subscriber: clang-modules.
iains published this revision for review.
iains added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

the other provisions of P1779 <https://reviews.llvm.org/P1779> are handled elsewhere:

1. private module fragment (which is also under discussion in core) and
2. implicit inline status for constexpr/consteval which has been implemented elsewhere (and is not modules-dependent).


This provides updates to
[class.mfct]:
Pre C++20 [class.mfct]p2:

  A member function may be defined (8.4) in its class definition, in
  which case it is an inline member function (7.1.2)

Post C++20 [class.mfct]p1:

  If a member function is attached to the global module and is defined
  in its class definition, it is inline.

and
[class.friend]:
Pre-C++20 [class.friend]p5

  A function can be defined in a friend declaration of a
  class . . . . Such a function is implicitly inline.

Post C++20 [class.friend]p7

  Such a function is implicitly an inline function if it is attached
  to the global module.

We add the output of implicit-inline to the TextNodeDumper, and amend
a couple of existing tests to account for this, plus add tests for the
cases covered above.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129045

Files:
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/AST/ast-dump-constant-expr.cpp
  clang/test/AST/ast-dump-lambda.cpp
  clang/test/CXX/class/class.friend/p7-cxx20.cpp
  clang/test/CXX/class/class.mfct/p1-cxx20.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129045.441951.patch
Type: text/x-patch
Size: 8705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220703/b7df0eed/attachment-0001.bin>


More information about the cfe-commits mailing list