clang 能够取代 Exuberant Ctags 吗?

use*_*710 3 c++ llvm clang exuberant-ctags c++11

要调查我用来运行ctags适当的选项的新文件,问题是显然这个程序并不支持C ++ 11,直到我发现该计划的发展,我刚刚以年前截止。

现在我需要一个用于 C++11 及更高版本的等效工具,我记得clang只有它能够输出AST任何给定文件的 ,所以我想知道前端是否具有与我以前使用ctags.

例如,这是您可以ctags在 C++ 模式下轻松列出的实体

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]
Run Code Online (Sandbox Code Playgroud)

是否clang能够执行类似的任务?

Nik*_*lai 6

看看rtags工具。它使用 clang 重新编译您的整个项目。之后,您可以使用它来浏览源。唯一的问题是 AST 是在预处理器运行后构建的,因此被宏禁用的代码无法用于导航。

这些项目维护了一组 elisp 绑定,允许您RTags从 emacs进行控制。要在 vim 中集成,请参阅lyutsShane Harper的第三方项目。