[C++20] [Modules] Attach implicitly declared allocation funcitons to
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Tue, 15 Nov 2022 03:35:21 +0000 (11:35 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Tue, 15 Nov 2022 09:21:48 +0000 (17:21 +0800)
commitcb2289f39240a0fdccc9a853a02ae9751578a0fd
tree3327b1cd423bfc3648cb50458aa0e78c74f475be
parenta4ae029b087070c43d8eb25c9240de3eb345ed63
[C++20] [Modules] Attach implicitly declared allocation funcitons to
global module fragment

[basic.stc.dynamic.general]p2 says:
> The library provides default definitions for the global allocation
> and deallocation functions. Some global allocation and
> deallocation
> functions are replaceable ([new.delete]); these are attached to
> the global module ([module.unit]).

But we didn't take this before and the implicitly generated functions
will live in the module purview if we're compiling a module unit. This
is bad since the owning module will affect the linkage of the
declarations. This patch addresses this.

Closes https://github.com/llvm/llvm-project/issues/58560
clang/lib/Basic/Module.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/test/Modules/implicit-declared-allocation-functions.cppm [new file with mode: 0644]
clang/unittests/AST/DeclTest.cpp