aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/ASTContext.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index b991907..e1a230f 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -11927,7 +11927,9 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
return false;
// Variables in other module units shouldn't be forced to be emitted.
- if (VD->isInAnotherModuleUnit())
+ auto *VM = VD->getOwningModule();
+ if (VM && VM->getTopLevelModule()->isModulePurview() &&
+ VM->getTopLevelModule() != getCurrentNamedModule())
return false;
// Variables that can be needed in other TUs are required.