[C++ PATCH] Remove namespace field
Nathan Sidwell
nathan@acm.org
Fri Jun 2 11:13:00 GMT 2017
We currently chain namespace decls on a special chain in a binding
level. This patch drops that field and chains namespaces on the regular
names list.
There are 3 places we walk child namespaces.
1) spelling correction. Ironically this is the one search where the old
IDENTIFIER_GLOBAL_VALUES representation was perfect -- given an
identifier, tell me all the namespaces that have a binding. We didn't
take advantage of that though, but recursively walked the namespaces and
then doing a full-blown qualified-name lookup at each one. This patch
makes a few changes:
a) just look in the namespace of interest for a binding.
b) iterate over the name list to find namespace children. This is less
optimal, but we're in the error path anyway
c) implement a breadth-first walk of the children in declaration order.
Previously we were doing a depth-first walk. The difference is when the
search is limited. Breadth-first seemed more appropriate?
2 & 3) two ada-related walks. One of them we have to iterate the names
list, so we can just look for namespace children at that time. The
other case the worker function (in c-family), knows to skip namespace
decls already, but doesn't know how to walk them. So we have to insert
another walk here. If this is a pain point, the right solution is a
lang hook called by the worker function when it meets a namespace decl.
I bootstrapped including an ada compiler because of change #2 & #3.
Applied to trunk.
nathan
--
Nathan Sidwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nspc-ect.diff
Type: text/x-patch
Size: 10603 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170602/5de509e7/attachment.bin>
More information about the Gcc-patches
mailing list