This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++: Tag transparent binding contour


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]