SlickEdit Community

Archived Beta Discussions => SlickEdit 201x Beta Discussions => SlickEdit 2016 v21 Beta Discussion => Topic started by: rowbearto on September 12, 2016, 03:32:03 PM

Title: SE beta 5 does not find all references when extern declared inside a function
Post by: rowbearto on September 12, 2016, 03:32:03 PM
Hi:

I have attached a test project.

If you go into file1.c, highlight "global_var", and press Ctrl+/, it only finds the references in file1.c, but not the references in file2.c.

Similarly, if you go to file2.c, highlight "global_var", and press Ctrl+/, it only finds the references in file2.c, but not in file1.c

Thanks,
Rob
Title: Re: SE beta 5 does not find all references when extern declared inside a function
Post by: Clark on September 12, 2016, 04:14:38 PM
Interesting case. We will look into this. Doubtful we'll have time to fix this for the initial v21 release.
Title: Re: SE beta 5 does not find all references when extern declared inside a function
Post by: Dennis on September 12, 2016, 07:27:58 PM
Good example.  This will be hot fixed after v21 is finalized.
Title: Re: SE beta 5 does not find all references when extern declared inside a function
Post by: rowbearto on September 13, 2016, 03:20:30 AM
Thanks!
Title: Re: SE beta 5 does not find all references when extern declared inside a function
Post by: Dennis on September 13, 2016, 03:37:07 PM
Update:  This will be fixed in rc2.
Title: Re: SE beta 5 does not find all references when extern declared inside a function
Post by: rowbearto on September 13, 2016, 03:40:11 PM
Fantastic! Thank you!
Title: Re: SE beta 5 does not find all references when extern declared inside a function
Post by: rowbearto on September 20, 2016, 09:36:36 PM
It seems this issue is not fully fixed. In my real code, it still does not find all the references.

In the testproj that I previously uploaded, go into "function2()" and highlight the "global_var" in "global_var = false" and press Ctrl+/. It pops up a "select symbol" dialog and if you choose the version in file2.c, then it only finds the references in file2.c. I don't understand why it even prompts for this as it is only defined in file1.c.

In my real code, it doesn't prompt me like when looking for global_var starting from file2.c. So not sure if it is the same issue. I will need to try and make another test project.
Title: Re: SE beta 5 does not find all references when extern declared inside a function
Post by: rowbearto on September 20, 2016, 09:49:12 PM
I managed to create a new test project that replicates the issue in my real code (that I can't share).

See attached testproj2.7z.

Go into file1.cpp, on line 7, highlight "global_var", press Ctrl+/. Notice that it does not find the references of global_var in file2.cpp

Similarly, go into file2.cpp, on line 8, highlight "global_var", and press Ctrl+/. Notice that it does not find the referenes of global_var in file1.cpp

Thanks,
Rob
Title: Re: SE beta 5 does not find all references when extern declared inside a function
Post by: Dennis on September 20, 2016, 10:39:36 PM
It prompts because you have both a local declaration for the symbol, and the global definition.  Since you happen to have a local declaration of the symbol, it is possible that you might be interested only in the references to the symbol within the current function.  If so, choose the local.  If you want all references, choose the global.

I reproduced the problem you are having with your sample code.  Thanks, a good example really helps.  This will be fixed in RC3.
Title: Re: SE beta 5 does not find all references when extern declared inside a function
Post by: rowbearto on September 21, 2016, 12:51:59 PM
Thanks for reproducing and having it fixed in RC3.

About the prompting, you say that I have a local declaration, but I really don't. There is an extern in the function, not a declaration. I don't think it should prompt if there is an extern.