Author |
Topic |
|
gdobratz
Junior Member
USA
17 Posts |
Posted - May 31 2015 : 3:04:44 PM
|
Consider the following code:
class A { void Foo(); } class B { A* pA; A* operator->(void) { return pA; } } // B is your typical smart pointer class.
... B myBs[2]; ... myBs[0]->Foo(); // Find References misses this reference to Foo.
VA_X.dll file version 10.9.2062.0 built 2015.04.07 DevEnv.exe version 14.0.22823.1 Professional msenv.dll version 14.0.22823.1 Comctl32.dll version 6.10.7601.17514 Windows 7 6.1 Build 7601 Service Pack 1, 64-bit 12 processors (x86-64, WOW64), 3.5 GHz, 24GB memory Language info: 1252, 0x409
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Jun 01 2015 : 8:33:48 PM
|
I've assembled a little sample code from your snippets and Visual Assist was able to find the reference for me:
class A {public: void Foo(); };
class B { public: A* pA; A* operator->(void) { return pA; } };
// B is your typical smart pointer class.
void func()
{
B myBs[2];
myBs[0]->Foo(); // Find References misses this reference to Foo.
}
Can you please create a clean new win32 test project and paste the above code snippet to it? Are you able to reproduce the problem there?
If you can't reproduce the problem in a clean new project, you might have something in your source code that triggers this problem in your "real" project. For example, are you using any "complex" macros? e.g. Macros that calls other macros or macros that create code (setters, getters, or part of the class, defines a namespace, etc.) |
|
|
gdobratz
Junior Member
USA
17 Posts |
Posted - Jun 03 2015 : 8:45:46 PM
|
The original snippet that I posted was a simplification of the code in which I encountered the problem. I have since encountered other situations in which Find References does not find references and they all follow the pattern that the type of the variable is a typedef/using declaration of a class. Please try the following snippet:
class A {public: void Foo(); }; class B { public: A* pA; A* operator->(void) { return pA; } }; // B is your typical smart pointer class.
using BArray_t = B[2];
void func() { BArray_t myBs; myBs[0]->Foo(); // Find References misses this reference to Foo. }
I have also encountered problems with the following simpler code:
class A { void Bar(); } using a_t = A;
void func() { a_t Foo; Foo.Bar(); // Attempts to click on Bar, on the line above, and select Find References results in an error message stating that there is no definition for the symbol. }
Also, I noticed in your reply that you mentioned a win32 project. In case it matters, all of my projects are X64 projects.
|
Edited by - gdobratz on Jun 03 2015 8:46:27 PM |
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Jun 03 2015 : 9:23:56 PM
|
Yes, I realized that these are simplified code samples on you part, and creating those is usually a good start when trying to figure out what is happening. Another approach is to use the original source and start deleting code, more and more as far as a missing feature starts working.
I've just used your samples to start somehow because first we need to reproduce the problem before we can fix it.
Unfortunately find references works with both of your sample codes.
I think that something is going on with the part before the . or -> I mean, if you move your caret over the method name that is skipped / unrecognized in your project, can you please check what is the content of your VA navigation bar there? http://docs.wholetomato.com/default.asp?W188
I'm concerned about the right side which is next to your green "Go" button. Is that empty or shows the correct type?
In case it's empty: can you please try take a screenshot of the code where VA fails? It might offer us some clue about what is happening. |
|
|
gdobratz
Junior Member
USA
17 Posts |
Posted - Jun 04 2015 : 01:00:23 AM
|
I isolated the failure to the following code snippet (this code is my entire project and the only CPP file):
#include "StdAfx.h"
class Foo { public: void Bar( void ) { } };
using foo_t = Foo;
class Bar { public: using fooarray_t = foo_t[2]; fooarray_t Foos; };
using bar_t = Bar;
void Main( void ) { foo_t Fubar; Fubar.Bar();
bar_t Bars; Bars.Foos[1].Bar(); }
If I click on the definition of Bar in the Foo class and choose Find References, it finds only the definition of the Bar function and the reference to Bar in the line Fubar.Bar(); it does not find the more complex reference in the line Bars.Foos[1].Bar().
If I click on 'Bar' in the missed reference, the VA navigation bar is empty for both the left and right panels.
If I click on 'fooarray_t' in the Bar class definition of 'Foos', the VA navigation bar is empty for both the left and right panels.
The key to what works and what doesn't work seems to be the 'using' definition for fooarray_t being inside the class. If I move the using declaration for 'fooarray_t' outside the class, everything works.
Hope this helps.
|
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Jun 06 2015 : 8:48:07 PM
|
I am seeing the same effect here:
case=87178
Thank you for taking the time to reproduce the problem, it helps a lot. |
Edited by - accord on Jun 06 2015 8:48:27 PM |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Nov 20 2015 : 4:08:20 PM
|
case=87178 is fixed in build 2083 |
|
|
|
Topic |
|