使用的ctags发现在C++

问题描述:

构造函数声明的变量通过使用此命令使用的ctags发现在C++

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

CTAGS只能找到变量C2,而不是varibale C3

代码片段:

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

是的,这看起来像ctags难以解析的东西。我的建议:找到一个使用llvm静态分析源的标记生成器。如果您想知道为什么难以解析,请参阅以下文章:https://en.m.wikipedia.org/wiki/Most_vexing_parse –

通用 - 标签(https://ctags.io/)可以捕获c3。

[[email protected] ctags]$ cat /tmp/foo.cpp 
int main() 
{ 
    int c2 = 5; 
    int c3(3); 
    return 0; 
} 
[[email protected] 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