diff options
author | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2025-01-22 17:22:00 +0800 |
---|---|---|
committer | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2025-01-22 17:24:12 +0800 |
commit | d2e510360fc9b17a3ad536582f076795c4c37634 (patch) | |
tree | 675977540a711d9612f4686ef94595b4b248b26c /clang/lib/Sema/SemaLookup.cpp | |
parent | a343b8e595d56bde91800aeaa7826cbed4e0a18d (diff) | |
download | llvm-d2e510360fc9b17a3ad536582f076795c4c37634.zip llvm-d2e510360fc9b17a3ad536582f076795c4c37634.tar.gz llvm-d2e510360fc9b17a3ad536582f076795c4c37634.tar.bz2 |
[C++20] [Modules] Correct the visibility of decls in implicit global module of other units in the same TU
See the test for the case. It is similar with
https://github.com/llvm/llvm-project/commit/baa5b769f2f76baa0ce1ebfe28236dee2c761f0d
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 9d8cdc9..e18e3c1 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -1614,7 +1614,7 @@ bool Sema::isUsableModule(const Module *M) { // Otherwise, the global module fragment from other translation unit is not // directly usable. - if (M->isGlobalModule()) + if (M->isExplicitGlobalModule()) return false; Module *Current = getCurrentModule(); @@ -1628,6 +1628,8 @@ bool Sema::isUsableModule(const Module *M) { // module should be visible to the decls in the implicit global module. if (Current->isImplicitGlobalModule()) Current = Current->getTopLevelModule(); + if (M->isImplicitGlobalModule()) + M = M->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. |