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
 Move Method implimentations bug
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Breany
New Member

8 Posts

Posted - Jul 18 2017 :  12:41:50 AM  Show Profile  Reply with Quote
This applies a lot to Qt code (Which requires QOBJECT define at the beginning of each Qt class), but here's an independent example:
I craft this test code -


#define STUBBYS TestClass() {}  virtual ~TestClass() {}

class TestClass
{
public:
  STUBBYS;
  int TestFunc() { return 1; }
};


Right-click the class and select "Move method implementations to source file", and strangely 3 functions show up in the list, not one. For grins, just hit okay moving all functions, and this results:
(Header file)


#define STUBBYS TestClass() {}  virtual ~TestClass() {}

class TestClass
{
public:
  STUBBYS;
  int TestFunc();
};

(Source file)

int TestClass::TestFunc()
{
  return 1;
}

TestClass::TestClass()
{

}

TestClass::~TestClass()
{

}


Obviously, it should not (and does not have the ability to) move the definitions out of the #define, but it should also not generate duplicate definitions!

I know this example is ... Rather bad code... But it shows the problem.

VA_X.dll file version 10.9.2223.0 built 2017.06.22
DevEnv.exe version 14.0.25420.1 Professional
msenv.dll version 14.0.25425.1

feline
Whole Tomato Software

United Kingdom
18755 Posts

Posted - Jul 18 2017 :  07:32:51 AM  Show Profile  Reply with Quote
Currently what VA is doing is generally "correct". It's surprisingly common to come across cases where parts of a class are defined by a macro somewhat like this.

To change how VA handles this macro, either STUBBYS or Q_OBJECT, depending on your situation, create a new text file called "va_stdafx.h" and place it in the same directory as your SLN or VCXPROJ file. Open the file in a text editor, and add the line or lines:

#define STUBBYS
#define Q_OBJECT

making sure the file ends with a blank line. Now press the button:

VA Options -> Performance -> Rebuild symbol databases

and restart your IDE. There is no need to add this file to the solution, VA looks specifically for this file, which is used to help our parser, or to tell it to handle things in a specific manor.

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