[cfe-users] How to use clang-tidy plugin.

Benjamin Kramer via cfe-users cfe-users at lists.llvm.org
Fri Jan 20 02:15:40 PST 2017


Using ASTMatchers in a plugin should work as long as clang doesn't use
them. The problems arise when both the plugin and clang define the
same symbols. But with the current cmake build it's not possible to
just link ASTMatchers, it will drag all dependencies of ASTMatchers
along and cause linker errors.

On Fri, Jan 20, 2017 at 9:44 AM, Alfred Zien <zienag at yandex-team.ru> wrote:
> Thanks for clarifying! Based on this, as I understand, we can't use any other library (for example ASTMatchers) in plugin that clang doesn't use?
>
>> On 19 Jan 2017, at 19:44, Benjamin Kramer <benny.kra at gmail.com> wrote:
>>
>> I don't think I ever added the build rules to build clang-tidy as a
>> plugin for use outside of libclang. You can use it via libclang and
>> the python bindings currently. Adding the necessary build rules isn't
>> easy because you'd have to avoid linking clang symbols into both the
>> plugin and the actual clang binary, the current cmake layout doesn't
>> really support that :(
>>
>> On Tue, Jan 17, 2017 at 4:12 PM, Alfred Zien via cfe-users
>> <cfe-users at lists.llvm.org> wrote:
>>> Hi! I need to use clang-tidy as a clang plugin, but can't figure out how to do it.
>>>
>>> I see ClangTidyPlugin.cpp file, and there is ClangTidyPlugin target, but when I run `make clangTidyPlugin` it produces only libclangTidyPlugin.a, no any dynamic library. Am I doing something wrong? Is it even possible?
>>>
>>> Thanks for any help.
>>> _______________________________________________
>>> cfe-users mailing list
>>> cfe-users at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>



More information about the cfe-users mailing list