Author |
Topic |
|
mnieber
New Member
6 Posts |
Posted - Apr 24 2008 : 04:11:59 AM
|
In my project, we place the implementation of templated classes in .txx files.
I followed the steps of topic 5481 to add .txx to the files that are parsed by Visual Assist, except for step 1 (I did not add .txx as a C++ extension in Visual Studio, because it is not a C++ file extension).
If I now do "Find References" on a symbol (called GetCurrentTimeStep) in the .txx file, I get three hits (which are correct). However, if I do "Find References" on the same symbol in the .h file (where it is declared), I only get two hits (in the .h and .cpp file); the occurrence in the .txx file is missing.
If I cannot trust the outcome of "Find References", I cannot use it of course (which would be a real pity!).
Some details: I am looking for the member function called GetCurrentTimeStep of a class called Plugin. The declaration and definition are in Plugin.h and Plugin.cpp resp, and in Test.txx I am calling this member function.
|
|
mnieber
New Member
6 Posts |
Posted - Apr 24 2008 : 04:37:48 AM
|
Okay, I think I found the solution. The txx file was not present in the visual studio solution. When I added the txx to the solution, the symbol in the .txx file was found correctly with "Find References" on the symbol in the .h file.
|
|
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - Apr 24 2008 : 07:39:49 AM
|
You will need to add the files to the solution, otherwise VA does not know about them, so will not reliably search them when you run Find References. |
zen is the art of being at one with the two'ness |
|
|
hfrmobile
Ketchup Master
Austria
79 Posts |
Posted - Dec 01 2010 : 08:22:00 AM
|
It seems that I have a similar issue: VA does not find all references even all files are part of the solution. To be correct: VS seems to look for references only in the project where I use the "Find References" menu.
My solution looks as follows
solution
exeprj
baselib
lib1
lib2
libN
e.g. I search for references in lib1 VA only finds references in lib1 even lib2 has references to what I am searching for.
Is VA able to search for references within a project only or is it able to search in the entire solution?
Project dependencies are correctly set of course, the project compiles and runs of course.
Only using common file extensions (.h, .cpp). the lib project containing classes within namespaces:
namespace foo
{
class Bar
{
};
}
// usage
class foo::Bar ...
|
Visual Assist X for C/C++ and ReSharper, FxCop and StyleCop for C#, Eclipse Ganymede for Java |
Edited by - hfrmobile on Dec 01 2010 08:25:47 AM |
|
|
hfrmobile
Ketchup Master
Austria
79 Posts |
Posted - Dec 07 2010 : 10:05:54 AM
|
Just tried to use "Find References" on L:
SomeMethod(L"text");
It shouldn't find any references since L is no method etc. But it finds some references in my case since in my current project I work for defines a log class which defines a method named L ;-) (e.g. Log::L(string))
It seems to me that the "Find References" feature not really parses C++ code. It seems that it is just a kind of "text find". |
Visual Assist X for C/C++ and ReSharper, FxCop and StyleCop for C#, Eclipse Ganymede for Java |
Edited by - hfrmobile on Dec 07 2010 10:07:28 AM |
|
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - Dec 08 2010 : 10:45:39 PM
|
Apologies for the slow reply to this.
Find References and "L" first, I have just tested this here, and Find References is not finding a function called "L" for me in this situation, when triggered from a string. But it is correctly finding the function when triggered within my test logging class. Perhaps something is confusing our parser.
Find References is designed to search across multiple projects in the same solution, assuming that VA is aware of all of the files / projects in the solution.
How are you triggering Find References?
Obviously the command:
VAssistX -> Find References in File
is not expected to search for references in other files, or other projects, but the "Find References" command should, and does for me.
Are the code files from the various solutions being listed in VA's Open File dialog?
If you add a simple dummy function to one of the projects, outside of any namespaces, e.g.
void TestVAFindAcrossProjects() { }
and then call this from another project, wait for VA to colour all calls as functions, and then run Find References, what results do you get? Do you get different results if you trigger the Find References from the declaration or from one of the calls? |
zen is the art of being at one with the two'ness |
|
|
hfrmobile
Ketchup Master
Austria
79 Posts |
Posted - Dec 09 2010 : 07:59:42 AM
|
quote:
Find References and "L" first, I have just tested this here, and Find References is not finding a function called "L" for me in this situation, when triggered from a string. But it is correctly finding the function when triggered within my test logging class. Perhaps something is confusing our parser.
I agree to the last sentence ;-) See also http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=9873 I do the following: select L from L"text" and use "Find References". It will find L function within the same project only.
quote:
Find References is designed to search across multiple projects in the same solution, assuming that VA is aware of all of the files / projects in the solution.
Good to know. Indeed there is something strange in the solution I work for at the moment which needs some investigation ...
quote:
How are you triggering Find References?
Of course I used "Find References". There seems to be problems with overloads but this is a known issue.
Have created a TestVAFindAcrossProjects() function/method and referenced it in other projects and it worked! So there is something strange with the existing source code ... |
Visual Assist X for C/C++ and ReSharper, FxCop and StyleCop for C#, Eclipse Ganymede for Java |
|
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - Dec 09 2010 : 9:45:49 PM
|
I assumed you were using Find References, but good to check these assumptions
If you move this test function into the namespace you are using, is it still found correctly?
The namespaces, or possibly some other symbols with duplicate names might be the problem here. |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|