看來旺盛,ctags的默認只添加標籤時,看到一個定義,而不是一個聲明。您A
類更改爲
template<typename TYPE>
class A
{
public:
void test_func(TYPE a)
{
}
void test_func_2(TYPE a);
void test_func_3(TYPE a);
};
使得test_func
在tags
文件顯示:
!_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 /[email protected]/
!_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)$/;" f class:test_space::A
test_space a.h /^namespace test_space$/;" n
,但其他功能沒有顯示出來。我自己並不使用ctags,但通常您希望能夠找到定義而不是聲明,這是有道理的。
如果你告訴ctags的索引protoypes,你可以讓你在找什麼:
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 /[email protected]/
!_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]
你可以看到,默認情況下,函數原型沒有被標記。