Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 "Find all references" to list potential writes
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

stifu
New Member

3 Posts

Posted - Jul 31 2020 :  06:07:12 AM  Show Profile  Reply with Quote
The function "find all references" can distinguish between read and write access of a certain variable. However, this only works inside the scope of this variable. If you pass a variable by non-const reference or by pointer to a function/method, VA lists the variable in that function call as a read access, although the function might actually modify the underlying data.

As it is a common usecase, to find all places where a certain variable is modified, it would be incredibly useful if these function calls were listed as a "potential write access". This could be achieved by looking at the signature of the called function to check if the parameter is passed by non-const reference or by pointer to non-const object.

feline
Whole Tomato Software

United Kingdom
16778 Posts

Posted - Jul 31 2020 :  08:07:35 AM  Show Profile  Reply with Quote
This is something we are considering doing at some point:

case=9955

the main complication here is overloaded methods. Ignoring them, and macros, its fairly straight forward to identify possibly modified locations. But once overloads and macros are considered, it gets quite a bit more tricky. But we do see the value in this idea, it's just not easy

zen is the art of being at one with the two'ness
Go to Top of Page

stifu
New Member

3 Posts

Posted - Jul 31 2020 :  2:04:49 PM  Show Profile  Reply with Quote
Right, overloads and macro indeed make it more complex. Maybe a "references in function calls" filter, i.e., without checking the function signature, could be a first step, that could be improved upon later on.

Now that I think about it: Someone could also create a shorthand alias-reference
int& i = MyLongVariableNameIDoNotWantToRepeatEachTime;

or, similarily, a pointer
int* i = &MyLongVariableNameIDoNotWantToRepeatEachTime;

that you'd have to track as well, if you really want to catch all writes.

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
16778 Posts

Posted - Aug 01 2020 :  09:09:35 AM  Show Profile  Reply with Quote
Yes, this is where it starts to get tricky. We can and do identify direct updates, but beyond this, its all a lot more unclear.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000