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 on methods preceded by macro
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

chrisaverage
Junior Member

Poland
20 Posts

Posted - Sep 12 2017 :  08:45:36 AM  Show Profile  Reply with Quote
Find References does not find results when invoked on a method call that is preceded by a macro:

#define FOO

void bar()
{
   FOO bazz(); //Find References doesn't work on bazz()
}

A workaround is to go to bazz() declaration first and invoke find references there, but it should be possible directly.

This is especially annoying when working with Qt framework, as it uses "emit" macro that expands to nothing to denote method calls that act as signal emitter.

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 12 2017 :  12:30:55 PM  Show Profile  Reply with Quote
What version of Visual Assist and Visual Studio are you using? Triggering Find References on bazz() inside bar() works for me using VS2015 update 3 and Visual Assist build 2231.



Can you please try creating a clean new win32 project and paste the below sample there to see if it makes any difference for you?

void bazz()
{
	
}

#define FOO

void bar()
{
	FOO bazz(); //Find References doesn't work on bazz()
}

Edited by - accord on Sep 12 2017 12:32:17 PM
Go to Top of Page

chrisaverage
Junior Member

Poland
20 Posts

Posted - Sep 12 2017 :  3:40:15 PM  Show Profile  Reply with Quote
Right, it works in the simple example I gave. Sorry about that. Apparently a repro is more involved. I'm experiencing it in a large solution.
I'll try to extract the problem to a small example and will post back.

I'm using VS2017 (v 15.3.3) and Visual Assist build 2231, but it's also present in VS2012.
Go to Top of Page

chrisaverage
Junior Member

Poland
20 Posts

Posted - Sep 12 2017 :  4:32:04 PM  Show Profile  Reply with Quote
Ok, I've got a reproducible example. There are couple of necessary conditions:
- The class needs to be in proper h/cpp files. The problem doesn't occur when it's in a single cpp.
- The method in question needs to be in another cpp file (Qt generates signal method's bodies to a separate file).

Here's a sample:
//main.cpp
#include "TestClass.h"
int main()
{
    TestClass t;
    t.foo();
}

//TestClass.h
#pragma once
class TestClass
{
public:
    void foo();
    void bar();
};

//TestClass.cpp
#include "TestClass.h"
#define FOO
void TestClass::bar()
{
    FOO foo(); //this is the troubled place
}

//Generated.cpp
#pragma once
#include "TestClass.h"
void TestClass::foo() {}

So without the FOO macro I get the correct result:



And when I add the macro I only get this:




Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 13 2017 :  1:08:06 PM  Show Profile  Reply with Quote
Thank you for taking the time looking into this. I still get the correct result using your samples using your 3 files.

If you created a new sample project, can you please zip it up and send it in? You can use the below form to send the files.
https://www.wholetomato.com/support/contact.asp

Please paste the URL of this topic into the "Your Request" field.
Go to Top of Page

chrisaverage
Junior Member

Poland
20 Posts

Posted - Sep 13 2017 :  3:48:16 PM  Show Profile  Reply with Quote
I've sent a sample - case number 111075. It's just a bare bones console app with the above code.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 17 2017 :  11:53:57 AM  Show Profile  Reply with Quote
Thank you for the test project. I was able to reproduce your problem and I have put in a bug report for this.

case=111132
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