aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Module.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2022-11-15 11:35:21 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2022-11-15 17:21:48 +0800
commitcb2289f39240a0fdccc9a853a02ae9751578a0fd (patch)
tree3327b1cd423bfc3648cb50458aa0e78c74f475be /clang/lib/Basic/Module.cpp
parenta4ae029b087070c43d8eb25c9240de3eb345ed63 (diff)
downloadllvm-cb2289f39240a0fdccc9a853a02ae9751578a0fd.zip
llvm-cb2289f39240a0fdccc9a853a02ae9751578a0fd.tar.gz
llvm-cb2289f39240a0fdccc9a853a02ae9751578a0fd.tar.bz2
[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
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r--clang/lib/Basic/Module.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index 9a58fae..2f30fa0 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -633,7 +633,9 @@ LLVM_DUMP_METHOD void Module::dump() const {
void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc,
VisibleCallback Vis, ConflictCallback Cb) {
- assert(Loc.isValid() && "setVisible expects a valid import location");
+ // We can't import a global module fragment so the location can be invalid.
+ assert((M->isGlobalModule() || Loc.isValid()) &&
+ "setVisible expects a valid import location");
if (isVisible(M))
return;