[PATCH] D110215: [C++2a] [Module] Support extern C/C++ semantics
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 11 14:38:23 PDT 2021
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
More information about the cfe-commits
mailing list