abd
abd

Reputation: 55

Using ctags to find variables declared with a constructor in c++

By using this command

ctags -R --c++-kinds=l -x test.cpp 

ctags can only find variable c2 and not varibale c3

code snippet :

int main()
{
  int c2 = 5;
  int c3(3);
  return 0;
}

Upvotes: 1

Views: 939

Answers (1)

Masatake YAMATO
Masatake YAMATO

Reputation: 1300

Universal-ctags(https://ctags.io/) can capture c3.

[jet@localhost ctags]$ cat /tmp/foo.cpp
int main()
{
  int c2 = 5;
  int c3(3);
  return 0;
}
[jet@localhost ctags]$ ./ctags --kinds-C++=+l -o - /tmp/foo.cpp
c2  /tmp/foo.cpp    /^  int c2 = 5;$/;" l   function:main   typeref:typename:int    file:
c3  /tmp/foo.cpp    /^  int c3(3);$/;"  l   function:main   typeref:typename:int    file:
main    /tmp/foo.cpp    /^int main()$/;"    f   typeref:typename:int

Upvotes: 2

Related Questions