rsmith added a comment.

Instead of moving functions and classes/enums into the global module after 
creating them, it would be better to push a module scope for the global module 
when entering a C or C++ language linkage specification and pop the module 
scope when leaving the linkage specification. There are lots of other kinds of 
declaration that can appear inside a linkage specification (for example, 
variables), and doing it that way would properly handle all of them, not only 
functions and classes.



================
Comment at: clang/include/clang/Sema/Sema.h:2198
   llvm::SmallVector<ModuleScope, 16> ModuleScopes;
+  Module *GlobalModule = nullptr;
 
----------------
I think this should live on the `ModuleScope` instead of being separate. If we 
process multiple modules in a single compilation, each needs to have its own 
global module fragment so that we can restrict the visibility of the global 
module fragment to the module unit in which it was declared.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110215/new/

https://reviews.llvm.org/D110215

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

Reply via email to