[22/32] miscelaneous c++ bits

Nathan Sidwell nathan@acm.org
Tue Nov 3 21:16:57 GMT 2020


This is probably the messiest diff.

It's the remaining diff of cp-tree.h.
1) a new tree type MODULE_VECTOR.  This is a sparse array used for name 
lookup.  A namespace symbol table entry may contain one of these, which 
holds the bindings for each loaded module.  If a module doesn't bind 
that name, there'll be no slot for it.  The current TU always uses slot 
0.  The Global Module uses slot 1, and in a named-module partitions 
share slot 2.  Slots 1 & 2 are used for duplicate declaration matching.

I steal more flags from lang-decl-base.  Firstly, the selector is 
reduced from 16 to 3 bits.  We add a bunch of module-related flags

module_purview_p -- the declaration is owned by a module
module_import_p -- the declaration is from an import
module_entity_p -- the declaration is in the imported entity hash & array

module_pending_specializations_p - in a template we know there are 
specializations we've not loaded

module_pending_members_p - in a class we know there are members to be loaded

attached_decls_p -- this decl is in the attached-decls hash, and 
therefore has attached decls (to do with mangling lambdas initializing 
namespace-scope maybe-template variables)

It sprinkles set_originating_module and set_instantiating_module around 
a few places.  The originating module of a decl is the module that 
declared the decl.  The instantiating module is the module that caused 
code to be emitted for it.  Often these two modules are the same, but 
for templates they can of course be different.


-- 
Nathan Sidwell

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 22-c++-other-bits.diff
Type: text/x-patch
Size: 56979 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201103/2d635682/attachment-0001.bin>


More information about the Gcc-patches mailing list