Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Find References

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
meydeyx Posted - Aug 10 2017 : 03:06:04 AM
Hi, I am working on a C++ project and I use visual assist for renaming or finding references. But yesterday I realized that visual assist didn't find some of references I've been looking for. I realize that when I tried to rebuild my solution. How can I solve that?
16   L A T E S T    R E P L I E S    (Newest First)
meydeyx Posted - Aug 14 2017 : 10:59:18 AM
Thank you for the explanation and you are welcome, it was funny to try to understand what is going on the background. It was a pleasure for me to spare the time I've spent. I hope VA can solve the problem from this bug report. Have a good day.

Edit : Another thing that may be useful, this problem shows up only when we use multiplication "*". I mean if code was like :


       float MY_FLOAT1 = 8.0F;
       float MY_FLOAT2 = 7.0F;
       int MY_INT = static_cast<int>(MY_FLOAT1 + MY_FLOAT2) * 3;

, then VA could find the references correctly. It is really specific circumstance. I think VA is confused when it sees "*" that is hard to determine if it is pointer or multiplication. That may help you.
feline Posted - Aug 14 2017 : 10:41:29 AM
Now I know what code to test, I am seeing the same problem here. I have put in a bug report for this:

case=110369

but no, no good idea why this is confusing our parser. One thing, I am used to global variables / constants being declared directly, so not using the cast or the brackets, so this is probably something we don't come across very often. But that does not explain why this confuses VA, its very simple code really.

I have found a work around, which should help you a bit. Changing the code to read:

#ifdef VA_HELPER_SCOPE
{
#endif
float MY_FLOAT1_SCOPE = 8.0F;
// test - find ref finds 2 references
float MY_FLOAT2_SCOPE = 7.0F;
int MY_INT_SCOPE = static_cast<int>(MY_FLOAT1_SCOPE * MY_FLOAT2_SCOPE) * 3;
#ifdef VA_HELPER_SCOPE
}
#endif

fixes this for me. I tried this because if something this simple failed in functions we would have heard about this years ago. Since the extra brackets are removed by the pre-processor they won't have any effect on your code, while VA see's them, and somehow this gets VA to parse this correctly.

Thank you for taking the time to help me pin this down, so I could get a bug report in for this.
meydeyx Posted - Aug 14 2017 : 02:57:44 AM
Hello feline, I got lots of strange things this morning. "A second test, again if you have a few moments, is to cut the problem 3 lines and paste them in at the very top of the file, and then give VA a couple of seconds to parse the changes." I did what you said and answer is no, it is still confused.

After that I create a new folder (a header) and I copied-pasted only three lines that has the problem. Result is still confused, VA couldn't find "MY_INT2" in third line again. Then I delete these 3 lines and write same 3 lines again, not copy-pasting. Result is still confused.

Then I thougt the problem may be caused by the types of the variables. I wrote the type of "MY_INT1" and "MY_INT2" was int but they are actually float. So code is originally like:

       float MY_FLOAT1 = 8.0F;
       float MY_FLOAT2 = 7.0F;
       int MY_INT = static_cast<int>(MY_FLOAT1 * MY_FLOAT2) * 3;

I didn't think that can cause the problem. But when I removed static_cast but kept "()", problem was still occured. However, when I removed "()" too like :

       float MY_FLOAT1 = 8.0F;
       float MY_FLOAT2 = 7.0F;
       int MY_INT = MY_FLOAT1 * MY_FLOAT2 * 3;

, finally VA found "MY_FLOAT2" correctly. That means parenthesis "()" may make VA confused. Finally, we found what makes this complication, but I don't know why this is happening. Do you have any idea?
feline Posted - Aug 11 2017 : 3:47:02 PM
Thank you for the update, I guessed you would not be able to send me the file. However what you are describing is VERY strange, and it does suggest that something further up the file is causing the problem.

A second test, again if you have a few moments, is to cut the problem 3 lines and paste them in at the very top of the file, and then give VA a couple of seconds to parse the changes. Does VA now understand the variables correctly? If so, this tells us that something in the file is confusing our parser, and thus Rename.
meydeyx Posted - Aug 11 2017 : 12:15:59 PM
I am sorry I cannot send any file, because of secrecy. But I'll try your suggestion on monday because I am not in the office right now. I'll let you know if it works.
feline Posted - Aug 11 2017 : 11:55:32 AM
Normally a static cast will be completely fine, certainly I would not expect it to cause problems like this.

If you have the time, can you try copying just this one file into a new, default solution. Then in this copy of the file, see if VA gives the correct information when you place the caret into the symbol names, and see if Alt-g goes to the correct place.

It is possible there is something local to the file that is causing the problem. If so, you should see the same problems in this test. If you do get the problems like this, and you were able to send me a copy of just this file for testing purposes, I can try to find out what is going wrong here. I know it is often not possible to send in a file, but it's worth mentioning, just in case this is possible and helps.

If you do want to send me something to look at, please submit the files via the form:

http://www.wholetomato.com/support/contact.asp

including this thread ID or URL in the description, so we can match it up.
meydeyx Posted - Aug 11 2017 : 10:53:27 AM
"Can you look in the Find Symbol dialog, and see if there are duplicate definitions for "MY_INT1" or "MY_INT2"?" - I check again, there are no duplicate definitions for "MY_INT1" or "MY_INT2".

"Do you have:

IDE tools menu -> Options -> Environment -> Documents -> Check for consistent line endings on load

turned On or Off?" - It has been On already.

"If you look at VA Outline, is the outline shown for this file correct?" - It looks absolutely normal.

I asked that problem to my manager and he said he had no idea. I think solution gets parser to confuse, because project is really big. It is kind of frustrating, because it doesn't act normal even though everything looks just fine. By the way, I am doing my job with brute force, so my only motivation is curiosity about what is going on the background of the platform. Thank you for responses. Have a good weekend :D.

Edit : I didn't mention before that there is a static cast in line 3. Can it cause a problem like that?
feline Posted - Aug 11 2017 : 10:33:47 AM
If it helps, I am also very confused!

Can you look in the Find Symbol dialog, and see if there are duplicate definitions for "MY_INT1" or "MY_INT2"? I know you have already checked some of this, but something strange is going on here.

Do you have:

IDE tools menu -> Options -> Environment -> Documents -> Check for consistent line endings on load

turned On or Off? If this is turned Off, can you please try turning it On and reloading this code file.

If you look at VA Outline, is the outline shown for this file correct? I am wondering if there is something further up the file that is confusing our parser. If so, this would help to explain this odd behaviour, and if so, it may well also show up in VA Outline being wrong in places.
meydeyx Posted - Aug 11 2017 : 07:42:03 AM
All right, I did what you said. Code was :

       int MY_INT1 = 8;
       int MY_INT2 = 7;
       int MY_TOTAL_INT = MY_INT1 + MY_INT2;

where when I rename "MY_INT1", the reference in 3. line changes, but when I rename "MY_INT2", the reference in 3. line does not change.

I did what you said. When I place the caret into "MY_INT1", it shows "NameSpace.MY_INT1" on the left and the declaration of "MY_INT1"(Line 1) on the right at the top of the editor. When I press Alt-g, it points the first line(declaration of "MY_INT1") as expected.

But when I did same thing for "MY_INT2", it shows "NameSpace.MY_TOTAL_INT.MY_INT2" on the left and "MY_INT1 + MY_INT2" on the right at the top of the editor. When I press Alt-g, it points itself ("MY_INT2" in the third line). Woaw that is really awkward and I am so confused.

What may cause that kind of chaos? But as you said, if we figure out what causes it, we can solve it. You have any idea?
feline Posted - Aug 11 2017 : 07:07:05 AM
Just to make sure I understand correctly, you are able to reproduce the problem with Find References on "MY_INT2" not finding all of the references on demand?

If so, can you please go to one of the references that is Not being found, place the caret into "MY_INT2" and see what VA shows in the context and definition fields. These are normally shown at the top of the editor window, and are where the Alt-m list appears from.

If you now press Alt-g on this symbol, what happens?

If VA is having problems understanding this instance of "MY_INT2", then hopefully these tests will give us some clues as to why, and what is going wrong. If something is confusing VA, this would explain why this reference is not being found, but then we need to try and understand what is confusing VA.
meydeyx Posted - Aug 11 2017 : 02:03:04 AM
After your suggestion, I took another look at my soluntion if there is another global or local variable named "MY_INT2" and I saw there is not. One of the strange things is that there is another global variable let's say it is called "MY_FLOAT". There are a lot of variable named "MY_FLOAT". But when I "Find References" for one of them, VA finds correct references, but it cannot find all references for "MY_INT2" which has a unique name. I think I need to ask that problem to my manager. Project was developed before me.
feline Posted - Aug 10 2017 : 12:57:31 PM
Normally solution size should not be a problem. If this was a problem, then you should see other signs, for example symbols that VA does not understand, so cannot suggest or help you to navigate to.

F12 is the IDE command, not a VA command. The VA version of goto is mapped to Alt-g by default. Go to the definition will take you to the definition, since this is what the function is designed to do. To find all references to a symbol, use Find References.

If you can find a situation where Find References is not finding all of the references then this is something I can look at you with, to try and figure out what is going wrong here. Even if the constant variables are used in a lot of different classes and files VA should still find all of the references and update them.

Do you know if the same name, "MY_INT2" is used somewhere else in your solution, so this might be confusing VA? To check this, try looking in VA's Find Symbol dialog (Alt-Shift-S) and filter the dialog on MY_INT2, and see if more than one symbol is listed.
meydeyx Posted - Aug 10 2017 : 10:55:06 AM
It was just a simple example. When I rename "MY_INT2" as "MY_INT3", other references in other classes are changed. Also there are some more example like that. I think it is because my solution is too big to understand what is what. By the way, when I go to declaration(f12) of "MY_INT2" in 3. line, it points the 2. line of the code. So it goes that way, but not goes the opposite way round? But as I said I think my solution is too complex. Thank you for your response. If I found the solution I'll share here.
feline Posted - Aug 10 2017 : 10:43:30 AM
Strange, there is nothing odd or confusing about this code sample. When I copy and paste these lines into VS2017, both Find References and Rename are finding the correct references for me. If you try Find References, are you seeing the expected results found and listed?

If all of the references in one file were updated, but no references were updated in another file, this might make sense, if we can figure out why one file is ignored. But for a single block of code, all of the references should be found in this block.
meydeyx Posted - Aug 10 2017 : 10:17:20 AM
I can explain my code generally. I have a definition header that keeps all constant variable using in the modul. In this header, there is a confusion I found. It is like:

       int MY_INT1 = 8;
       int MY_INT2 = 7;
       int MY_TOTAL_INT = MY_INT1 + MY_INT2;

When I rename "MY_INT2" as "MY_INT3", visual assist don't change the reference in 3. line. I think you are right about "Find References is designed to find all of the references, but it is possible to confuse VA in some situations, so perhaps this is what has happened here.". Is there any way that can solve this confusion here?
feline Posted - Aug 10 2017 : 09:54:30 AM
Can you give me some more details here? An example of the sort of references that are being missed would help. Find References is designed to find all of the references, but it is possible to confuse VA in some situations, so perhaps this is what has happened here.

Do you make heavy use of namespaces and duplicate class names in different namespaces?

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