C++ ctags不是索引类成员函数
我正在使用ctags索引我的源代码。 为了简单起见,我组装了一些示例代码,如下所示C++ ctags不是索引类成员函数,c++,c,ctags,C++,C,Ctags,我正在使用ctags索引我的源代码。 为了简单起见,我组装了一些示例代码,如下所示 namespace test_space { template<typename TYPE> class A { public: void test_func(TYPE a); void test_func_2(TYPE a); void test_func_3(TYPE a); } class B { public: void test_func_b(); } vo
namespace test_space
{
template<typename TYPE>
class A
{
public:
void test_func(TYPE a);
void test_func_2(TYPE a);
void test_func_3(TYPE a);
}
class B
{
public:
void test_func_b();
}
void easy_func()
{
}
}
在默认情况下,繁荣的CTAG似乎只在看到定义而不是声明时添加标记。将班级
A
更改为
template<typename TYPE>
class A
{
public:
void test_func(TYPE a)
{
}
void test_func_2(TYPE a);
void test_func_3(TYPE a);
};
但其他功能没有显示出来。我自己不使用CTAG,但您通常希望能够找到定义,而不是声明,这是有道理的
如果您让ctags索引原型,您可以得到您想要的:
ctags --c-kinds=+p a.h
例如,这将导致
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
A a.h /^class A$/;" c namespace:test_space
B a.h /^class B$/;" c namespace:test_space
easy_func a.h /^void easy_func()$/;" f namespace:test_space
test_func a.h /^ void test_func(TYPE a);$/;" p class:test_space::A
test_func_2 a.h /^ void test_func_2(TYPE a);$/;" p class:test_space::A
test_func_3 a.h /^ void test_func_3(TYPE a);$/;" p class:test_space::A
test_func_b a.h /^ void test_func_b();$/;" p class:test_space::B
test_space a.h /^namespace test_space$/;" n
您可以获得更多有关标记内容的详细信息,如下所示:
$ ctags --list-kinds=c
c classes
d macro definitions
e enumerators (values inside an enumeration)
f function definitions
g enumeration names
l local variables [off]
m class, struct, and union members
n namespaces
p function prototypes [off]
s structure names
t typedefs
u union names
v variable definitions
x external and forward variable declarations [off]
您可以看到,默认情况下,函数原型没有标记
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
A a.h /^class A$/;" c namespace:test_space
B a.h /^class B$/;" c namespace:test_space
easy_func a.h /^void easy_func()$/;" f namespace:test_space
test_func a.h /^ void test_func(TYPE a);$/;" p class:test_space::A
test_func_2 a.h /^ void test_func_2(TYPE a);$/;" p class:test_space::A
test_func_3 a.h /^ void test_func_3(TYPE a);$/;" p class:test_space::A
test_func_b a.h /^ void test_func_b();$/;" p class:test_space::B
test_space a.h /^namespace test_space$/;" n
$ ctags --list-kinds=c
c classes
d macro definitions
e enumerators (values inside an enumeration)
f function definitions
g enumeration names
l local variables [off]
m class, struct, and union members
n namespaces
p function prototypes [off]
s structure names
t typedefs
u union names
v variable definitions
x external and forward variable declarations [off]