From: Daniel Jacobowitz <drow@mvista.com>
To: Jim Blandy <jimb@redhat.com>
Cc: gdb@sources.redhat.com, Benjamin Kosnik <bkoz@redhat.com>,
Daniel Berlin <dan@dberlin.org>
Subject: Re: C++ nested classes, namespaces, structs, and compound statements
Date: Mon, 08 Apr 2002 18:49:00 -0000 [thread overview]
Message-ID: <20020408214935.A14098@nevyn.them.org> (raw)
In-Reply-To: <npwuvhraf1.fsf@zwingli.cygnus.com>
On Mon, Apr 08, 2002 at 07:19:14PM -0500, Jim Blandy wrote:
>
> Daniel Jacobowitz <drow@mvista.com> writes:
> > How about -containing- `struct fields', instead of replacing? i.e. let
> > the name search happen in the `struct environment', as before, but the
> > data items would be fields (could be indicated in a flag in the
> > environment, with a pointer to the type or symbol for the enclosing
> > structure). I don't think turning members into symbols is a good idea.
>
> I admit the idea of using `struct symbol' for fields as well as
> variables is pretty weird. Here's the rationale:
>
> First, keep in mind that `struct symbol' is sort of a `messy union':
> it's used for a lot of distinct purposes, and it contains all the
> members any of those purposes might need. The `struct symbol'
> representing a declaration like `struct A' doesn't need its
> ginfo.value field. The `struct symbol' representing a local variable
> doesn't need its `bfd_section' field. (I'm not saying this is a great
> way to do things; but it is the way it's done now.)
Sure. But I think this is a chance (if we want one) to move in a
different direction. We'd have to work out the details, but I envision
something like this (names made up as I go along):
struct environment_entry {
const char *name;
enum name_type kind;
void *data;
}
enum name_type {
type_kind,
field_kind,
symbol_kind,
namespace_kind,
};
Some duplication between symbol_kind and field_kind that would need to
be decided on, and there's probably other useful kinds. There could
even be a subtype in there if we found it convenient. For instance:
/* For classes. */
enum field_kind {
normal_field,
static_field,
base_class, /* Probably not this one, actually. Better kept in the type? */
member_function,
static_member_fn, /* Might or might not be necessary. */
};
Then we don't need to have a dummy symbol for every type, etc. It
would keep searching a little more straightforward. IMVHO.
There's plenty of details I haven't thought about how to fit in. Like,
the protections on a member type. Perhaps the environment really
should dictate a structure for every member of the environment,
opaquely. We have some wiggle room here.
There's also a question of how many "kinds" of lookup situations we
have - implicit vs. explicit members, for instance. Some inherit one
way, some another, so we'd need to have separate lookup functions.
Categorizing by an enum is all good. Reusing address classes, though,
I'm more suspicious of.
Does that make sense?
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2002-04-09 1:49 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-05 20:42 Jim Blandy
2002-04-05 22:05 ` Daniel Berlin
2002-04-05 22:34 ` Daniel Jacobowitz
2002-04-05 23:49 ` Daniel Berlin
2002-04-06 7:18 ` Dan Kegel
2002-04-06 9:26 ` Gianni Mariani
2002-04-06 11:57 ` Daniel Berlin
2002-04-08 17:24 ` Jim Blandy
2002-04-08 17:03 ` Jim Blandy
2002-04-08 18:59 ` Daniel Jacobowitz
2002-04-09 18:35 ` Jim Blandy
2002-04-09 20:56 ` Daniel Jacobowitz
2002-04-12 15:08 ` Jim Blandy
2002-04-12 16:32 ` Daniel Jacobowitz
2002-04-08 17:19 ` Jim Blandy
2002-04-08 18:49 ` Daniel Jacobowitz [this message]
2002-04-10 10:31 ` Jim Blandy
2002-04-10 12:08 ` Daniel Jacobowitz
2002-04-12 13:58 ` Jim Blandy
2002-04-12 16:56 ` Daniel Jacobowitz
2002-04-16 12:08 ` Jim Blandy
2002-04-16 14:01 ` Daniel Jacobowitz
2002-04-16 14:52 ` Jim Blandy
2002-04-16 14:58 ` Daniel Jacobowitz
2002-04-06 6:31 ` Andrew Cagney
2002-04-06 7:58 ` Daniel Berlin
2002-04-08 0:59 ` Joel Brobecker
2002-04-08 2:01 ` Doubt in GDB SathisKanna k
2002-04-06 8:49 ` C++ nested classes, namespaces, structs, and compound statements Per Bothner
2002-04-08 16:29 ` Jim Blandy
2002-04-08 16:48 ` Daniel Jacobowitz
2002-04-09 6:55 ` Petr Sorfa
2002-04-10 10:34 ` Jim Blandy
2002-04-10 12:31 ` Daniel Berlin
2002-04-10 12:53 ` Petr Sorfa
2002-04-05 22:02 Michael Elizabeth Chastain
2002-04-05 22:13 ` Daniel Berlin
2002-04-05 22:30 ` Daniel Berlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020408214935.A14098@nevyn.them.org \
--to=drow@mvista.com \
--cc=bkoz@redhat.com \
--cc=dan@dberlin.org \
--cc=gdb@sources.redhat.com \
--cc=jimb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox