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]

Re: existing functionality questions


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?

Thanks again,
Mike


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