[C++20] [Modules] Make module local decls visible to language linkage in the same module
Close https://github.com/llvm/llvm-project/issues/123343 See the issue and the comments in the patch for details.
This commit is contained in:
parent
0171e56ed0
commit
baa5b769f2
@ -1624,6 +1624,11 @@ bool Sema::isUsableModule(const Module *M) {
|
||||
if (!Current)
|
||||
return false;
|
||||
|
||||
// For implicit global module, the decls in the same modules with the parent
|
||||
// module should be visible to the decls in the implicit global module.
|
||||
if (Current->isImplicitGlobalModule())
|
||||
Current = Current->getTopLevelModule();
|
||||
|
||||
// If M is the module we're parsing or M and the current module unit lives in
|
||||
// the same module, M should be usable.
|
||||
//
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
// RUN: rm -rf %t
|
||||
// RUN: split-file %s %t
|
||||
// RUN: cd %t
|
||||
//
|
||||
// RUN: %clang_cc1 -std=c++20 %t/m.a.cppm -emit-module-interface -o %t/a.pcm
|
||||
// RUN: %clang_cc1 -std=c++20 %t/m.b.cppm -fmodule-file=m:a=%t/a.pcm -fsyntax-only -verify
|
||||
|
||||
//--- m.a.cppm
|
||||
export module m:a;
|
||||
int a;
|
||||
|
||||
//--- m.b.cppm
|
||||
// expected-no-diagnostics
|
||||
module m:b;
|
||||
import :a;
|
||||
extern "C++" int get_a() { return a; }
|
||||
Loading…
x
Reference in New Issue
Block a user