Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 "Find all references" to list potential writes

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
stifu Posted - Jul 31 2020 : 06:07:12 AM
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.
4   L A T E S T    R E P L I E S    (Newest First)
kimbo Posted - Nov 22 2024 : 06:24:11 AM
digging up...

I would also suggest to check the member function constness here.

I often search for variables and got lots of results where a member function is called and it would be nice to see if this is a const one. That would really help to find the "write" places. Turning off the "Display read references" doesn't work for me (it shows nearly nothing).

If there are const/nonconst overloadings, it's fine to mark them as non-const.
feline Posted - Aug 01 2020 : 09:09:35 AM
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.
stifu Posted - Jul 31 2020 : 2:04:49 PM
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.

feline Posted - Jul 31 2020 : 08:07:35 AM
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

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000