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
 Feature Requests
 Find References creation/contr hits and emplace
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Alek86
Junior Member

Canada
20 Posts

Posted - Dec 05 2017 :  3:57:47 PM  Show Profile  Reply with Quote
Hi

If I have code like this:

#include <vector>
using namespace std;
struct S1 {};
int main()
{
	S1 s1;
	vector<S1> v;
	v.emplace_back();
}


and I search where S1 instance is created/constructed, it would be great if C++11 emplace... functions will be also shown, because they do construct instances of corresponding classes.
Currently I don't see emplace_back in the Find References Results window (I tried to attach what I see)




Visual Assist info: VA_X.dll file version 10.9.2223.0 built 2017.06.22

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Dec 05 2017 :  4:04:40 PM  Show Profile  Reply with Quote
My concern with this logic is how far does it extend? What about a template class you wrote yourself, which does the same thing, but with the method "AddNewToTheEnd()" ? Would you then expect VA to also pick this up?

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

Alek86
Junior Member

Canada
20 Posts

Posted - Dec 05 2017 :  4:39:33 PM  Show Profile  Reply with Quote
Maybe.
My concern is:
In case of
v.push_back(S1());
I would see the construction in Find results.
But if I optimize it (VA is now suggesting this optimization), the construction disappears from search results.

I understand, that in push_back you show only the temp class construction, not the copy construction. But from user experience using emplace... becomes a bit of regression.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Dec 06 2017 :  07:32:23 AM  Show Profile  Reply with Quote
The problem with this case is that we textually search for the reference (the string of "S1" in this case) and then we analyze the context to decide if it is relevant to include and if it is, then we decide which filter category to put it in. Creations is such a filter category.

For this to be implemented, we would need to run a find references for every declaration which can be quite slow. Although it's not easy, I don't see why can't we implement this at some point. I've opened a feature request to see what other developers make of it:

case=112782

Regarding template classes you wrote yourself, we have a registry settings for that. You can put custom template function names there which VA will consider a creation.
Go to Top of Page

Alek86
Junior Member

Canada
20 Posts

Posted - Dec 06 2017 :  08:32:27 AM  Show Profile  Reply with Quote
Thank you.
Where can I read about this setting? Maybe I can use it for emplace functions too?
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Dec 06 2017 :  4:29:19 PM  Show Profile  Reply with Quote
quote:
Where can I read about this setting?

https://wholetomato.fogbugz.com/f/page?W792

quote:
Maybe I can use it for emplace functions too?

No, unfortunately, it will not help, since your class/struct name (S1 in your example) cannot be found on the line where you are calling emplace_back(). In other words, we would need to search for the object, not the class name. This is what case=112782 is all about, but that will not happen overnight. It would be a bigger development.
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