clang - 符号(变量,函数,类型等)定义或声明或引用 [英] clang - symbol(variable, function, type, etc..) definition or declaration or reference

查看:1106
本文介绍了clang - 符号(变量,函数,类型等)定义或声明或引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉任何人知道clang是否有返回符号定义或声明(或引用)的选项?

Please do anyone know if clang has option to return symbol definition or declaration(or reference)?

我的意思是: completion-at = path_to_file:line:coloumn
clang将查看代码并返回完成字符串(例如,如果有例如
std :: string_type_variable。..it将返回所有方法,可以从std :: string调用的属性。

I mean: there is option for clang executable called -code-completion-at=path_to_file:line:coloumn the clang will look into code and returns you completion strings(ie if there is for example std::string_type_variable. ..it returns to you all the methods and attributes you can call from std::string.

现在我想要的是,为clang返回文件和坐标,符号的定义开始。如果它std :: string_type_variable - 我想返回到我坐标,其中我有writte std :: string变量;在代码中。

Now what i want is, for clang to return the file and coordinates, where the definition of the symbols starts .. so if it std::string_type_variable - i want to return to me coordinates, where i have writte std::string variable; in the code.

我想使用它vim而不是cscope / ctags过时的功能(标签系统使用ctags / cscope在vim不知道上下文 - 它不能在更大的项目中使用)
我知道有clang跟进(http://blog.wuwon.id 。/ / / / / / vim-plugin-for-navigating-c-with.html)但它不能正常工作(实际上对我来说根本不工作)

I want to use it in vim instead of cscope/ctags obsolete functionality(tags system using ctags/cscope in vim doesnt know context - its not usable at all in bigger projects) I know there is clang followup(http://blog.wuwon.id.au/2011/10/vim-plugin-for-navigating-c-with.html) but it doesnt work correctly(actually doesnt work for me at all)

是甚么可能?它应该不是那么难,如果它可以返回完成,它可能已经知道,从他读的变量的定义...

Is it even possible? it shouldn't be that hard, if it can return the completion, it probably already knows, where from he read the definition of the variable...

推荐答案

Clang通过libclang共享库提供了这样的功能,但是有一个简单的例子说明如何使用它。如果你从源代码编译clang,看看c-index-test可执行文件。它的源位于tools / c-index-test。

Clang provides such functionality by libclang shared library, but there is a simple example on how to use it. If you built clang from source, take a look at c-index-test executable. It's source located in tools/c-index-test.

这篇关于clang - 符号(变量,函数,类型等)定义或声明或引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆