Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Implementation in multiple cpp files -> VA broken

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 - Sep 10 2020 : 05:19:01 AM
Some people at work like to spread an implementation accross multiple cpp files (likely to get a little structure into their mess of a code :-D ). This practice seems to break a lot of features of VA. Most notably, "Find all references" very frequently says "symbol is unrecognized". Text-highlighting is also affected.


Here is my version info:
VA_X.dll file version 10.9.2341.2 built 2019.08.05
DevEnv.exe version 8.0.50727.42 Professional
msenv.dll version 8.0.50727.42
Font: Consolas 13 (pixels)
Comctl32.dll version 6.10.18362.1016
Windows 8 6.2 Build 9200
8 processors (x86-64, WOW64)
Language info: 1252, 0x407
13   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Dec 19 2023 : 05:41:52 AM
Strange, I would not expect EnhacedMarcroParsing to reset like that.

Another approach is to create a new, empty text file called "va_stdafx.h" in the same directory as your SLN file. If this file is present, VA parses it before anything else in your solution when doing a VA symbol database rebuild. It is designed to help with odd solution specific problems like this.

Into the file you would need to place a simpler version of the problem macro definition. So something like:

#define BIG_COMPLEX_MACRO(x, y, z) int x = y + z;

making sure to end the file with a blank line. Obviously you would need to work out what the #define should look like, but you can just use an empty #define line instead if it is easier:

#define BIG_COMPLEX_MACRO(x, y, z)

you do need to press the button:

VA Options -> Performance -> Rebuild symbol databases

and restart the IDE for the file, or any changes to the file, to take effect though, and this can take a little while when working with Unreal Engine, simply due to the size of UE.
tw18ggyy Posted - Dec 18 2023 : 10:33:49 PM
Btw, it seems that when we rebuild symbol, the EnhancedMacroParsing will be reset to 0? That's why first time EnhacedMarcroParsing didnt "work" for me.
tw18ggyy Posted - Dec 18 2023 : 10:19:15 PM
Thanks for the quick reply.
The problem is with our own classes. You are right, and VA outline is broken in the header file. It stops parsing header file after some complicated macro.
After enabling the EnhacedMacroParsing, everything works as usual!
feline Posted - Dec 18 2023 : 07:06:04 AM
Are you seeing this problem with a class from Unreal Engine, or one of your own classes?

If you close the files that this class is declared in, and then use VA's Open File in Solution dialog, Alt-Shift-O, and search for the files, are they listed? If VA doesn't know that the files are part of the solution that could be a factor.

What is the file extension for the header file?

Is there any sign of VA working in the header file? For example, does the Alt-M list, or VA Outline work in the header file?

At a guess, it sounds like something near the top of the header file is confusing our parser so badly that nothing further down the file is being picked up. So is anything at all shown in VA Outline? I would expect you to see the lines:

#pragma nce
#includes


at the top of VA Outline at least, even if none of your code is listed.
tw18ggyy Posted - Dec 18 2023 : 05:51:23 AM
Hello,

I am working on a UE4 project and have the similar problem. For the class whose implementation is split in several cpp files, it seems VA cannot recognize its header file. For example, in the cpp files of that class, alt + g and syntax coloring totally not work. I have tried to "Enhance Macros" and rebuild the symbol databases, but it did not work for me.
Here is my version info.

VA_X64.dll file version 10.9.2491.0 built 2023.05.24
DevEnv.exe version 17.8.34330.188 Community
msenv.dll version 17.0.34330.188
Comctl32.dll version 6.10.19041.3636
Windows 10 10.0 22H2 Build 19045.3803
16 processors (x86-64)
Language info: 65001, 0x804

feline Posted - Sep 17 2020 : 06:31:44 AM
Thank you for the update. Obviously if you want or need any help with this then please just ask. I personally haven't used the BOOST_TEST macros, so I don't have a good test case on hand, but if you have a couple of examples, I can try and find a good work around for you.
stifu Posted - Sep 16 2020 : 4:20:10 PM
"Enhance Macros" helps a little with BOOST_TEST macros, even without "NoDepthLimit". It's not perfect, but it works well enough. If I should eventually be fed up with it, I will try to setup macro defines in the VA stdafx.h, so I won't need any more support for now, thanks.
feline Posted - Sep 11 2020 : 07:40:00 AM
Interesting, thank you for the update. With the NoDepthLimit turned off, are you still seeing problems with the BOOST_TEST macros? If so, can you provide a simple example of the sort of problems you are seeing, and I will see if we can find a different, and more reliable solution for these macros.
stifu Posted - Sep 11 2020 : 03:26:45 AM
So I have done a few more tests and finally found the culprit: LimitMacro = "NoDepthLimit".

I had setup "NoDepthLimit" and deep macro parsing because I wanted to get VA to show proper results when using BOOST_TEST, which had been described in this thread: https://forums.wholetomato.com/forum/topic.asp?TOPIC_ID=8594
Now that I have reset LimitMacro to "No", everything works fine again.

I have also tried merging all cpps into one giant 10,000 lines file and disabled deep macro parsing, but these changes did not show any effect. Only LimitMacro did.

FYI, VA Outline and the alt-M list produced reasonable results for the header, even with the malicious LimitMacro setting.

If you want to further debug why NoDepthLimit leads to this issue, I can assist you with that, but I am afraid I won't be able to send you any code.
feline Posted - Sep 10 2020 : 12:10:42 PM
If you would be able to send me one of the header files and the matching, split cpp files, for testing purposes, I can try to make sense of what is happening for you. I appreciate this is often not possible, but it's worth mentioning in case it is an option. If you want to do this please send me the files via email:

[email protected]

including this thread ID or URL in the description, so we can match it up.

It sounds almost like VA is not parsing / understanding the header file correctly, and the other problems follow on from this. If you look at VA Outline or the Alt-M list, are you getting reasonable results for the header file?

I am wondering if heavy use of macros is somehow confusing our parser.
stifu Posted - Sep 10 2020 : 09:44:50 AM
Thanks for the quick answer.

* We have solutions for VS2005 and VS2017. Both compile fine and exhibit the same behavior.
* typedefs, class names, member functions and member variables are affected by this misbehavior.
* It only happens in any of the split cpp files or its associated header. For classes of this project with just one cpp file, it works just fine.
* All cpp files are in the same project.
* If I look at the header file, almost all members are printed in bold letters, as if they were local variables.
* I am specifically not using a simple text based find, but the "Find all References" feature of the IDE. Both VS2005 and VS2017 show the expected result when executing the command, but when I execute it from Visual Assist, I get the "symbol unrecognized" message.

Further info:
* I have deep macro parsing enabled
* A moment ago, it suddenly worked again in VS2005. Then I restarted VS and it didn't work anymore.

I will try to create a minimal sample to demonstrate the issue.
feline Posted - Sep 10 2020 : 06:29:10 AM
Splitting the implementation across cpp files should not cause any problems like this, but obviously something is going wrong here.

First just to double check, when you see this problem, does the code actually compile inside the IDE? Or are you using an external compiler? I am just checking that the code is "normal", so we should expect VA to handle this and to just work correctly.

What sort of symbols are you seeing "symbol is unrecognised" with? The class name? Member function names? Member variables? Is this in one of the split cpp files, the central header file, both?

Are all of the cpp files in the same project? I am just trying to think of anything that might explain why VA is having a problem.

VA's Find References is doing a code aware search, so we try to work out the type of local variables, so we can tell if a member function being called is the member function you want, or a different function from a different file. This is rather different from a simple "search all files for this string" which is probably what you are doing with the IDE's Find.
stifu Posted - Sep 10 2020 : 05:44:28 AM
I just realized the Visual Studios built-in "Find all references" yields the correct result. What is most surprising about this is that I even have VA configured to use the intellisense database, so they should be working the same way.

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