C++: Tag transparent binding contour
Gabriel Dos Reis
gdr@integrable-solutions.net
Tue Jun 3 16:05:00 GMT 2003
This issue pops up as a fall out of my work on name lookup speedup.
Currently, we have many disparate codes for name lookups, some copied
from the C front-end and malassed to approximate C++ notions and some
that try to implement directly C++ notions of scopes (mostly namespaces).
Most of the many troubles (real bugs and inefficiency) we're currently
experiencing in c11plus come from the fact that we don't have a
unified framework to implement name lookup.
In my work, I come to realize that the distinction of scopes based on
scope_kind (see pc/cp-tree.h) more accurately captures what is
described in the C++ definition text.
Code copied from the C front-end have the notion of "tag-transparent
binding contour", which means that a tag (in C++ speak, a user-defined type)
declared/defined inside that binding contour propagates uplevel, as if
that binding contour did not exist, until it reachs a
non-tag-transparent one.
That notion is not really useful for C++, and it can be derived from
the categorization made by scope_kind.
The only place, in the C++ front-end, where a tag-transparent binding
contour is created in
void
maybe_push_cleanup_level (tree type)
{
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
&& current_binding_level->more_cleanups_ok == 0)
{
keep_next_level (2);
cxx_pushlevel (true, NULL);
clear_last_expr ();
add_scope_stmt (/*begin_p=*/1, /*partial_p=*/1);
}
}
where I think it is unnecessary. Comments?
-- Gaby
More information about the Gcc
mailing list