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
 Technical Support
 Find references not working on cpp class members
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shippy
Senior Member

USA
30 Posts

Posted - Mar 27 2018 :  1:35:05 PM  Show Profile  Reply with Quote
Lately I've been finding that whenever I try to use find references on a class member or function in the cpp file, it says that the symbol is unrecognized. The VA highlighting also doesn't come on for those items. It doesn't appear that local function vars are affected, just ones where it'd have to get the definition from the header file.

If I go to the header file, the highlighting and find references for that item works fine, but it doesn't find the references in the cpp file. So unfortunately find references is pretty useless for me at the moment.

Doing Ctrl+Click on the item in the cpp file does find the header file reference just fine.

Are there any known issues around this?

Thanks.
--
Version info:
VA_X.dll file version 10.9.2258.5 built 2018.03.06
DevEnv.exe version 14.0.25420.1 Enterprise
msenv.dll version 14.0.25431.1
Comctl32.dll version 6.10.17633.1030

Platform: Custom
Stable Includes:
e:\os\public\amd64chk;

Other Includes:

Stable Source Directories:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\src\mfc;
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\src\mfcm;
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\src\atl;
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\crt\src;
C:\Program Files (x86)\Windows Kits\10\Source\10.0.10150.0\ucrt;


-Shippy

feline
Whole Tomato Software

United Kingdom
18988 Posts

Posted - Mar 27 2018 :  1:43:11 PM  Show Profile  Reply with Quote
I am not sure what is going on here, but at least there seems to be a pattern, which is somewhere to start.

If you sit in the header file and press Alt-O, what happens? You should be taken to the matching cpp file, but it is almost as if VA is not aware that the files match.

Can you please make sure one of the cpp files where you have this problem is Not open in the editor, and then show VA's Open File dialog, Alt-Shift-O, and see if the cpp file is listed in this dialog, and can be opened from this dialog?

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

shippy
Senior Member

USA
30 Posts

Posted - Mar 27 2018 :  3:34:06 PM  Show Profile  Reply with Quote
The Alt+O and Alt+Shift+O seem to be working fine. The former finds and opens the correct cpp file and the latter brings up a dialog with the correct cpp file highlighted. I'm then able to double-click it and open it. Only the header file was open in my editor when I tried it.

-Shippy
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18988 Posts

Posted - Mar 27 2018 :  3:55:14 PM  Show Profile  Reply with Quote
Sitting in the cpp file, if you use Alt-g, or the menu item:

VAssistX -> Goto Implementation

what happens, if anything?

What happens if you place the caret into the class name, before the :: in the implementation name and then try Alt-g?

With the caret placed into the function name of one of the class members, what does VA show in its context and definition fields? These are normally shown at the top of the editor window and are where the alt-m list appears from.

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

shippy
Senior Member

USA
30 Posts

Posted - Mar 27 2018 :  5:08:54 PM  Show Profile  Reply with Quote
Doing Alt+G works fine for the class name and member name in the cpp file. It doesn't do anything if I put it on a function name after the '::'. In the cpp file, if I put my cursor over the member function name or member name, the context and definition fields are blank.

-Shippy
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18988 Posts

Posted - Mar 28 2018 :  04:53:08 AM  Show Profile  Reply with Quote
This sort of makes sense. If VA is having problems parsing and understanding the code in the cpp files, then this will also effect Find References. Now we just need to try and find out what is confusing VA.

Can you please show VA Outline:

VAssistX -> Tools -> VA Outline

and now compare what is shown in VA Outline to what your cpp file actually shows. How accurate is VA Outline? I suspect what ever is happening will have some effect in VA Outline. Is there anything "odd" at the start of the cpp file that might help to explain why VA is confused?

Is it possible to get just a single .h and .cpp file pair to test here, to try and see what the problem is? I appreciate this is often not possible, but it's worth asking on the off chance. If it was possible, and the files would only be used for testing this, 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.

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

shippy
Senior Member

USA
30 Posts

Posted - Mar 28 2018 :  4:09:12 PM  Show Profile  Reply with Quote
I think I've found the issue thanks to your VA Outline suggestion. We have a macro that used to do some special sauce, but now just resolves to 'final' or nothing based on some build config so if I have a class like this:

#define MyFinal final
class MyClass MyFinal {}

VA Outline thinks the name of the class is MyFinal, causing it not to match my implementation. If I change it to the 'final' keyword, everything looks good in VA Outline and then find references starts working. The 'final' definition isn't even needed. If I just do:

#define SomeMacro
class MyClass SomeMacro {}

It does the same thing and thinks the name of the class is SomeMacro instead of MyClass, causing it not to find the stuff in the cpp file.

-Shippy
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18988 Posts

Posted - Mar 29 2018 :  08:32:10 AM  Show Profile  Reply with Quote
Ah, yes, this makes sense. Have you been able to change the #define line in your code, to stop this happening?

If you want or need to keep the macro in the cpp files there are things we can try to help VA handle this without any problems. But if simply removing them is acceptable, and you have already done so, then this should be fixed.

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

shippy
Senior Member

USA
30 Posts

Posted - Mar 29 2018 :  1:21:55 PM  Show Profile  Reply with Quote
I need to keep the macro in the .h (not cpp) files since there are numerous instances in our codebase and getting approval to change it would be potentially challenging. Any workaround you can provide would be great!

-Shippy
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18988 Posts

Posted - Mar 29 2018 :  5:19:54 PM  Show Profile  Reply with Quote
I was / am thinking that if the macro is causing this problem, to give VA a simpler and easier to handle definition of the macro via the va_stdafx.h file, which is explained here:

https://support.wholetomato.com/default.asp?W302

so before suggesting this, I was just trying to test the problem here, to make sure the fix works as expected. But I cannot reproduce the Find References problem so far. I can get the wrong class name in VA Outline, but this is not causing any problems for Find References in my tests.

Can you please see if your very simple macro test example shows the Find References problem for you? It could be I am not testing this quite right, or it could be there is another factor at work here.

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

shippy
Senior Member

USA
30 Posts

Posted - Mar 29 2018 :  7:02:17 PM  Show Profile  Reply with Quote
Yes, the macro test causes the find references problem where the cpp file thinks the symbol isn't recognized. I was able to confirm that creating the va_stdafx.h file with a '#define MyFinal final' line in it fixes the find references issue after rebuilding my symbol database. The VA Outline still has the wrong name for the class (it thinks it's called MyFinal instead of MyClass), but everything seems to be working. Thanks!

-Shippy
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18988 Posts

Posted - Mar 30 2018 :  08:34:19 AM  Show Profile  Reply with Quote
Thank you for the update, I am glad this solution is working for you. Since the va_stdafx.h file is not part of the solution, but is searched for based only on its location in the file system, it is designed to be checked into source control, so you don't loose track of it. So long as people will know not to add it to the solution at a later date

I have put in a bug report for VA Outline showing the wrong class name in this situation:

case=115458

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:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000