References don't work for local variables

General questions regarding the usage of CodeLite
guyr
CodeLite Enthusiast
Posts: 11
Joined: Wed Feb 01, 2017 11:16 am
Genuine User: Yes
IDE Question: C++
Contact:

References don't work for local variables

Post by guyr »

While trying to understand a complex code base, I discovered that Goto Declaration, Goto Implementation, and Search -> Find References don't appear to work for local variables. Here is a small, standalone code sample that demonstrates this. Within Codelite, only global_int gets any results for those 3 search actions. Those 3 search actions don't do anything with local variables - main_int, ret, param_int, func1_int. Is this intentional?

Thanks.

Code: Select all

#include <stdio.h>

int global_int = 4;

int func1(int param_int)
{
	int func1_int = 3;
	func1_int *= param_int;
	func1_int += global_int;	
	printf("func1 ret: %d\n", func1_int);
	return func1_int;
}

int main(int argc, char **argv)
{
	int main_int =  global_int + 1;
	printf("main hello world\n");
	int ret = func1(main_int);
	printf("main ret: %d\n", ret);
	return 0;
}
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: References don't work for local variables

Post by eranif »

if the code base can be compiled within CodeLite (I am not sure you are browsing the source code)
the goto decl/impl should work for local variables. for several versions now, we switched to use clangd as our main C/C++ code completion engine
and it proven to be quite reliable. so if you can shed some more info on your workspace details...
Make sure you have read the HOW TO POST thread
guyr
CodeLite Enthusiast
Posts: 11
Joined: Wed Feb 01, 2017 11:16 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: References don't work for local variables

Post by guyr »

I'm using CodeLite version 14.0 on Windows, using the WinGW-W64 compiler version 8.1.0. I also tried with the msys2 embedded compiler gcc version 10.2.0, same result. I just created a new C++ workspace, using all defaults. I created a new project: Console, Simple executable (gcc), compiler WinGW-W64 8.1.0. I copied and pasted the code I posted into main.c, compiled and ran it. Got the expected results.

But still trying to Goto Declaration, Goto Implementation, and Search -> Find References don't work for local variables.
Post Reply