Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Visual Assist
 Feature Requests
 Find References for Operators
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

eplawless
New Member

Canada
5 Posts

Posted - May 28 2011 :  1:04:39 PM  Show Profile  Visit eplawless's Homepage  Reply with Quote
We've been using VA X on a project with a few million lines of C++, and it's been great for performing project-wide renaming and hunting down uses of a given method. Right now, the one feature we're really hurting for is the ability to find all references to operators. For example:

struct Example {
    int operator[](const std::string &foo);
};

The ability to right click on "operator" and find all references would be wonderful. Other operators might receive similar treatment; UI-wise, I'm unsure how you'd go in the other direction (i.e. go to definition for operators) but that'd be fantastic too.

Renaming would just be icing, but we've got a real need for the find references feature.

accord
Whole Tomato Software

United Kingdom
2577 Posts

Posted - May 30 2011 :  08:46:33 AM  Show Profile  Reply with Quote
Find references and rename on operators are disabled because it would be computationally expensive to find the references. Say, you have a + operator overloaded. + (and other operators) are very common in any source code, so we would end up with loads of stuff to examine. For functions, a find operation with "match case" and "match whole word" enabled already filters the search pretty well, so VA just needs to examine these cases. Analyzing the context and deciding whether a result is a reference or not is the slow part of the operation.

However, Visual Assist offer information and goto on a few operators. e.g. operator() and operator[] are supported. Just place the caret after the ']' and you will get context and definition field and can use goto:



The snippet itself is indeed nonsense and just to demonstrate how VA works.
Go to Top of Page

eplawless
New Member

Canada
5 Posts

Posted - May 30 2011 :  11:01:11 AM  Show Profile  Visit eplawless's Homepage  Reply with Quote
Thanks for the reply; with that rationale, disabling find references for operators is totally understandable since it would interfere with interactive use. That said, it would be really helpful if there was an option to enable it regardless, and we could let it run the search overnight (or over the weekend) (or over the whole week, if necessary). It seems as though all of the ingredients are there to have this work, and it would be extremely useful for our project. Even if it was only enabled for operators [] and () we'd be really happy.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
2577 Posts

Posted - May 30 2011 :  11:29:16 AM  Show Profile  Reply with Quote
*wow* Would you wait it for a weekend? Intriguing. What would you use it for? Are you using the operator for something special?
Anyway, I don't think that it is implemented already. But I'm not sure about it.

Have you tried commenting out the declaration and the definition of an operator? This way, the compiler should list you the references in the form of error messages. This remind me the old times, the pre-find references era
Go to Top of Page

eplawless
New Member

Canada
5 Posts

Posted - May 30 2011 :  11:54:19 AM  Show Profile  Visit eplawless's Homepage  Reply with Quote
That's what I've been trying to avoid having to do :) Recompiling the project takes a few hours, and it'd go a heck of a lot faster if we had this feature.

We've got an in-house STL (ish?) implementation, written before they were generally reliable or efficient (some of it was written before the bool type was added to C++). Someone decided way back then to use operator() on containers to mean normal indexing and operator[] to mean indexing which would grow the container to fit the index. We're trying to get rid of operator() and modify operator[] so that it's the normal indexing operator, but we're a relatively small team (10-15 people) and need to minimize the time spent on this (and everything else). Visual Assist X has been fantastic for our previous sweeps through the (again, several million line) codebase, and I'm hoping we can use it again here.

I think this feature is useful beyond our particular case. Several times I've wanted to find references to or rename an operator (it's usually operators () and []), though I'd be hard-pressed to give you specific examples here.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
2577 Posts

Posted - May 30 2011 :  2:56:52 PM  Show Profile  Reply with Quote
I have put in a feature request to see what the developers make of it:

case=57778

However, don't hold your breath: I don't know how soon (if at all) it gets implemented. We have a loads of outstanding other feature requests, and we have to prioritize them somehow.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Whole Tomato Software Forums © 2014 Whole Tomato Software, Inc Go To Top Of Page
Snitz Forums 2000