On Wed, 2005-09-07 at 13:25 -0400, Michael Tegtmeyer wrote:
> > If you just have a regular object passed by value, the fields accessible
> > are those in TYPE_FIELDS of the type of the object, and those fields
> > reachable through types in the TYPE_BINFOS (i don't remember whether we
> > represent access control in binfos)
> 
> Ah, I guess I am not actually wording this correctly:) I am able to get to 
> all of the fields without any problem. I guess what I mean by visible is 
> with regard to public vs private and context. In my example:
> 
> class A {
>    public:
>      int pub_var;
> 
>      void foo(/*implicit this* */) {...}
> 
>    private:
>      int private_var;
> };
> 
> 
> void bar(A *a) {...}
> 
> 
> In a call to foo(). The implicit this pointer has type A with fields 
> pub_var and private_var. (both accessable with TYPE_FIELD) The same is 
> true for bar. In each case, TREE_PRIVATE is true on private_var. foo() can 
> obviously access private_var because foo() is a member function whereas 
> bar() is cannot. This is the visibilty that I'm refering to. Currently, 
> I'm just comparing the DECL_CONTEXT of the argument and the context of the 
> function but it breaks when it comes to inheritance.
> 
> Is there a better way of going about this?

The middle end does not know language rules about access control, being
language independent, so no.  We only keep the info around for debug
info generation purposes.
If you want to try to emulate language specific access control rules in
the middle end IR, for some reason then you are going to have to do it
the hard way.

> 
> Thanks again,
> Mike

Reply via email to