[C++20] [Modules] Make member functions with a in-class definition in HU implicitly...
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Tue, 13 Sep 2022 05:03:34 +0000 (13:03 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Tue, 13 Sep 2022 05:11:56 +0000 (13:11 +0800)
commit79fa0ec8c4bfeeb21f7b44ebd9a66e7ec9781798
tree0d4673995f33c248a760489cac3a73542ee0c407
parent35028d417bb32bc05294e77c9ddcf50f24f277eb
[C++20] [Modules] Make member functions with a in-class definition in HU implicitly inline

According to [dcl.inline]p7/note4,

> In the global module, a function defined within a class definition is
> implicitly inline.

And the declarations in the header unit are attached to the global
module fragment. So the function defined within a class definition in
header units should be implicitly inline too.

This fixes https://github.com/llvm/llvm-project/issues/57571.
clang/lib/Sema/SemaDecl.cpp
clang/test/CodeGenCXX/header-unit-friend-within-class-linkage.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/header-unit-member-func-linkage.cpp [new file with mode: 0644]
clang/unittests/AST/DeclTest.cpp