Existing tree functionality?

2005-07-06 Thread Michael Tegtmeyer
Hello, Is there existing functionality somewhere to sweep a function and collect all externally visible variables at the tree level or do I need to roll my own? I've looked in tree.h and grepped around as much as I could but I haven't found anything obvious. Thanks in advance, Mike Tegtmeyer

Re: Existing tree functionality?

2005-07-06 Thread Michael Tegtmeyer
only ever care to see a single function at a time, you can just look at the referenced_vars list. On Wed, 2005-07-06 at 08:32 -0400, Michael Tegtmeyer wrote: Hello, Is there existing functionality somewhere to sweep a function and collect all externally visible variables at the tree level or

Re: Existing tree functionality?

2005-07-07 Thread Michael Tegtmeyer
I'm using gcc initially to do some static analysis with the resuts being sent somewhere else for the time being. I basically just need to gather the variables with visibility outside of the current function. In addition I need as little tree transformation prior to this collection as possible-i

Re: Existing tree functionality?

2005-07-07 Thread Michael Tegtmeyer
pass_init_datastructures is still necessary. That was the problem-thanks. New question (or still the original rather), is there existing functionality to obtain the variables used in a function with external visibility for that function-or in other words-any variable not local to that functi

Re: Existing tree functionality?

2005-07-07 Thread Michael Tegtmeyer
struct foo { int i; void bar() {i=10;} }; i is not a regular variable here, it's a member of a structure. Agreed. No, but only because it's not really a variable, it's a structure member, and only ever accessed as such. It thus doesn't appear as a VAR_DECL (in gcc terms), i

existing functionality questions

2005-09-06 Thread Michael Tegtmeyer
Hello, I am trying to find out what the existing method of determining whether or not something (function for example) can access a field of a structure. For example: class A { public: int pub_var; void foo(/*implicit this* */) {...} private: int private_var; }; void bar(A

Re: existing functionality questions

2005-09-07 Thread Michael Tegtmeyer
M-x grep access cp/*.[ch] will show you the existing methods of access control. lookup_member would be a useful routine to set a breakpoint on and watch how it does it as well. Thanks for the reply, this is a static analysis pass so am I wrong in thinking that most of the functionality provid

Re: existing functionality questions

2005-09-07 Thread Michael Tegtmeyer
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 cor

Re: existing functionality questions

2005-09-07 Thread Michael Tegtmeyer
All of them is certainly safe, other answers require digging and thinking. A few points to ponder might include: Do you want to know about fields that are accessed indirectly though implicit/explicit calls? Do you want to know what fields are accessed by the compiler without the control of the