Author: Chuanqi Xu
Date: 2023-05-16T10:34:02+08:00
New Revision: 40c30543892aa6441eea075ba69864e79f5de82e

URL: 
https://github.com/llvm/llvm-project/commit/40c30543892aa6441eea075ba69864e79f5de82e
DIFF: 
https://github.com/llvm/llvm-project/commit/40c30543892aa6441eea075ba69864e79f5de82e.diff

LOG: [NFC] [C++20] [Modules] Refactoring b6c7177145bc to make it not
dependent on f109b10

Given
https://github.com/llvm/llvm-project/commit/f109b1016801e2b0dbee278f3c517057c0b1d441#commitcomment-113477829,
we need to revert f109b10. So it will be better to make this patch not
dependent on f109b10 as much as possible.

Added: 
    

Modified: 
    clang/lib/AST/ASTContext.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index b9919073e8267..e1a230f7588c6 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.


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to